cps.irgtt.normal: Simulation-based power estimation for continuous outcome...

Description Usage Arguments Details Value Author(s) Examples

View source: R/cps.irgtt.normal.R

Description

This function uses iterative simulations to determine approximate power for individually randomized group treatment trials with a normally-distributed outcome of interest. Users can modify a variety of parameters to suit the simulations to their desired experimental situation. This function returns the summary power values for each arm.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
cps.irgtt.normal(
  nsim = NA,
  nsubjects = NA,
  nclusters = NA,
  mu = NA,
  mu2 = NA,
  sigma_sq = NA,
  sigma_b_sq = 0,
  ICC2 = NA,
  sigma_sq2 = NA,
  sigma_b_sq2 = 0,
  alpha = 0.05,
  quiet = FALSE,
  allSimData = FALSE,
  nofit = FALSE,
  seed = NA,
  poorFitOverride = FALSE,
  lowPowerOverride = FALSE,
  timelimitOverride = TRUE
)

Arguments

nsim

Number of datasets to simulate; accepts integer (required).

nsubjects

Number of subjects per cluster in each arm; accepts either a scalar (equal cluster sizes, both groups), a vector of length two (equal cluster sizes within groups), or a vector of length sum(nclusters) (unequal cluster sizes within groups) (required).

nclusters

Number of clusters in the clustered group; accepts a scalar (required)

mu

Expected mean of arm 1; accepts numeric (required).

mu2

Expected mean of arm 2; accepts numeric (required).

sigma_sq

Within-cluster variance; accepts numeric

sigma_b_sq

Between-cluster variance for clusters in arm 2. Defaults to 0.

ICC2

Intra-cluster correlation coefficient for clusters in arm 2

sigma_sq2

Within-cluster variance for clusters in arm 2

sigma_b_sq2

Between-cluster variance for clusters in arm 2.

alpha

Significance level; default = 0.05.

quiet

When set to FALSE, displays simulation progress and estimated completion time; default is FALSE.

allSimData

Option to output list of all simulated datasets; default = FALSE.

nofit

Option to skip model fitting and analysis and return the simulated data. Defaults to FALSE.

At least 2 of the following must be specified:

seed

Option to set seed. Default is NA.

poorFitOverride

Option to override stop() if more than 25% of fits fail to converge; default = FALSE.

lowPowerOverride

Option to override stop() if the power is less than 0.5 after the first 50 simulations and every ten simulations thereafter. On function execution stop, the actual power is printed in the stop message. Default = FALSE. When TRUE, this check is ignored and the calculated power is returned regardless of value.

timelimitOverride

Logical. When FALSE, stops execution if the estimated completion time is more than 2 minutes. Defaults to TRUE.

Details

Runs the power simulation.

Users must specify the desired number of simulations, number of subjects per cluster, number of clusters per arm, expected means for the arm 1 and arm 2 (respectively), two of the following: ICC, within-cluster variance, or between-cluster variance; significance level, progress updates, and simulated data set output may also be specified.

Value

A list with the following components:

If nofit = T, a data frame of the simulated data sets, containing:

Author(s)

Alexandria C. Sakrejda (acbro0@umass.edu)

Alexander R. Bogdan

Ken Kleinman (ken.kleinman@gmail.com)

Examples

1
2
3
4
5
6
7
8
## Not run: 
irgtt.normal.sim <- cps.irgtt.normal(nsim = 100, nsubjects = c(100, 10), 
                       nclusters = 8, mu = 1.1, mu2 = 1.5,
                        sigma_sq = 0.1, sigma_sq2 = 0.2, 
                        sigma_b_sq2 = 0.1, alpha = 0.05,
                        quiet = FALSE, allSimData = TRUE, seed = 123)

## End(Not run)

clusterPower documentation built on Jan. 29, 2021, 1:06 a.m.