-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Allow extra argument type=1, 2 or 3 for eta_squared function & change default to type=2 #526
Comments
This is definitely something I want to implement - I would have to see how to consistently do this across model types. Thanks for the suggestion. |
This will require a re-write of a lot of code.
For each model class, the "type" argument would have to be checked against what is possible for that model, and which packages are available. For example:
@strengejacke I know some of this is available in |
You mean in terms of detecting the type? |
I think the type detection is fully implemented in parameters for ANOVA tables. For |
If it would be too much hassle to rework large parts of the function, maybe just a little note in the help could be good saying that if you would like effect sizes for Anova tables (of whatever fit supported by https://rdrr.io/cran/car/man/Anova.html, i.e. lm, glm, multinom, polr, coxph, coxme, svyglm, svycoxph, rlm, lmer or lme), effectsize::eta_squared(car::Anova(fit, type=3)) is probably what you want (provided you used sum/effect coding using afex::set_sum_contrasts() and that all continuous covariates were centered first using scale())? |
Well, we already have that:
|
Thanks - I only just noticed those bits now. I guess it comes down to it being a bit unfortunate that the R folks only implemented type I SSs in their default anova() method, which you then use for most models "For all other model, effect sizes are approximated via test statistic conversion of the omnibus F statistic provided by the appropriate anova() method". Whereas it's Anova(type="III") results one would typically like to see for any model. But as long as this caveat is pointed out somewhere & how the proper effect sizes using type III SSs can be obtained I'm fine with that... I just thought an extra argument type=1, 2 or 3 could make this a bit more explicit... (As this is also the way this is done in some other effect size packages) |
Coming back to this - perhaps we can give a "warning" when type 1 SSs are used (or when the type could not be detected). This will be (1) easier to code (🙃) but also (2) will not enforce any choice (2 vs 3) on our part on the user. |
Describe the solution you'd like
The current
eta_squared
function appears to return partial eta squared values based on type I SS. It is generally reckoned those are not very useful for factorial designs or models with interaction effects. It also leads to confusion, as the partial eta squared values of different packages have different defaults & options in this respect, sometimes using type I SS and sometimes type II or III, https://stats.stackexchange.com/questions/552451/which-r-functions-are-correct-for-estimating-partial-eta-squared-for-effects-in. At the very least an extra argumenttype=XX
would seem to be in order, as in theDescTools::EtaSq
function.How could we do it?
To get partial eta squared values using type I, II or III SS I figured that with the
effectsize::eta_squared
function one would have to doeffectsize::eta_squared(fit)
or equivalentlyeffectsize::eta_squared(anova(fit)) # using type I tests
effectsize::eta_squared(car::Anova(fit, type=2)) # using type II tests
effectsize::eta_squared(car::Anova(fit, type=3)) # using type III tests, requires using effect coding / sum contrasts, cf afex::set_sum_contrasts() and all continuous covariates need to be centered using scale()
It would be nice if these could be obtained using
effectsize::eta_squared(fit, type=1, 2 or 3)
The text was updated successfully, but these errors were encountered: