Learn R Programming

simr (version 1.0.0)

powerCurve: Estimate power at a range of sample sizes.

Description

This function runs powerSim over a range of sample sizes.

Usage

powerCurve(fit, test = fixed(getDefaultXname(fit)), sim = fit,
  along = getDefaultXname(fit), within, breaks, seed, fitOpts = list(),
  testOpts = list(), simOpts = list(), ...)

Arguments

fit
a fitted model object (see doFit).
test
specify the test to perform. By default, the first fixed effect in fit will be tested. (see: tests).
sim
an object to simulate from. By default this is the same as fit (see doSim).
along
the name of an explanatory variable. This variable will have its number of levels varied.
within
names of grouping variables, separated by "+" or ",". Each combination of groups will be extended to n rows.
breaks
number of levels of the variable specified by along at each point on the power curve.
seed
specify a random number generator seed, for reproducible results.
fitOpts
extra arguments for doFit.
testOpts
extra arguments for doTest.
simOpts
extra arguments for doSim.
...
any additional arguments are passed on to simrOptions. Common options include: [object Object],[object Object],[object Object]

Examples

Run this code
fm <- lmer(y ~ x + (1|g), data=simdata)
pc1 <- powerCurve(fm)
pc2 <- powerCurve(fm, breaks=c(4,6,8,10))
print(pc2)
plot(pc2)

Run the code above in your browser using DataLab