Learn R Programming

MANOVA.RM (version 0.3.2)

RM: Tests for Repeated Measures in Semi-Parametric Factorial Designs

Description

The RM() function calculates the Wald-type statistic (WTS), the ANOVA-type statistic (ATS) as well as resampling versions of these test statistics for semi-parametric repeated measures designs.

Usage

RM(formula, data, subject, no.subf = 1, iter = 10000, alpha = 0.05,
  resampling = "Perm", CPU, seed, CI.method = "t-quantile", dec = 3)

Arguments

formula

A model formula object. The left hand side contains the response variable and the right hand side contains the factor variables of interest. An interaction term must be specified. The time variable must be the last factor in the formula.

data

A data.frame, list or environment containing the variables in formula. Data must be in long format and must not contain missing values.

subject

The column name of the subjects in the data.

no.subf

The number of sub-plot factors in the data, default is 1.

iter

The number of iterations used for calculating the resampled statistic. The default option is 10,000.

alpha

A number specifying the significance level; the default is 0.05.

resampling

The resampling method to be used, one of "Perm" (randomly permute all observations), "paramBS" (parametric bootstrap approach) and "WildBS" (wild bootstrap approach with Rademacher weights). Except for the Wild Bootstrap, all methods are applied to the WTS only.

CPU

The number of cores used for parallel computing. If omitted, cores are detected via detectCores.

seed

A random seed for the resampling procedure. If omitted, no reproducible seed is set.

CI.method

The method for calculating the quantiles used for the confidence intervals, either "t-quantile" (the default) or "resampling" (the quantile of the resampled WTS).

dec

Number of decimals the results should be rounded to. Default is 3.

Value

An RM object containing the following components:

Descriptive

Some descriptive statistics of the data for all factor level combinations. Displayed are the number of individuals per factor level combination, the mean and 100*(1-alpha)% confidence intervals (based on t-quantiles).

Covariance

The estimated covariance matrix.

WTS

The value of the WTS along with degrees of freedom of the central chi-square distribution and corresponding p-value.

ATS

The value of the ATS, degrees of freedom of the central F distribution and the corresponding p-value.

resampling

p-values for the test statistics based on the chosen resampling approach.

Details

The RM() function provides the Wald-type statistic as well as the ANOVA-type statistic for repeated measures designs with metric data as described in Friedrich et al. (2017). These are even applicable for non-normal error terms and/or heteroscedastic variances. It is implemented for designs with an arbitrary number of between-subject (whole-plot) and within-subject (sub-plot) factors and allows for different sample sizes. In addition to the asymptotic p-values, it also provides p-values based on resampling approaches. NOTE: The number of within-subject factors needs to be specified in the function call. If only one factor is present, it is assumed that this is a within-subjects factor (e.g. time).

References

Friedrich, S., Brunner, E. and Pauly, M. (2017). Permuting longitudinal data in spite of the dependencies. Journal of Multivariate Analysis, 153, 255-265.

Bathke, A., Friedrich, S., Konietschke, F., Pauly, M., Staffen, W., Strobl, N. and Hoeller, Y. (2018). Testing Mean Differences among Groups: Multivariate and Repeated Measures Analysis with Minimal Assumptions. Multivariate Behavioral Research, 53(3), 348-359, Doi: 10.1080/00273171.2018.1446320.

Friedrich, S., Konietschke, F., Pauly, M. (2017). GFD - An R-package for the Analysis of General Factorial Designs. Journal of Statistical Software, 79(1), 1-18.

See Also

GFD, nparLD, MANOVA

Examples

Run this code
# NOT RUN {
data(o2cons)
# }
# NOT RUN {
oxy <- RM(O2 ~ Group * Staphylococci * Time, data = o2cons, 
            subject = "Subject", no.subf = 2, iter = 1000, resampling = "Perm", CPU = 1)
summary(oxy)
plot(oxy, factor = "Group") 
 
# For more details including the output of the examples also refer to the 
# package vignette.

# using the EEG data, consider additional within-subjects factors 'brain region' 
# and 'feature'
data(EEG)
EEG_model <- RM(resp ~ sex * diagnosis * feature * region, 
               data = EEG, subject = "id", no.subf = 2, resampling = "WildBS",
               iter = 1000,  alpha = 0.01, CPU = 4, seed = 987, dec = 2)
summary(EEG_model)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab