R: A robust two-way mixed ANOVA using trimmed means.

bwtrim {WRS2} | R Documentation

## A robust two-way mixed ANOVA using trimmed means.

### Description

The `bwtrim` function computes a two-way between-within subjects ANOVA on the trimmed means. It allows for one between subjects variable and 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 an M-estimator for group comparisons.

### Usage

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

### Arguments

`formula` | an object of class formula.
`id` | subject ID.
`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 is done by testing whether K equalities are simultaneously true.
`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.

### Details

The `tsplit` function is doing exactly the same as `bwtrim`. It is kept in the package in order to be consistent with older versions of the Wilcox (2012) book.

For `sppba`, `sppbb`, and `sppbi` 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. In the formula interface it is required to provide full model.

### Value

`bwtrim` returns an object of class `"t2way"` containing:

`Qa` | first main effect
`A.p.value` | p-value first main effect
`Qb` | second main effect
`B.p.value` | p-value second main effect
`Qab` | interaction effect
`AB.p.value` | p-value interaction effect
`call` | function call
`varnames` | variable names

`sppba`, `sppbb`, and `sppbi` returns an object of class `"spp"` containing:

`test` | value of the test statistic
`p.value` | p-value

### References

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

### See Also

`t2way`

### Examples

    ## 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
    bwtrim(friend_requests ~ relationship_status*pictype, id = case, data = pictureLong)

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

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

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

[Package WRS2 version 0.9-2 Index]