perm.lm: A general permutation test for mixed-effects models or other...

perm.lmR Documentation

A general permutation test for mixed-effects models or other buildmer models. This is an alias for perm.lmer, except that random effects are explicily disallowed.

Description

A general permutation test for mixed-effects models or other buildmer models. This is an alias for perm.lmer, except that random effects are explicily disallowed.

Usage

perm.lm(
  formula,
  data = NULL,
  family = gaussian(),
  weights = NULL,
  offset = NULL,
  buildmerControl = list(direction = "order", crit = "LRT", quiet = TRUE, ddf = "lme4"),
  nperm = 1000,
  type = "regression",
  progress = TRUE
)

Arguments

formula

A normal formula, possibly using lme4-style random effects. This can also be a buildmer terms object, provided dep is passed in buildmerControl. Only a single response variable is supported. For binomial models, the cbind syntax is not supported; please convert your dependent variable to a proportion and use weights instead.

data

The data.

family

The family.

weights

An optional vector of prior case weights. This vector is evaluated in the calling environment, not in the formula or data frame!

offset

An optional vector containing a prior offset term. This vector is evaluated in the calling environment, not in the formula or data frame!

buildmerControl

Options overriding the defaults in buildmerControl.

nperm

The number of permutations.

type

A character string of either 'anova' or 'regression'. The former runs an analysis of variance and returns F-values and p-values based on the explained variance of each factor in the design. The latter runs a linear-regression analysis and returns t-values and p-values based on individual effects. When running ANOVA, it is advised to use orthogonal predictors, as type III sums of squares are used.

progress

Logical indicating whether to print progress messages during the permutation testing.

Details

If not explicitly overridden in the buildmerControl argument, the function changes a few buildmer defaults to make more sense for permutation testing. This includes setting direction='order' and quiet=TRUE. Set these options explicitly to override this behavior. Because model comparisons are used for efficient permutation testing, REML is not supported. Omega squared is not available for mixed-effects ANOVA; the w2 column will not be included in the resulting permutes object. The returned object provides the raw bootstrap samples in the pb attribute. These are used to compute a corrected p-value using Maris & Oostenveld's (2007) cluster mass statistic, but can also be used by the user to compute other such statistics. These obviously significantly increase the size of the R object; if this becomes a problem, there is no harm in deleting them using e.g. attr(x,'perms') <- NULL.

Value

A data frame.

Examples


# Testing a single EEG electrode, with random effects by participants
perms <- perm.lm(Fz ~ Deviant * Session,data=MMN[MMN$Time > 150 & MMN$Time < 250,])
# Testing a single EEG electrode, with random effects by participants, ANOVA inference
perms <- perm.lm(Fz ~ Deviant * Session,data=MMN[MMN$Time > 150 & MMN$Time < 250,],type='anova')



permutes documentation built on Sept. 28, 2023, 5:07 p.m.