ICTpower | R Documentation |
ICTpower - get simulated power for an ICT design using parametric or non-parametric bootstrap.
ICTpower(
outFile = NULL,
design = NULL,
interactions = NULL,
B = 100,
dataFile = NULL,
sampleSizes = NULL,
alpha = 0.05,
seed = 123,
cores = parallel::detectCores() - 1,
savePowerReport = TRUE,
standardize = list(dv = FALSE, ivs = FALSE, byids = FALSE),
userFormula = list(fixed = NULL, random = NULL, formula = NULL),
prompt = TRUE,
y0atyMean = TRUE,
...
)
outFile |
The file name for saving power analysis results.
It may be a full path. The simulated data are to be saved by including the
file extension in a list. For example,
|
design |
An |
interactions |
A list of pairs of variables for which two-way interactions
should be estimated. Variables that can be included in this list are |
B |
The number of simulated dataset (or parametric bootstrap replications). |
dataFile |
Character. A file name for exntant data. Use this option to
do a non-parametric bootstrap (e.g., for finite sample power).
If |
sampleSizes |
Numeric vector of the same length as the number of groups
in the data. The group specific sample sizes to be drawn |
alpha |
Numeric. Default is .05. The Type I error rate for computing
empirical power (i.e., the proportion of p-values across |
seed |
A random seed for replicating the power analysis. |
cores |
The number of cores used in parralelized simulation (for a
parametric bootstrap) and for fitting models to the data for both bootstrap
types (see |
savePowerReport |
Should the power report be saved using the
|
standardize |
Named list of length 3. Default is
|
userFormula |
List of equations, see |
prompt |
Logical. Default is |
y0atyMean |
Logical. Default is |
... |
Further arguments to be passed to |
Stephen Tueller stueller@rti.org
## Not run:
example(polyICT)
myPolyICT$inputMat
# parametric examples with safe cloning using deep=TRUE
myPolyICT2 <- myPolyICT$clone(deep=TRUE)
myPolyICT2$inputMat$n <- c(20,20)
testICTpower20 <- ICTpower(c('testICTpower_n20_20', 'csv'),
myPolyICT2, B=3, seed = 25, prompt=FALSE)
myPolyICT3 <- myPolyICT$clone(deep=TRUE)
myPolyICT3$inputMat$nObs <- c(15, 60, 20)
testICTpower20t100 <- ICTpower(c('testICTpower_nObs15_60_20', 'csv'),
myPolyICT3, B=3, seed = 26, prompt = FALSE)
# non-parametric bootstrap examples
# create a population with 500 participants per group
myPolyICTnonPar <- myPolyICT$clone(deep=TRUE)
myPolyICTnonPar$inputMat$n <- c(500, 500)
Data <- myPolyICTnonPar$makeData()
save(Data, file = "Data.RData")
# non parametric bootstrap samlpes of 25 participants each group
ICTpower(outFile = c("npbsTest", "csv") ,
B = 3 ,
dataFile = "Data.RData" ,
sampleSizes = c(25,25) ,
prompt = FALSE )
# with a finite power correction passing `fpc`
ICTpower(outFile = c("npbsFPCtest", "csv") ,
B = 3 ,
dataFile = "Data.RData" ,
sampleSizes = c(25,25) ,
fpc = length(table(Data$id)) ,
prompt = FALSE )
# piecewise growth model example
ICTpower(outFile = c("piecewise", "csv"),
B = 3 ,
dataFile = "Data.RData" ,
sampleSizes = c(25,25) ,
alignPhase = 'piecewise' ,
prompt = FALSE )
# Timing run for B=1000
start_time <- Sys.time()
myPolyICT2 <- myPolyICT$clone(deep=TRUE)
myPolyICT2$update(groups=c(group1=20, group2=20))
testICTpower20 <- ICTpower(c('testICTpower20_B1000', 'csv'),
myPolyICT2, B=1000, seed = 25, prompt=FALSE)
end_time <- Sys.time()
end_time - start_time
# clean up - only run if you want to deletet all txt, csv, and RData files in
# the current working directory
#toDelete <- dir(getwd())
#toDelete <- toDelete[grepl(".txt|.csv|.RData", toDelete)]
#file.remove( toDelete )
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.