If pilot data is not available,
simr can be used to create
lme4 objects from scratch as a starting point. This requires more paramters to be specified by the user. Values for these parameters might come from the literature or the user's own knowledge and experience.
First set up some covariates with
x <- 1:10 g <- letters[1:3] X <- expand.grid(x=x, g=g)
Specify some fixed and random parameters.
b <- c(2, -0.1) # fixed intercept and slope V1 <- 0.5 # random intercept variance V2 <- matrix(c(0.5,0.05,0.05,0.1), 2) # random intercept and slope variance-covariance matrix s <- 1 # residual standard deviation
makeGlmer function to build an artificial
model1 <- makeLmer(y ~ x + (1|g), fixef=b, VarCorr=V1, sigma=s, data=X) print(model1) model2 <- makeGlmer(z ~ x + (x|g), family="poisson", fixef=b, VarCorr=V2, data=X) print(model2)
Now we have "pilot" models, which can be used with
powerSim(model1, nsim=20) powerSim(model2, nsim=20)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.