Description Usage Arguments Details Value Author(s) Examples
View source: R/cps.irgtt.normal.R
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.
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
)
|
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 |
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 At least 2 of the following must be specified: |
seed |
Option to set seed. Default is NA. |
poorFitOverride |
Option to override |
lowPowerOverride |
Option to override |
timelimitOverride |
Logical. When FALSE, stops execution if the estimated completion time is more than 2 minutes. Defaults to TRUE. |
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.
A list with the following components:
Character string indicating total number of simulations and simulation type
Number of simulations
Data frame with columns "Power" (Estimated statistical power), "lower.95.ci" (Lower 95 "upper.95.ci" (Upper 95
Analytic method used for power estimation
Significance level
Vector containing user-defined cluster sizes
Vector containing user-defined number of clusters in each treatment group
Data frame reporting ICC for Treatment/Non-Treatment groups
Vector containing expected group means based on user inputs
Data frame with columns: "Estimate" (Estimate of treatment effect for a given simulation), "Std.err" (Standard error for treatment effect estimate), "Test.statistic" (z-value (for GLMM) or Wald statistic (for GEE)), "p.value", "sig.val" (Is p-value less than alpha?)
If allSimData = TRUE
, a list of data frames, each containing:
"y" (Simulated response value),
"trt" (Indicator for treatment group),
"clust" (Indicator for cluster)
If nofit = T
, a data frame of the simulated data sets, containing:
"arm" (Indicator for treatment arm)
"cluster" (Indicator for cluster)
"y1" ... "yn" (Simulated response value for each of the nsim
data sets).
Alexandria C. Sakrejda (acbro0@umass.edu)
Alexander R. Bogdan
Ken Kleinman (ken.kleinman@gmail.com)
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.