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

ANOVA effect sizes for intercepts #576

Closed
mattansb opened this issue Aug 5, 2021 · 11 comments
Closed

ANOVA effect sizes for intercepts #576

mattansb opened this issue Aug 5, 2021 · 11 comments
Labels
Consistency 🍏 🍎 Expected output across functions could be more similar What's your opinion 🙉 Collectively discuss something

Comments

@mattansb
Copy link
Member

mattansb commented Aug 5, 2021

library(easystats)
#> # Attaching packages: easystats 0.4.2
#> v insight     0.14.2.1     v datawizard  0.1.0.9000
#> v bayestestR  0.10.5       v performance 0.7.3.1   
#> v parameters  0.14.0.1     v effectsize  0.4.5.1   
#> v modelbased  0.8.0        v correlation 0.7.0     
#> v see         0.6.4        v report      0.3.5

m <- lm(mpg ~ factor(am) * factor(cyl), mtcars)
a <- car::Anova(m, type = 3)

eta_squared(a)
#> Type 3 ANOVAs only give sensible and informative results when covariates are
#>   mean-centered and factors are coded with orthogonal contrasts (such as those
#>   produced by 'contr.sum', 'contr.poly', or 'contr.helmert', but *not* by the
#>   default 'contr.treatment').
#> # Effect Size for ANOVA (Type III)
#> 
#> Parameter              | Eta2 (partial) |       90% CI
#> ------------------------------------------------------
#> factor(am)             |           0.20 | [0.02, 0.41]
#> factor(cyl)            |           0.41 | [0.15, 0.58]
#> factor(am):factor(cyl) |           0.10 | [0.00, 0.27]

Missing effect size for the intercept

model_parameters(a, eta_squared = TRUE)
#> Type 3 ANOVAs only give sensible and informative results when covariates are
#>   mean-centered and factors are coded with orthogonal contrasts (such as those
#>   produced by 'contr.sum', 'contr.poly', or 'contr.helmert', but *not* by the
#>   default 'contr.treatment').
#> Type 3 ANOVAs only give sensible and informative results when covariates are
#>   mean-centered and factors are coded with orthogonal contrasts (such as those
#>   produced by 'contr.sum', 'contr.poly', or 'contr.helmert', but *not* by the
#>   default 'contr.treatment').
#> Parameter              | Sum_Squares | df | Mean_Square |      F |      p | Eta2 (partial)
#> ------------------------------------------------------------------------------------------
#> (Intercept)            |     1573.23 |  1 |     1573.23 | 171.10 | < .001 |               
#> factor(am)             |       58.43 |  1 |       58.43 |   6.35 | 0.018  |           0.20
#> factor(cyl)            |      167.71 |  2 |       83.85 |   9.12 | < .001 |           0.41
#> factor(am):factor(cyl) |       25.44 |  2 |       12.72 |   1.38 | 0.269  |           0.10
#> Residuals              |      239.06 | 26 |        9.19 |        |        |               
#> 
#> Anova Table (Type 3 tests)

But this can be added with:

eta_squared(a, include_intercept = TRUE)
#> Type 3 ANOVAs only give sensible and informative results when covariates are
#>   mean-centered and factors are coded with orthogonal contrasts (such as those
#>   produced by 'contr.sum', 'contr.poly', or 'contr.helmert', but *not* by the
#>   default 'contr.treatment').
#> # Effect Size for ANOVA (Type III)
#> 
#> Parameter              | Eta2 (partial) |       90% CI
#> ------------------------------------------------------
#> (Intercept)            |           0.87 | [0.78, 0.91]
#> factor(am)             |           0.20 | [0.02, 0.41]
#> factor(cyl)            |           0.41 | [0.15, 0.58]
#> factor(am):factor(cyl) |           0.10 | [0.00, 0.27]

Created on 2021-08-05 by the reprex package (v2.0.0)

@strengejacke
Copy link
Member

Why isn't it included in general?

@mattansb
Copy link
Member Author

mattansb commented Aug 8, 2021

I don't think an R^2-type effect size make sense for the intercept (which is only available for type-3 ANOVA tables). I'm not sure what the interpretation would even be... It was only added after the {papaja} folk requested it for their compatibility (easystats/effectsize#156 (comment)).

@bwiernik
Copy link
Contributor

bwiernik commented Aug 8, 2021

Yeah, agreed. Variance accounted for statistics index improvement over the intercept. I don't know exactly what Frederick was thinking about when he asked for that.

@strengejacke
Copy link
Member

I don't think an R^2-type effect size make sense for the intercept

Ok, so what should be the solution here? Include it by default, or do nothing?

@strengejacke strengejacke added Consistency 🍏 🍎 Expected output across functions could be more similar Question ❓ Further information is requested What's your opinion 🙉 Collectively discuss something and removed Question ❓ Further information is requested labels Aug 17, 2021
@mattansb
Copy link
Member Author

I think best to omit for the intercept.

@DominiqueMakowski
Copy link
Member

agreed

@strengejacke
Copy link
Member

ok, so what is the issue here? I'm not sure if I understand it correctly, but omitting the effect size for the intercept would give you the result you showed in your initial post?

@mattansb
Copy link
Member Author

The issue is that report isn't requesting the intercepts effect size, so it recycles though the effect sizes that are returned, thus (1) giving the intercept an effect size and (2) all other effect sizes are shifted by 1 (and the last one is recycled).

@strengejacke
Copy link
Member

Ah, got it. And what can we do in parameters to resolve this issue?

@mattansb
Copy link
Member Author

Nothing needs to be done in parameters - there the effect size is correctly marked as missing:

model_parameters(a, eta_squared = TRUE)
#> Parameter              | Sum_Squares | df | Mean_Square |      F |      p | Eta2 (partial)
#> ------------------------------------------------------------------------------------------
#> (Intercept)            |     1573.23 |  1 |     1573.23 | 171.10 | < .001 |               
#> factor(am)             |       58.43 |  1 |       58.43 |   6.35 | 0.018  |           0.20
#> factor(cyl)            |      167.71 |  2 |       83.85 |   9.12 | < .001 |           0.41
#> factor(am):factor(cyl) |       25.44 |  2 |       12.72 |   1.38 | 0.269  |           0.10
#> Residuals              |      239.06 | 26 |        9.19 |        |        |               
#> 
#> Anova Table (Type 3 tests)

@mattansb
Copy link
Member Author

Why did I open this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Consistency 🍏 🍎 Expected output across functions could be more similar What's your opinion 🙉 Collectively discuss something
Projects
None yet
Development

No branches or pull requests

4 participants