easystats / report

:scroll: :tada: Automated reporting of objects in R
https://easystats.github.io/report/
Other
693 stars 70 forks source link

report() not outputting denominator degrees of freedom #453

Open RenyBB opened 2 months ago

RenyBB commented 2 months ago

For example, the following code...

m<- lmerTest::lmer(mpg ~ wt+ (1| gear), data=mtcars) 
report(anova(m)) 

... provides a written summary that is missing the denominator degrees of freedom:

" The ANOVA suggests that:The main effect of wt is statistically significant and large (F(1) = 62.20, p < .001; Eta2 (partial) = 0.74, 95% CI [0.56, 1.00]) "

DominiqueMakowski commented 2 months ago
m<- lmerTest::lmer(mpg ~ wt+ (1| gear), data=mtcars) 
parameters::parameters(anova(m)) 
#> Parameter | Sum_Squares | df | Mean_Square |     F |      p
#> -----------------------------------------------------------
#> wt        |      526.21 |  1 |      526.21 | 62.20 | < .001
#> 
#> Anova Table (Type 3 tests)

Created on 2024-07-09 with reprex v2.0.2

I reckon that's because parameters() doesn't return one by default (@mattansb expert of anovas)

strengejacke commented 2 months ago

We've only tested for lme4, which doesn't include the denominator df. Package lmerTest, however, does. This should be fixed in parameters now (https://github.com/easystats/parameters/pull/988).

report still needs to be fixed, though.

m <- lmerTest::lmer(mpg ~ wt + (1 | gear), data = mtcars)

parameters::parameters(anova(m))
#> Parameter | Sum_Squares | df | df (error) | Mean_Square |     F |      p
#> ------------------------------------------------------------------------
#> wt        |      526.21 |  1 |      21.92 |      526.21 | 62.20 | < .001
#> 
#> Anova Table (Type 3 tests)

report::report(anova(m))
#> The ANOVA suggests that:
#> 
#>   - The main effect of wt is statistically significant and large (F(1) = 62.20, p
#> < .001; Eta2 (partial) = 0.74, 95% CI [0.56, 1.00])
#> 
#> Effect sizes were labelled following Field's (2013) recommendations.

Created on 2024-07-09 with reprex v2.1.1

DominiqueMakowski commented 2 months ago

@RenyBB also note that in-general, dfs for mixed models are a tricky business (https://github.com/easystats/parameters/issues/989)