easystats / effectsize

:dragon: Compute and work with indices of effect size and standardized parameters
https://easystats.github.io/effectsize/
Other
337 stars 23 forks source link

supporting `Gam` objects in `eta` and `omega` functions #60

Closed IndrajeetPatil closed 4 years ago

IndrajeetPatil commented 4 years ago
# setup
set.seed(123)
library(gam)
#> Loading required package: splines
#> Loading required package: foreach
#> Loaded gam 1.16.1
data(kyphosis)

# model
mod <-
  gam(
    Kyphosis ~ s(Age, 4) + Number,
    family = binomial,
    data = kyphosis,
    trace = FALSE
  )
#> Warning in model.matrix.default(mt, mf, contrasts): non-list contrasts argument
#> ignored

# with `sjstats`
sjstats::eta_sq(mod, ci.lvl = 0.95)
#> Warning in model.response(mf, "numeric"): using type = "numeric" with a factor
#> response will be ignored
#> Warning in Ops.factor(y, z$residuals): '-' not meaningful for factors
#> Warning in Ops.factor(object$residuals, 2): '^' not meaningful for factors
#> Error in if (ssr < 1e-10 * mss) warning("ANOVA F-tests on an essentially perfect fit are unreliable"): missing value where TRUE/FALSE needed

sjstats::omega_sq(mod, ci.lvl = 0.95)
#>        term omegasq conf.low conf.high
#> 1 s(Age, 4)  -0.007       NA     0.081
#> 2    Number   0.090    0.011     0.239

# with `effectsize`
effectsize::eta_squared(mod, ci = 0.95)
#> Error in data.frame(..., stringsAsFactors = FALSE): arguments imply differing number of rows: 2, 0

effectsize::omega_squared(mod, ci = 0.95)
#> Error in data.frame(..., stringsAsFactors = FALSE): arguments imply differing number of rows: 2, 0

Created on 2020-04-02 by the reprex package (v0.3.0.9001)

Session info ``` r sessioninfo::session_info() #> - Session info --------------------------------------------------------------- #> setting value #> version R Under development (unstable) (2020-02-28 r77874) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United States.1252 #> ctype English_United States.1252 #> tz Europe/Berlin #> date 2020-04-02 #> #> - Packages ------------------------------------------------------------------- #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.0) #> backports 1.1.5 2019-10-02 [1] CRAN (R 4.0.0) #> bayestestR 0.5.3 2020-03-26 [1] Github (easystats/bayestestR@a071680) #> boot 1.3-24 2019-12-20 [2] CRAN (R 4.0.0) #> broom 0.5.3.9000 2020-03-01 [1] Github (tidymodels/broom@3c922d5) #> cli 2.0.2 2020-02-28 [1] CRAN (R 4.0.0) #> coda 0.19-3 2019-07-05 [1] CRAN (R 4.0.0) #> codetools 0.2-16 2018-12-24 [2] CRAN (R 4.0.0) #> crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.0) #> digest 0.6.25 2020-02-23 [1] CRAN (R 4.0.0) #> dplyr 0.8.5 2020-03-07 [1] CRAN (R 4.0.0) #> effectsize 0.3.0 2020-04-02 [1] Github (easystats/effectsize@a3ce6ef) #> ellipsis 0.3.0 2019-09-20 [1] CRAN (R 4.0.0) #> emmeans 1.4.5 2020-03-04 [1] CRAN (R 4.0.0) #> estimability 1.3 2018-02-11 [1] CRAN (R 4.0.0) #> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.0) #> fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.0) #> forcats 0.5.0 2020-03-01 [1] CRAN (R 4.0.0) #> foreach * 1.5.0 2020-03-30 [1] CRAN (R 4.0.0) #> fs 1.3.2 2020-03-05 [1] CRAN (R 4.0.0) #> gam * 1.16.1 2019-07-03 [1] CRAN (R 4.0.0) #> generics 0.0.2 2018-11-29 [1] CRAN (R 4.0.0) #> glue 1.3.2 2020-03-12 [1] CRAN (R 4.0.0) #> haven 2.2.0 2019-11-08 [1] CRAN (R 4.0.0) #> highr 0.8 2019-03-20 [1] CRAN (R 4.0.0) #> hms 0.5.3 2020-01-08 [1] CRAN (R 4.0.0) #> htmltools 0.4.0 2019-10-04 [1] CRAN (R 4.0.0) #> insight 0.8.2.1 2020-03-26 [1] Github (easystats/insight@269bbf1) #> iterators 1.0.12 2019-07-26 [1] CRAN (R 4.0.0) #> knitr 1.28 2020-02-06 [1] CRAN (R 4.0.0) #> lattice 0.20-40 2020-02-19 [2] CRAN (R 4.0.0) #> lifecycle 0.2.0.9000 2020-03-16 [1] Github (r-lib/lifecycle@355dcba) #> lme4 1.1-22 2020-03-23 [1] Github (lme4/lme4@531c361) #> magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.0) #> MASS 7.3-51.5 2019-12-20 [2] CRAN (R 4.0.0) #> Matrix 1.2-18 2019-11-27 [2] CRAN (R 4.0.0) #> minqa 1.2.4 2014-10-09 [1] CRAN (R 4.0.0) #> modelr 0.1.6 2020-02-22 [1] CRAN (R 4.0.0) #> multcomp 1.4-12 2020-01-10 [1] CRAN (R 4.0.0) #> mvtnorm 1.1-0 2020-02-24 [1] CRAN (R 4.0.0) #> nlme 3.1-144 2020-02-06 [2] CRAN (R 4.0.0) #> nloptr 1.2.2.1 2020-03-11 [1] CRAN (R 4.0.0) #> parameters 0.6.0.1 2020-04-02 [1] Github (easystats/parameters@d76c629) #> performance 0.4.5 2020-03-28 [1] CRAN (R 4.0.0) #> pillar 1.4.3 2019-12-20 [1] CRAN (R 4.0.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.0) #> purrr 0.3.3 2019-10-18 [1] CRAN (R 4.0.0) #> R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.0) #> Rcpp 1.0.4 2020-03-17 [1] CRAN (R 4.0.0) #> reprex 0.3.0.9001 2020-03-25 [1] Github (tidyverse/reprex@a019cc4) #> rlang 0.4.5 2020-03-01 [1] CRAN (R 4.0.0) #> rmarkdown 2.1 2020-01-20 [1] CRAN (R 4.0.0) #> rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.0.0) #> sandwich 2.5-1 2019-04-06 [1] CRAN (R 4.0.0) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.0) #> sjlabelled 1.1.3 2020-01-28 [1] CRAN (R 4.0.0) #> sjmisc 2.8.3 2020-01-10 [1] CRAN (R 4.0.0) #> sjstats 0.17.9 2020-02-06 [1] CRAN (R 4.0.0) #> statmod 1.4.34 2020-02-17 [1] CRAN (R 4.0.0) #> stringi 1.4.6 2020-02-17 [1] CRAN (R 4.0.0) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.0) #> styler 1.3.2 2020-02-23 [1] CRAN (R 4.0.0) #> survival 3.1-8 2019-12-03 [2] CRAN (R 4.0.0) #> TH.data 1.0-10 2019-01-21 [1] CRAN (R 4.0.0) #> tibble 3.0.0 2020-03-30 [1] CRAN (R 4.0.0) #> tidyr 1.0.2 2020-01-24 [1] CRAN (R 4.0.0) #> tidyselect 1.0.0 2020-01-27 [1] CRAN (R 4.0.0) #> vctrs 0.2.4 2020-03-10 [1] CRAN (R 4.0.0) #> withr 2.1.2 2018-03-15 [1] CRAN (R 4.0.0) #> xfun 0.12 2020-01-13 [1] CRAN (R 4.0.0) #> xtable 1.8-4 2019-04-21 [1] CRAN (R 4.0.0) #> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.0) #> zoo 1.8-7 2020-01-10 [1] CRAN (R 4.0.0) #> #> [1] C:/Users/inp099/Documents/R/win-library/4.0 #> [2] C:/Program Files/R/R-devel/library ```
mattansb commented 4 years ago

Going in circles indeed ^_^ This is the same issue with parameters::model_parameters (parameters/issues/191), which is used internally by the eta_squared function family.