-
-
Notifications
You must be signed in to change notification settings - Fork 40
Description
Problem
In afex::aov_4() you can use anova_table = list(p_adjust_method = "bonferroni") to adjust p-values in the ANOVA table (obviously you can chose other methods to Bonferroni). However, if you pass the afex model to model_parameters() it reverts to the unadjusted p-values.
goggles_tib <- discovr::goggles
goggles_afx <- afex::aov_4(attractiveness ~ facetype*alcohol + (1|id), data = goggles_tib, anova_table = list(p_adjust_method = "bonferroni"))
#> Contrasts set to contr.sum for the following variables: facetype, alcohol
goggles_afx
#> Anova Table (Type 3 tests, bonferroni-adjusted)
#>
#> Response: attractiveness
#> Effect df MSE F ges p.value
#> 1 facetype 1, 42 1.37 15.58 *** .271 <.001
#> 2 alcohol 2, 42 1.37 6.04 * .223 .015
#> 3 facetype:alcohol 2, 42 1.37 8.51 ** .288 .002
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
parameters::model_parameters(goggles_afx, es_type = "omega", ci = 0.95)
#> ANOVA estimation for factorial designs using 'afex'
#>
#> Parameter | Sum_Squares | df | Mean_Square | F | p
#> --------------------------------------------------------------------
#> (Intercept) | 1541.33 | 1 | 1541.33 | 1125.84 | < .001
#> facetype | 21.33 | 1 | 21.33 | 15.58 | < .001
#> alcohol | 16.54 | 2 | 8.27 | 6.04 | 0.005
#> facetype:alcohol | 23.29 | 2 | 11.65 | 8.51 | < .001
#> Residuals | 57.50 | 42 | 1.37 | |
#>
#> Parameter | Omega2 (partial) | Omega2 95% CI
#> ---------------------------------------------------
#> (Intercept) | |
#> facetype | 0.23 | [0.07, 1.00]
#> alcohol | 0.17 | [0.02, 1.00]
#> facetype:alcohol | 0.24 | [0.06, 1.00]
#> Residuals | |
#>
#> Anova Table (Type 3 tests)Created on 2025-05-07 with reprex v2.1.1
Suggestion
I think ideally, the user should able to use p_adjust within model_parameters() like you can for lm models; that way, the workflow is consistent with model_parameters() being used to extract and augment (for example with effect sizes) information from models. Also the syntax is nicer than anova_table = list(p_adjust_method = "bonferroni"). If that's not possible, then retain p-values from afex to avoid the user thinking they have corrected when in fact they haven't.