| bwtrim {WRS2} | R Documentation |
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.
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)
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 |
avg |
If |
nboot |
number of bootstrap samples. |
MDIS |
if |
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.
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 |
Wilcox, R. (2012). Introduction to Robust Estimation and Hypothesis Testing (3rd ed.). Elsevier.
## 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)