power analysis for linear mixed model

pamlmixed(
  aim = "n",
  find = "n",
  syntax = NULL,
  clusterpars = list(),
  categorical = list(),
  model_type = "linear",
  sigma2 = 1,
  power = 0.9,
  sig.level = 0.05,
  algo = "mc",
  mcR = 500,
  parallel = TRUE,
  set_seed = FALSE,
  seed = 42,
  run = TRUE,
  verbose = getOption("pamlj.messages"),
  ...
)

Arguments

aim

The aim of the analysis: n (default) sample size, power to estimate power

find

When aim='n', indicates whether to find number of clusters find='k' or number of cases within each cluster find='n' (default).

syntax

The model to be analysed with possible options

clusterpars

A named list of the form `list(cluster1=c(n=n1,k=k1))`, where `cluster1` is the name of the clustering variable in the model, `n1` is the expcted number of cases within each cluster, and `k1` is the expcted number of clusters. if aim=n, `n1` is used as starting point for sample size. If aim=clusters, `k1` is used as starting point for number of clusters.

categorical

A named list of the form `list(varname1=x1,varname2=x2)`, specifying which variable is categorical and the number of levels (x). Any variable in the model not mentioned in `categorical ` is assumed to be numeric.

model_type

The model type or family: `linear` (default) for linear mixed model, `logistic` for binomial logistic mixed model.

sigma2

Residual variance. Ignored for `model_type="logistic"`

power

Minimal desired power

sig.level

Type I error rate (significance cut-off or alpha)

algo

The algorithm to use: `mc` (default) for Monte Carlo simulation, `raw` for raw approximation based on Chi-squared (fast but not very accurate)

mcR

Number of repetitions for Monte Carlo method

parallel

Logical: should parallel computing be used for the Monte Carlo method

seed

the seed for Monte Carlo simulations, default=42.

run

TRUE (default) run the simulations, otherwise print out the model without results

verbose

(Boolean) `getOption("pamlj.messages")` (default). Print out updates of the simulation steps.

...

Used for internal purposes

Number

of repetitions for Monte Carlo method

Value

A results object containing:

results$introa html
results$extrainfoa html
results$issuesa html
results$initnotesa html
results$infotaba table
results$powertaba table
results$plotnotesa html

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$infotab$asDF

as.data.frame(results$infotab)