Skip to content
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

Conflicting results in anova_test() for formula and argument input for two-way and higher order designs #40

Closed
benediktclaus opened this issue May 5, 2020 · 1 comment

Comments

@benediktclaus
Copy link

@benediktclaus benediktclaus commented May 5, 2020

When conducting a between-subjects ANOVA with two or more factors using anova_test(), the results depend on how the model was defined (as formula vs. as function arguments). As checked with JASP and SPSS, the results are only correct, if the model is defined via function arguments. The formula call gives wrong results.

library(tidyverse)
library(rstatix)
#> 
#> Attache Paket: 'rstatix'
#> The following object is masked from 'package:stats':
#> 
#>     filter
library(datarium)

satisfaction <- datarium::jobsatisfaction

satisfaction %>% 
  anova_test(score ~ gender*education_level, type = 3)
#> Coefficient covariances computed by hccm()
#> ANOVA Table (type III tests)
#> 
#>                   Effect DFn DFd       F        p p<.05   ges
#> 1                 gender   1  52   1.547 2.19e-01       0.029
#> 2        education_level   2  52 132.432 3.92e-21     * 0.836
#> 3 gender:education_level   2  52   7.338 2.00e-03     * 0.220

satisfaction %>% 
  anova_test(dv = score, between = c(gender, education_level), type = 3)
#> Coefficient covariances computed by hccm()
#> ANOVA Table (type III tests)
#> 
#>                   Effect DFn DFd       F        p p<.05   ges
#> 1                 gender   1  52   0.586 4.48e-01       0.011
#> 2        education_level   2  52 189.172 1.37e-24     * 0.879
#> 3 gender:education_level   2  52   7.338 2.00e-03     * 0.220

Created on 2020-05-05 by the reprex package (v0.3.0)

kassambara added a commit that referenced this issue May 5, 2020
Changing R default contrast setting into orthogonal contrasts #40
@kassambara
Copy link
Owner

@kassambara kassambara commented May 5, 2020

fixed now, thank you for pointing this out

@kassambara kassambara closed this May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.