4 Traditional ANOVA
In this section, traditional RM-ANOVA is performed for a brief comparison with latent RM-ANOVA. For this analysis, the two indicators are averaged for each subject within each of the experimental conditions as RM-ANOVA can only deal with manifest variables. The car
package is used for this analysis.
First of all, a new dataset is needed containing the averaged indicators. This is being done using the tidyverse
collection. In the next chunk, the long format dataset is only an auxiliary dataset as averaging more convenient with long data.
if (!require("car", character.only = T)) {
install.packages("car")
}
library(car)
library(tidyverse)
d_long <- d_wide %>%
gather(condition, value, -ID) %>%
mutate(item = substr(condition, 1, 2),
condition = substr(condition, 3, 4))
d_mean_wide <- d_long %>%
group_by(ID, condition) %>%
summarise(value = mean(value)) %>%
spread(condition, value)
d_mean_wide
## # A tibble: 26 x 5
## # Groups: ID [26]
## ID NN NP PN PP
## <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 -0.927 0.177 -0.927 0.913
## 2 2 -1.96 1.25 -0.0588 0.659
## 3 3 -0.331 0.238 -1.40 0.449
## 4 4 1.56 1.28 0.870 -1.05
## 5 5 0.314 0.120 -0.269 -0.269
## 6 6 0.463 0.463 0.286 0.463
## 7 7 -1.07 0.443 -0.679 0.883
## 8 8 0.825 0.825 -0.136 -0.232
## 9 9 -0.112 0.765 0.00506 1.67
## 10 10 0.0236 1.10 0.753 0.676
## # … with 16 more rows
The idata and the idesign objects are just the same as for latent RM-ANOVA.
## Peer Human
## 1 negative negative
## 2 positive negative
## 3 negative positive
## 4 positive positive
## ~Peer * Human
Now, let’s run the analysis using the Anova
function. Note that the variables in the formula now are actual variables from the dataset (average scores).
anova_model <- lm(cbind(NN, PN, NP, PP) ~ 1, d_mean_wide)
anova_fit <- Anova(anova_model,
idata = idata,
idesign = idesign,
type = "III")
summary(anova_fit)
##
## Type III Repeated Measures MANOVA Tests:
##
## ------------------------------------------
##
## Term: (Intercept)
##
## Response transformation matrix:
## (Intercept)
## NN 1
## PN 1
## NP 1
## PP 1
##
## Sum of squares and products for the hypothesis:
## (Intercept)
## (Intercept) 2.234811
##
## Multivariate Tests: (Intercept)
## Df test stat approx F num Df den Df Pr(>F)
## Pillai 1 0.0233974 0.5989488 1 25 0.44624
## Wilks 1 0.9766026 0.5989488 1 25 0.44624
## Hotelling-Lawley 1 0.0239580 0.5989488 1 25 0.44624
## Roy 1 0.0239580 0.5989488 1 25 0.44624
##
## ------------------------------------------
##
## Term: Peer
##
## Response transformation matrix:
## Peer1
## NN 1
## PN -1
## NP 1
## PP -1
##
## Sum of squares and products for the hypothesis:
## Peer1
## Peer1 0.1304386
##
## Multivariate Tests: Peer
## Df test stat approx F num Df den Df Pr(>F)
## Pillai 1 0.0047895 0.1203125 1 25 0.7316
## Wilks 1 0.9952105 0.1203125 1 25 0.7316
## Hotelling-Lawley 1 0.0048125 0.1203125 1 25 0.7316
## Roy 1 0.0048125 0.1203125 1 25 0.7316
##
## ------------------------------------------
##
## Term: Human
##
## Response transformation matrix:
## Human1
## NN 1
## PN 1
## NP -1
## PP -1
##
## Sum of squares and products for the hypothesis:
## Human1
## Human1 50.63608
##
## Multivariate Tests: Human
## Df test stat approx F num Df den Df Pr(>F)
## Pillai 1 0.4442502 19.98427 1 25 0.00014706 ***
## Wilks 1 0.5557498 19.98427 1 25 0.00014706 ***
## Hotelling-Lawley 1 0.7993709 19.98427 1 25 0.00014706 ***
## Roy 1 0.7993709 19.98427 1 25 0.00014706 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## ------------------------------------------
##
## Term: Peer:Human
##
## Response transformation matrix:
## Peer1:Human1
## NN 1
## PN -1
## NP -1
## PP 1
##
## Sum of squares and products for the hypothesis:
## Peer1:Human1
## Peer1:Human1 0.02058027
##
## Multivariate Tests: Peer:Human
## Df test stat approx F num Df den Df Pr(>F)
## Pillai 1 0.0009096 0.02276124 1 25 0.88129
## Wilks 1 0.9990904 0.02276124 1 25 0.88129
## Hotelling-Lawley 1 0.0009104 0.02276124 1 25 0.88129
## Roy 1 0.0009104 0.02276124 1 25 0.88129
##
## Univariate Type III Repeated-Measures ANOVA Assuming Sphericity
##
## Sum Sq num Df Error SS den Df F value Pr(>F)
## (Intercept) 0.5587 1 23.3201 25 0.5989 0.4462367
## Peer 0.0326 1 6.7760 25 0.1203 0.7315986
## Human 12.6590 1 15.8362 25 19.9843 0.0001471 ***
## Peer:Human 0.0051 1 5.6511 25 0.0228 0.8812904
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1