Learn R Programming

WRS2 (version 0.3-1)

tsplit: A robust two-way mixed ANOVA for trimmed means.

Description

The tsplit function computes a two-way between-within subjects ANOVA on the trimmed means. It allows for one between subjects-variable and for one within-subjects variable. The functions sppba, sppbb, and sppbi compute the main fixed effect, the main within-subjects effect, and the interaction effect only, respectively, using bootstrap. For these 3 functions the user can choose whether the groups should be compared based on MOMs, medians, or M-estimators.

Usage

tsplit(formula, random, data, tr = 0.2)
sppba(formula, random, data, est = "mom", avg = TRUE, nboot = 500, MDIS = FALSE)
sppbb(formula, random, data, est = "mom", nboot = 500)
sppbi(formula, random, data, est = "mom", nboot = 500)

Arguments

formula
an object of class formula.
random
within subject specification (random effects style)
data
an optional data frame for the input data.
tr
trim level for the mean.
est
Estimate to be used for the group comparisons: either "onestep" for one-step M-estimator of location using Huber's Psi, "mom" for the modified one-step (MOM) estimator of location based on Huber's Psi, or "median".
avg
If TRUE, the analysis is done by averaging K measures of location for each level of the fixed effect , and then comparing averages by testing the hypothesis that all pairwise differences are equal to zero. If FALSE the analysis i
nboot
number of bootstrap samples.
MDIS
if TRUE the depths of the points in the bootstrap cloud are based on Mahalanobis distance, if FALSE a projection distance is used.

Value

  • tsplit returns an object of class "t2way" containing:
  • Qafirst main effect
  • A.p.valuep-value first main effect
  • Qbsecond main effect
  • B.p.valuep-value second main effect
  • Qabinteraction effect
  • AB.p.valuep-value interaction effect
  • callfunction call
  • varnamesvariable names
  • sppba, sppbb, and sppbi returns an object of class "spp" containing:
  • testvalue of the test statistic
  • p.valuep-value

Details

For sppbb the analysis is done based on all pairs of difference scores. The null hypothesis is that all such differences have a typical value of zero. Note that in the formula interface it is required to provide the fixed (between-group) effect. The random component (within subjects effect) goes into the random argument. sppbi performs a percentile bootstrap for interactions in a mixed design. The analysis is done by taking difference scores among all pairs of dependent groups and seeing whether these differences differ across levels of the between groups effect. Note that for all functions the full model needs to be specified.

References

Wilcox, R. (2012). Introduction to Robust Estimation and Hypothesis Testing (3rd ed.). Elsevier.

See Also

t2way

Examples

Run this code
## data need to be on long format
pictureLong <- reshape(picture, direction = "long", varying = list(3:4), idvar = "case", 
timevar = c("pictype"), times = c("couple", "alone"))
colnames(pictureLong)[4] <- "friend_requests"

## 2-way within-between subjects ANOVA
tsplit(friend_requests ~ relationship_status*pictype, random = ~1|case/pictype, data = pictureLong)

## between groups effect only (MOM estimator)
sppba(friend_requests ~ relationship_status*pictype, random = ~1|case/pictype, data = pictureLong)

## within groups effect only (MOM estimator)
sppbb(friend_requests ~ relationship_status*pictype, random = ~1|case/pictype, data = pictureLong)

## interaction effect only (MOM estimator)
sppbi(friend_requests ~ relationship_status*pictype, random = ~1|case/pictype, data = pictureLong)

Run the code above in your browser using DataLab