permu.test: Permutation tests for time series data, based on classic...

Description Usage Arguments Value See Also Examples

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 permutelm or permutelmer 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

1
2
3
4
5
6
7
8
9
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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')

permutes documentation built on Feb. 24, 2021, 5:08 p.m.