semPower.aPriori {semPower} | R Documentation |
semPower.aPriori
Description
Performs an a-priori power analysis, i. e., determines the required sample size given alpha, beta (or power: 1 - beta), df, and a measure of effect.
Usage
semPower.aPriori(
effect = NULL,
effect.measure = NULL,
alpha,
beta = NULL,
power = NULL,
N = NULL,
df = NULL,
p = NULL,
SigmaHat = NULL,
Sigma = NULL,
muHat = NULL,
mu = NULL,
fittingFunction = "ML",
simulatedPower = FALSE,
modelH0 = NULL,
modelH1 = NULL,
simOptions = NULL,
lavOptions = NULL,
lavOptionsH1 = lavOptions,
...
)
Arguments
effect |
effect size specifying the discrepancy between the null hypothesis (H0) and the alternative hypothesis (H1). A list for multiple group models; a vector of length 2 for effect-size differences. Can be |
effect.measure |
type of effect, one of |
alpha |
alpha error |
beta |
beta error; set either |
power |
power (= 1 - beta); set either |
N |
a list of sample weights for multiple group power analyses, e.g. |
df |
the model degrees of freedom. See |
p |
the number of observed variables, only required for |
SigmaHat |
can be used instead of |
Sigma |
can be used instead of |
muHat |
can be used instead of |
mu |
can be used instead of |
fittingFunction |
one of |
simulatedPower |
whether to perform a simulated ( |
modelH0 |
for simulated power: |
modelH1 |
for simulated power: |
simOptions |
a list of additional options specifying simulation details, see |
lavOptions |
a list of additional options passed to |
lavOptionsH1 |
alternative options passed to |
... |
other parameters related to plots, notably |
Value
Returns a list. Use summary()
to obtain formatted results.
See Also
semPower.postHoc()
semPower.compromise()
Examples
## Not run:
# determine the required sample size to reject a model showing misspecifications
# amounting to RMSEA >= .05 on 200 df with a power of 95 % on alpha = .05
ap <- semPower.aPriori(effect = .05, effect.measure = "RMSEA",
alpha = .05, beta = .05, df = 200)
summary(ap)
# use f0 as effect size metric
ap <- semPower.aPriori(effect = .15, effect.measure = "F0",
alpha = .05, power = .80, df = 200)
summary(ap)
# power analysis for to detect the difference between a model (with df = 200) exhibiting RMSEA = .05
# and a model (with df = 210) exhibiting RMSEA = .06.
ap <- semPower.aPriori(effect = c(.05, .06), effect.measure = "RMSEA",
alpha = .05, power = .80, df = c(200, 210))
summary(ap)
# power analysis based on SigmaHat and Sigma (nonsense example)
ap <- semPower.aPriori(alpha = .05, beta = .05, df = 5,
SigmaHat = diag(4), Sigma = cov(matrix(rnorm(4*1000), ncol=4)))
summary(ap)
# multiple group example
ap <- semPower.aPriori(effect = list(.05, .10), effect.measure = "F0",
alpha = .05, power = .80, df = 100,
N = list(1, 1))
summary(ap)
# simulated power analysis (nonsense example)
ap <- semPower.aPriori(alpha = .05, beta = .05, df = 200,
SigmaHat = list(diag(4), diag(4)),
Sigma = list(cov(matrix(rnorm(4*1000), ncol=4)),
cov(matrix(rnorm(4*1000), ncol=4))),
simulatedPower = TRUE, nReplications = 100)
summary(ap)
## End(Not run)