Learn R Programming

WRS2 (version 0.3-1)

t2way: A two-way ANOVA for trimmed means, M-estimators, and medians.

Description

The t2way function computes a two-way ANOVA for trimmed means with interactions effects. Corresponding post hoc tests are mcp2atm. pbad2way performs a two-way ANOVA using M-estimators for location with mcp2a for post hoc tests.

Usage

t2way(formula, data, tr = 0.2)
pbad2way(formula, data, est = "mom", nboot = 599)
mcp2atm(formula, data, tr = 0.2)
mcp2a(formula, data, est = "mom", nboot = 599)

Arguments

formula
an object of class formula.
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".
nboot
number of bootstrap samples.

Value

  • The functions t2way and pbad2way return 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
  • The functions mcp2atm and mcp2a return an object of class mcp containing:
  • effectslist with post hoc comparisons for all effects
  • contrastsdesign matrix

Details

pbad2way returns p-values only.

References

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

See Also

t1way, med1way

Examples

Run this code
## 2-way ANOVA on trimmed means
t2way(attractiveness ~ gender*alcohol, data = goggles)

## post hoc tests
mcp2atm(attractiveness ~ gender*alcohol, data = goggles)

## 2-way ANOVA on MOM estimator
pbad2way(attractiveness ~ gender*alcohol, data = goggles)

## post hoc tests
mcp2a(attractiveness ~ gender*alcohol, data = goggles)

## 2-way ANOVA on medians
pbad2way(attractiveness ~ gender*alcohol, data = goggles, est = "median")

## post hoc tests
mcp2a(attractiveness ~ gender*alcohol, data = goggles, est = "median")

## extract design matrix
model.matrix(mcp2a(attractiveness ~ gender*alcohol, data = goggles, est = "median"))

Run the code above in your browser using DataLab