-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Degree of Freedom is different between rstatix and afex packages #21
Comments
There is no difference between rstatix and afex in computing the repeated measures ANOVA. However, I agree with you that there is a small difference between the two packages when printing the results. Let's clarify that... As you know, one of the assumption of the repeated measure ANOVA is the assumption of sphericity: the variance of the differences between groups should be equal. This can be checked using the Mauchly’s test of sphericity, which is automatically reported when using the R function As you can see in the rstatix output, the Mauchly's Test for Sphericity is not significant (p = 0.09), so we can assume the sphericity and there is no need to apply corrections to the degrees of freedom. $`Mauchly's Test for Sphericity` Effect W p p<.05 1 time 0.551 0.092 Note also that, the Sphericity corrections results are available in the rstatix output and should be considered in case we could not maintain the sphericity assumption. Two common corrections used in the literature are provided: Greenhouse-Geisser epsilon (GGe), and Huynh-Feldt epsilon (HFe) and their corresponding p-values. You cand see that the df for GG correction is $`Sphericity Corrections` Effect GGe DF[GG] p[GG] p[GG]<.05 HFe DF[HF] p[HF] p[HF]<.05 1 time 0.69 1.38, 12.42 2.16e-06 * 0.774 1.55, 13.94 6.03e-07 * The default behaviour of the afex package is to systematically apply the GG correction when printing the repeated measures ANOVA output no mather whether the Mauchly's test is significant or not. In rstatix, the correction is automatically applied only when the sphericity can't be assumed. We follow the same philosophy as the popular commercial software SPSS by printing detailed results. If users want to force the sphericity correction in the rstatix package, they can go as follow: library(rstatix)
# Data preparation
data(selfesteem, package = "datarium")
df <- selfesteem %>%
tidyr::gather(key = "time", value = "score", -id) %>%
rstatix::convert_as_factor(id, time)
# Anova results from `rstatix` package:
res.aov1 <- rstatix::anova_test(data = df, dv = score, wid = id, within = time)
# Display ANOVA table with GG correction, default is "auto
get_anova_table(res.aov1, correction = "GG") ANOVA Table (type III tests) Effect DFn DFd F p p<.05 ges 1 time 1.38 12.4 55.5 2.16e-06 * 0.829 # Print test abel
rstatix::get_test_label(
res.aov1, correction = "GG",
description = NULL, detailed = TRUE, type = "text"
) [1] "F(1.38,12.42) = 55.47, p = <0.0001, eta2[g] = 0.829" |
Your explanation is tremendously instrumental, @kassambara! I really appreciate your help! Now everything is very clear. This could be another question; however, would there be any way to print the results with text formattings (e.g., italics and bold)? Currently, I hope that I can use |
I have found that
df
(Degree of Freedom) reported byrstatix
package is different from what is returned byafex
package.For example, you could see the difference in the following.
F(2, 18)
inrstatix
package;F(1.38, 12.42)
inafex
package.Would you mind addressing this issue using the reproducible code below?:
Created on 2019-12-27 by the reprex package (v0.3.0.9001)
Session info
The text was updated successfully, but these errors were encountered: