Skip to content
Permalink
Browse files

changing irgtt and sw function names, updating documentation

  • Loading branch information
jm3594 committed Jan 9, 2020
1 parent 4826088 commit 130d21b229c73bc74044e76ff6b4034e9370dbd3
@@ -36,7 +36,7 @@
#' @examples
#' # Find the required number of subjects per intervention cluster an IRGTT with alpha = 0.05,
#' power = 0.80, nclusters = 23, ncontrols = 146, icc = 0.05, p.e = 0.397, and p.c = 0.243.
#' crtpwr.irgtt.prop(nclusters=23, ncontrols = 146, icc = 0.05, p.e = 0.397, p.c = 0.243)
#' cpa.irgtt.binary(nclusters=23, ncontrols = 146, icc = 0.05, p.e = 0.397, p.c = 0.243)
#' #
#' # The result, nsubjects = 7.96624, suggests 8 subjects per cluster in the intervention arm should be recruited.
#' # This means that the total number of subjects in the study is nclusters*nsubjects + ncontrols = 23*8 + 146 = 330.
@@ -47,10 +47,10 @@
#'
#' @export

crtpwr.irgtt.prop <- function(alpha = 0.05, power = 0.80, nclusters = NA,
nsubjects = NA, ncontrols = NA,
icc = NA, p.e = NA, p.c = NA,
tol = .Machine$double.eps^0.25){
cpa.irgtt.binary <- function(alpha = 0.05, power = 0.80, nclusters = NA,
nsubjects = NA, ncontrols = NA,
icc = NA, p.e = NA, p.c = NA,
tol = .Machine$double.eps^0.25){

# list of needed inputs
needlist <- list(alpha, power, nclusters, nsubjects, ncontrols, icc, p.e, p.c)
@@ -123,8 +123,8 @@ crtpwr.irgtt.prop <- function(alpha = 0.05, power = 0.80, nclusters = NA,
# calculate p.e
if (is.na(p.e)) {
p.e <- stats::uniroot(function(p.e) eval(pwr) - power,
interval = c(1e-10, 1 - 1e-10),
tol = tol)$root
interval = c(1e-10, 1 - 1e-10),
tol = tol)$root
}

# calculate p.c
@@ -133,7 +133,7 @@ crtpwr.irgtt.prop <- function(alpha = 0.05, power = 0.80, nclusters = NA,
interval = c(1e-10, 1 - 1e-10),
tol = tol)$root
}

structure(get(target), names = target)
}

@@ -36,7 +36,7 @@
#' @examples
#' # Find the required number of control subjects for an IRGTT with alpha = 0.05, power = 0.80,
#' # nclusters = 10, nsubjects = 10, d = 0.5 units, varu = 0.1, vare = 0.9, varr = 1.
#' crtpwr.irgtt.mean(nclusters=10, nsubjects = 10, d = 0.5, varu = 0.1, vare = 0.9, varr = 1)
#' cpa.irgtt.normal(nclusters=10, nsubjects = 10, d = 0.5, varu = 0.1, vare = 0.9, varr = 1)
#' #
#' # The result, ncontrols = 77.81084, suggests 78 subjects in the control arm should be recruited.
#' # This means that the total number of subjects in the study is nclusters*nsubjects + ncontrols = 10*10 + 78 = 178.
@@ -47,10 +47,10 @@
#'
#' @export

crtpwr.irgtt.mean <- function(alpha = 0.05, power = 0.80, nclusters = NA,
nsubjects = NA, ncontrols = NA, d = NA,
varu = NA, vare = NA, varr = NA,
tol = .Machine$double.eps^0.25){
cpa.irgtt.normal <- function(alpha = 0.05, power = 0.80, nclusters = NA,
nsubjects = NA, ncontrols = NA, d = NA,
varu = NA, vare = NA, varr = NA,
tol = .Machine$double.eps^0.25){

# list of needed inputs
needlist <- list(alpha, power, nclusters, nsubjects, ncontrols, d, varu, vare, varr)
@@ -44,7 +44,7 @@
#' # Find the required number of clusters switching to intervention at each time point for a trial
#' # with alpha = 0.05, power = 0.80, nsubjects = 50, ntimes = 5, d = 1.5 units, icc = 0.2,
#' # rho_c = 0.80, rho_s = 0.50, and vart = 16 square-units.
#' crtpwr.sw(nsubjects = 50, ntimes = 5, d = 1.5, icc = 0.2, rho_c = 0.80, rho_s = 0.50, vart = 16)
#' cpa.sw.normal(nsubjects = 50, ntimes = 5, d = 1.5, icc = 0.2, rho_c = 0.80, rho_s = 0.50, vart = 16)
#' #
#' # The result, nclusters = 2.134918, suggests 3 clusters switching per time point should be used. This
#' # means that the total number of clusters in the study is nclusters*ntimes = 3*5 = 15.
@@ -58,11 +58,11 @@
#'
#' @export

crtpwr.sw <- function(alpha = 0.05, power = 0.80, nclusters = NA,
nsubjects = NA, ntimes = NA, d = NA, icc = NA,
rho_c = NA, rho_s = NA,
vart = NA,
tol = .Machine$double.eps^0.25){
cpa.sw.normal <- function(alpha = 0.05, power = 0.80, nclusters = NA,
nsubjects = NA, ntimes = NA, d = NA, icc = NA,
rho_c = NA, rho_s = NA,
vart = NA,
tol = .Machine$double.eps^0.25){

# list of needed inputs
needlist <- list(alpha, power, nclusters, nsubjects, ntimes, d, icc, rho_c, rho_s, vart)

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

0 comments on commit 130d21b

Please sign in to comment.
You can’t perform that action at this time.