permu.test {permutes}R Documentation

Permutation tests for time series data, based on classic linear regression or ANOVA This is a legacy function that is primarily provided for backward compatibility. You should probably use perm.lm or perm.lmer instead. permu.test is the only function to support multivariate responses, although multivariate data can trivially be recoded into a univariate model. permu.test does not support random effects or corrected p-values (e.g. the cluster mass test), which are supported by permutelm.

Description

Permutation tests for time series data, based on classic linear regression or ANOVA This is a legacy function that is primarily provided for backward compatibility. You should probably use perm.lm or perm.lmer instead. permu.test is the only function to support multivariate responses, although multivariate data can trivially be recoded into a univariate model. permu.test does not support random effects or corrected p-values (e.g. the cluster mass test), which are supported by permutelm.

Usage

permu.test(
  formula,
  data,
  subset = NULL,
  type = "anova",
  parallel = FALSE,
  progress = "text",
  ...
)

Arguments

formula

A formula of the following form: outcome ~ predictors | series variable. Multivariate outcomes (e.g. 32 EEG electrodes) are supported; use cbind(Fp1,Fp2,etc) ~ predictors | series.

data

The dataset referencing these predictors.

subset

If specified, will only analyze the specified subset of the data.

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.

parallel

Whether to parallelize the permutation testing using plyr's parallel option. Needs some additional set-up; see the plyr documentation.

progress

A plyr .progress bar name, see the plyr documentation. Ignored if parallel=TRUE.

...

Other arguments to be passed to lmp/aovp

Value

A data frame.

See Also

clusterperm.lm, clusterperm.lmer

Examples


# EEG data example using the MMN dataset

# Run permutation tests on all electrodes and timepoints, reporting p-values for the three
# manipulated factors
perms <- permu.test(cbind(Fp1,AF3,F7,F3,FC1,FC5,C3,CP1,CP5,P7,P3,Pz,PO3,O1,Oz,O2,PO4,P4,
	P8,CP6,CP2,C4,FC6,FC2,F4,F8,AF4,Fp2,Fz,Cz) ~ Deviant * Session | Time,data=MMN)

# Run the tests in parallel on two CPU threads
# first, set up the parallel backend
library(doParallel)
cl <- makeCluster(2)
registerDoParallel(cl)
perms <- permu.test(cbind(Fp1,AF3,F7,F3,FC1,FC5,C3,CP1,CP5,P7,P3,Pz,PO3,O1,Oz,O2,PO4,P4,
	P8,CP6,CP2,C4,FC6,FC2,F4,F8,AF4,Fp2,Fz,Cz) ~ Deviant * Session | Time,data=MMN,
	parallel=TRUE)
stopCluster(cl)

# Plot the results by F-value, removing points that were not significant in the
# permutation tests
plot(perms,sig='p')

# t-values instead of F-values
perms <- permu.test(cbind(Fp1,AF3,F7,F3,FC1,FC5,C3,CP1,CP5,P7,P3,Pz,PO3,O1,Oz,O2,PO4,P4,
	P8,CP6,CP2,C4,FC6,FC2,F4,F8,AF4,Fp2,Fz,Cz) ~ Deviant * Session | Time,data=MMN,
	type='regression')



[Package permutes version 2.8 Index]