strengejacke / sjstats

Effect size measures and significance tests
https://strengejacke.github.io/sjstats
189 stars 21 forks source link

adding support for multivariate eta-squared? #53

Closed IndrajeetPatil closed 4 years ago

IndrajeetPatil commented 6 years ago

This will be a nice addition to what is currently covered by sjstats.

I had a look at the code for how this is done in heplots (http://friendly.github.io/heplots/reference/etasq.html#details) and it doesn't seem too time-consuming. If you also plan to have confidence intervals for them though, not sure how much work would that be.

(Also, note that R 3.6.0 gives the following warnings about S3 methods)

# for reproducibility
set.seed(123)
library(heplots)
library(sjstats)

# model and its class + summary
mod <-
  stats::manova(cbind(Sepal.Length, Petal.Length) ~ Species, data = iris)

class(mod)
#> [1] "manova" "maov"   "aov"    "mlm"    "lm"

summary(mod)
#>            Df Pillai approx F num Df den Df    Pr(>F)    
#> Species     2 0.9885   71.829      4    294 < 2.2e-16 ***
#> Residuals 147                                            
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

# broom tidier available?
broom::tidy(mod)
#> # A tibble: 2 x 7
#>   term         df pillai statistic num.df den.df   p.value
#>   <chr>     <dbl>  <dbl>     <dbl>  <dbl>  <dbl>     <dbl>
#> 1 Species       2  0.989      71.8      4    294  2.22e-42
#> 2 Residuals   147 NA          NA       NA     NA NA

# eta-squared from sjstats?
sjstats::eta_sq(mod)
#> Error: Model object has no sums of squares. Cannot compute effect size statistic.

# using `heplots`
heplots::etasq(mod)
#>             eta^2
#> Species 0.4942503

Created on 2018-11-22 by the reprex package (v0.2.1)

strengejacke commented 5 years ago

Do you think you can submit an PR for this?

IndrajeetPatil commented 5 years ago

I am currently in the middle of a major refactoring of all my packages. I can definitely give this a try once I am done with the refactoring.

DominiqueMakowski commented 5 years ago

"in the middle of a major refactoring"... we all know how that ends 😅 [spoilers: with feature creep]

strengejacke commented 4 years ago

"moved" to https://github.com/easystats/effectsize/issues/27.