strengejacke / sjstats

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

breaking changes introduced in `sjstats 0.17.3` #60

Closed IndrajeetPatil closed 5 years ago

IndrajeetPatil commented 5 years ago

The within-subjects ANOVA is no longer properly supported in the newer version of sjstats (0.17.3), which I see has been submitted to CRAN. Additionally, the results from eta_sq and omega_sq are different from those produced by 0.17.2 version. I caught this in my own tests that check these values.

For example, with 0.17.2, irrespective of whether eta and omega variants were chosen or partial was set to TRUE or FALSE, the functions always worked-

#------------------------------------- with 0.17.2 -------------------------------------
packageVersion("sjstats")
#> [1] '0.17.2'

# model
set.seed(123)
mod <-
  stats::aov(
    formula = mpg ~ wt + qsec + Error(disp / am),
    data = mtcars
  )

# extracting effect sizes
sjstats::eta_sq(mod, partial = TRUE, ci.lvl = 0.95, n = 100)

#>   term partial.etasq conf.low conf.high stratum
#> 1   wt         0.805       NA        NA    disp
#> 2   wt         0.002       NA        NA disp:am
#> 3   wt         0.308    0.053     0.520  Within
#> 4 qsec         0.149    0.000     0.378  Within

sjstats::eta_sq(mod, partial = FALSE, ci.lvl = 0.95, n = 100)
#>   term etasq conf.low conf.high stratum
#> 1   wt 0.718    0.613     0.855    disp
#> 2   wt 0.000   -0.010     0.019 disp:am
#> 3   wt 0.077   -0.019     0.186  Within
#> 4 qsec 0.030   -0.004     0.071  Within

sjstats::omega_sq(mod, partial = TRUE, ci.lvl = 0.95, n = 100)
#>   term partial.omegasq conf.low conf.high stratum
#> 1   wt           0.776    0.690     0.899    disp
#> 2   wt          -0.030   -0.083     0.075 disp:am
#> 3   wt           0.257   -0.039     0.634  Within
#> 4 qsec           0.104   -0.053     0.310  Within

sjstats::omega_sq(mod, partial = FALSE, ci.lvl = 0.95, n = 100)
#>   term omegasq conf.low conf.high stratum
#> 1   wt   0.707       NA        NA    disp
#> 2   wt  -0.006       NA        NA disp:am
#> 3   wt   0.071    0.049     0.496  Within
#> 4 qsec   0.024       NA     0.355  Within

This is not the case anymore-

#------------------------------------- with 0.17.3 -------------------------------------

# with 0.17.3
packageVersion("sjstats")
#> [1] '0.17.3'

# model
set.seed(123)
mod <-
  stats::aov(
    formula = mpg ~ wt + qsec + Error(disp / am),
    data = mtcars
  )

# extracting effect sizes
sjstats::eta_sq(mod, partial = TRUE, ci.lvl = 0.95, n = 100)

#>   term partial.etasq conf.low conf.high stratum
#> 1   wt         0.805       NA        NA    disp
#> 2   wt         0.002       NA        NA disp:am
#> 3   wt         0.308    0.053     0.520  Within
#> 4 qsec         0.149    0.000     0.378  Within

sjstats::eta_sq(mod, partial = FALSE, ci.lvl = 0.95, n = 100)
#> Error in formula.default(x): invalid formula

sjstats::omega_sq(mod, partial = TRUE, ci.lvl = 0.95, n = 100)
#> Error in formula.default(x): invalid formula

sjstats::omega_sq(mod, partial = FALSE, ci.lvl = 0.95, n = 100)
#>   term omegasq conf.low conf.high stratum
#> 1   wt   0.707       NA        NA    disp
#> 2   wt  -0.006       NA        NA disp:am
#> 3   wt   0.071    0.049     0.496  Within
#> 4 qsec   0.024       NA     0.355  Within

Was there any rationale for why this change was introduced? Or this is unexpected behavior?

Two of my packages depend on sjstats and their tests are going to fail once 0.17.3 makes it on CRAN. In future, please run devtools::revdep_check() so that I get a notification about breaking changes so that I can prepare new releases of my packages to sync with sjstats.

strengejacke commented 5 years ago

I must check to find out the source of this issue, as far as I'm aware there was no specific change between 0.17.2 and 0.17.3 that might cause this issue.

strengejacke commented 5 years ago

sjstats is not on CRAN yet, so this update will also be included in the CRAN submission.

strengejacke commented 5 years ago

I don't see the difference that leads to the revdep-problems here: https://github.com/IndrajeetPatil/ggstatsplot/issues/128

I have just ran your examples from sjstats 0.17.2 above with the latest GitHub-release, and get exactly the same value.

# model
set.seed(123)
mod <-
  stats::aov(
    formula = mpg ~ wt + qsec + Error(disp / am),
    data = mtcars
  )

# extracting effect sizes
sjstats::eta_sq(mod, partial = TRUE, ci.lvl = 0.95, n = 100)
#>   term partial.etasq conf.low conf.high stratum
#> 1   wt         0.805       NA        NA    disp
#> 2   wt         0.002       NA        NA disp:am
#> 3   wt         0.308    0.053     0.520  Within
#> 4 qsec         0.149    0.000     0.378  Within

sjstats::eta_sq(mod, partial = FALSE, ci.lvl = 0.95, n = 100)
#>   term etasq conf.low conf.high stratum
#> 1   wt 0.718    0.613     0.855    disp
#> 2   wt 0.000   -0.010     0.019 disp:am
#> 3   wt 0.077   -0.019     0.186  Within
#> 4 qsec 0.030   -0.004     0.071  Within

sjstats::omega_sq(mod, partial = TRUE, ci.lvl = 0.95, n = 100)
#>   term partial.omegasq conf.low conf.high stratum
#> 1   wt           0.776    0.690     0.899    disp
#> 2   wt          -0.030   -0.083     0.075 disp:am
#> 3   wt           0.257   -0.039     0.634  Within
#> 4 qsec           0.104   -0.053     0.310  Within

sjstats::omega_sq(mod, partial = FALSE, ci.lvl = 0.95, n = 100)
#>   term omegasq conf.low conf.high stratum
#> 1   wt   0.707       NA        NA    disp
#> 2   wt  -0.006       NA        NA disp:am
#> 3   wt   0.071    0.049     0.496  Within
#> 4 qsec   0.024       NA     0.355  Within

Created on 2019-01-05 by the reprex package (v0.2.1)

IndrajeetPatil commented 5 years ago

I can still reproduce this discrepancy.

Here is a very simple example. Although the eta-squared estimates are the same, the confidence intervals are wildly different across two versions. Haven't run a similar check for omega-squared yet.

# package version
packageVersion("sjstats")
#> [1] '0.17.2'

# model
set.seed(123)
mod <- stats::lm(
  formula = mpg ~ hp * wt,
  data = mtcars
)

# eta-squared
sjstats::eta_sq(mod, FALSE, 0.99, 100)
#>    term etasq conf.low conf.high
#> 1    hp 0.602    0.468     0.782
#> 2    wt 0.224    0.076     0.366
#> 3 hp:wt 0.058   -0.010     0.107

Created on 2019-01-05 by the reprex package (v0.2.1)

Session info ``` r devtools::session_info() #> - Session info ---------------------------------------------------------- #> setting value #> version R Under development (unstable) (2018-11-30 r75724) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United States.1252 #> ctype English_United States.1252 #> tz Asia/Calcutta #> date 2019-01-05 #> #> - Packages -------------------------------------------------------------- #> package * version date lib #> assertthat 0.2.0 2017-04-11 [1] #> backports 1.1.3 2018-12-14 [1] #> bayesplot 1.6.0 2018-08-02 [1] #> bindr 0.1.1 2018-03-13 [1] #> bindrcpp * 0.2.2 2018-03-29 [1] #> broom 0.5.1.9000 2018-12-24 [1] #> callr 3.1.1 2018-12-21 [1] #> cli 1.0.1.9000 2018-10-30 [1] #> coda 0.19-2 2018-10-08 [1] #> codetools 0.2-16 2018-12-24 [1] #> coin 1.2-2 2017-11-28 [1] #> colorspace 1.3-2 2016-12-14 [1] #> crayon 1.3.4 2017-09-16 [1] #> data.table 1.11.8 2018-09-30 [1] #> desc 1.2.0 2018-10-30 [1] #> devtools 2.0.1 2018-10-26 [1] #> digest 0.6.18 2018-10-10 [1] #> dplyr 0.7.8 2018-11-10 [1] #> emmeans 1.3.1 2018-12-13 [1] #> estimability 1.3 2018-02-11 [1] #> evaluate 0.12 2018-10-09 [1] #> forcats 0.3.0 2018-02-19 [1] #> fs 1.2.6 2018-08-23 [1] #> generics 0.0.2 2018-11-29 [1] #> ggplot2 3.1.0.9000 2018-12-15 [1] #> ggridges 0.5.1 2018-09-27 [1] #> glmmTMB 0.2.2.0 2018-07-03 [1] #> glue 1.3.0 2018-07-17 [1] #> gtable 0.2.0 2016-02-26 [1] #> haven 2.0.0 2018-11-22 [1] #> highr 0.7 2018-06-09 [1] #> hms 0.4.2 2018-03-10 [1] #> htmltools 0.3.6 2017-04-28 [1] #> knitr 1.21 2018-12-10 [1] #> lattice 0.20-38 2018-11-04 [2] #> lazyeval 0.2.1 2017-10-29 [1] #> lme4 1.1-19 2018-11-10 [1] #> magrittr 1.5 2014-11-22 [1] #> MASS 7.3-51.1 2018-11-01 [2] #> Matrix 1.2-15 2018-11-01 [1] #> memoise 1.1.0 2017-04-21 [1] #> minqa 1.2.4 2014-10-09 [1] #> modelr 0.1.2 2018-05-11 [1] #> modeltools 0.2-22 2018-07-16 [1] #> multcomp 1.4-8 2017-11-08 [1] #> munsell 0.5.0 2018-06-12 [1] #> mvtnorm 1.0-8 2018-05-31 [1] #> nlme 3.1-137 2018-04-07 [2] #> nloptr 1.2.1 2018-10-03 [1] #> pillar 1.3.1 2018-12-15 [1] #> pkgbuild 1.0.2 2018-10-16 [1] #> pkgconfig 2.0.2 2018-08-16 [1] #> pkgload 1.0.2 2018-10-29 [1] #> plyr 1.8.4 2016-06-08 [1] #> prediction 0.3.6.1 2018-12-04 [1] #> prettyunits 1.0.2 2015-07-13 [1] #> processx 3.2.1 2018-12-05 [1] #> ps 1.3.0 2018-12-21 [1] #> purrr 0.2.99.9000 2019-01-04 [1] #> pwr 1.2-2 2018-03-03 [1] #> R6 2.3.0 2018-10-04 [1] #> Rcpp 1.0.0 2018-11-07 [1] #> remotes 2.0.2 2018-10-30 [1] #> rlang 0.3.0.9002 2019-01-04 [1] #> rmarkdown 1.11 2018-12-08 [1] #> rprojroot 1.3-2 2018-01-03 [1] #> sandwich 2.5-0 2018-08-17 [1] #> scales 1.0.0 2018-08-09 [1] #> sessioninfo 1.1.1 2018-11-05 [1] #> sjlabelled 1.0.15 2018-11-22 [1] #> sjmisc 2.7.7 2019-01-02 [1] #> sjstats 0.17.2 2018-11-15 [1] #> snakecase 0.9.2 2018-08-14 [1] #> stringdist 0.9.5.1 2018-06-08 [1] #> stringi 1.2.4 2018-07-20 [1] #> stringr 1.3.1 2018-05-10 [1] #> survival 2.43-3 2018-11-26 [2] #> testthat 2.0.1 2018-10-13 [1] #> TH.data 1.0-9 2018-07-10 [1] #> tibble 2.0.0 2019-01-04 [1] #> tidyr 0.8.2 2018-10-28 [1] #> tidyselect 0.2.5 2018-10-11 [1] #> TMB 1.7.15 2018-11-09 [1] #> usethis 1.4.0.9000 2018-12-12 [1] #> withr 2.1.2 2018-03-15 [1] #> xfun 0.4 2018-10-23 [1] #> xtable 1.8-3 2018-08-29 [1] #> yaml 2.2.0 2018-07-25 [1] #> zoo 1.8-4 2018-09-19 [1] #> source #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (tidymodels/broom@a1ac666) #> CRAN (R 3.6.0) #> Github (r-lib/cli@56538e3) #> CRAN (R 3.5.1) #> CRAN (R 3.5.2) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (r-lib/desc@7c12d36) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> Github (tidyverse/ggplot2@9292832) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> Github (tidyverse/purrr@3b4a013) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> Github (r-lib/rlang@67ff440) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.2) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (tidyverse/tibble@d06dd5c) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> Github (r-lib/usethis@923dd75) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.2) #> #> [1] C:/Users/inp099/Documents/R/win-library/3.6 #> [2] C:/Program Files/R/R-devel/library ```

model

set.seed(123) mod <- stats::lm( formula = mpg ~ hp * wt, data = mtcars )

eta-squared

sjstats::eta_sq(mod, FALSE, 0.99, 100)

> term etasq conf.low conf.high

> 1 hp 0.602 0.417 0.833

> 2 wt 0.224 0.029 0.413

> 3 hp:wt 0.058 -0.028 0.126


<sup>Created on 2019-01-05 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1)</sup>

<details>

<summary>Session info</summary>

``` r
devtools::session_info()
#> - Session info ----------------------------------------------------------
#>  setting  value                                             
#>  version  R Under development (unstable) (2018-11-30 r75724)
#>  os       Windows 10 x64                                    
#>  system   x86_64, mingw32                                   
#>  ui       RTerm                                             
#>  language (EN)                                              
#>  collate  English_United States.1252                        
#>  ctype    English_United States.1252                        
#>  tz       Asia/Calcutta                                     
#>  date     2019-01-05                                        
#> 
#> - Packages --------------------------------------------------------------
#>  package      * version     date       lib
#>  assertthat     0.2.0       2017-04-11 [1]
#>  backports      1.1.3       2018-12-14 [1]
#>  bayesplot      1.6.0       2018-08-02 [1]
#>  bindr          0.1.1       2018-03-13 [1]
#>  bindrcpp     * 0.2.2       2018-03-29 [1]
#>  broom          0.5.1.9000  2018-12-24 [1]
#>  callr          3.1.1       2018-12-21 [1]
#>  cli            1.0.1.9000  2018-10-30 [1]
#>  coda           0.19-2      2018-10-08 [1]
#>  codetools      0.2-16      2018-12-24 [1]
#>  coin           1.2-2       2017-11-28 [1]
#>  colorspace     1.3-2       2016-12-14 [1]
#>  crayon         1.3.4       2017-09-16 [1]
#>  data.table     1.11.8      2018-09-30 [1]
#>  desc           1.2.0       2018-10-30 [1]
#>  devtools       2.0.1       2018-10-26 [1]
#>  digest         0.6.18      2018-10-10 [1]
#>  dplyr          0.7.8       2018-11-10 [1]
#>  emmeans        1.3.1       2018-12-13 [1]
#>  estimability   1.3         2018-02-11 [1]
#>  evaluate       0.12        2018-10-09 [1]
#>  forcats        0.3.0       2018-02-19 [1]
#>  fs             1.2.6       2018-08-23 [1]
#>  generics       0.0.2       2018-11-29 [1]
#>  ggplot2        3.1.0.9000  2018-12-15 [1]
#>  ggridges       0.5.1       2018-09-27 [1]
#>  glmmTMB        0.2.2.0     2018-07-03 [1]
#>  glue           1.3.0       2018-07-17 [1]
#>  gtable         0.2.0       2016-02-26 [1]
#>  haven          2.0.0       2018-11-22 [1]
#>  highr          0.7         2018-06-09 [1]
#>  hms            0.4.2       2018-03-10 [1]
#>  htmltools      0.3.6       2017-04-28 [1]
#>  knitr          1.21        2018-12-10 [1]
#>  lattice        0.20-38     2018-11-04 [2]
#>  lazyeval       0.2.1       2017-10-29 [1]
#>  lme4           1.1-19      2018-11-10 [1]
#>  magrittr       1.5         2014-11-22 [1]
#>  MASS           7.3-51.1    2018-11-01 [2]
#>  Matrix         1.2-15      2018-11-01 [1]
#>  memoise        1.1.0       2017-04-21 [1]
#>  minqa          1.2.4       2014-10-09 [1]
#>  modelr         0.1.2       2018-05-11 [1]
#>  modeltools     0.2-22      2018-07-16 [1]
#>  multcomp       1.4-8       2017-11-08 [1]
#>  munsell        0.5.0       2018-06-12 [1]
#>  mvtnorm        1.0-8       2018-05-31 [1]
#>  nlme           3.1-137     2018-04-07 [2]
#>  nloptr         1.2.1       2018-10-03 [1]
#>  pillar         1.3.1       2018-12-15 [1]
#>  pkgbuild       1.0.2       2018-10-16 [1]
#>  pkgconfig      2.0.2       2018-08-16 [1]
#>  pkgload        1.0.2       2018-10-29 [1]
#>  plyr           1.8.4       2016-06-08 [1]
#>  prediction     0.3.6.1     2018-12-04 [1]
#>  prettyunits    1.0.2       2015-07-13 [1]
#>  processx       3.2.1       2018-12-05 [1]
#>  ps             1.3.0       2018-12-21 [1]
#>  purrr          0.2.99.9000 2019-01-04 [1]
#>  pwr            1.2-2       2018-03-03 [1]
#>  R6             2.3.0       2018-10-04 [1]
#>  Rcpp           1.0.0       2018-11-07 [1]
#>  remotes        2.0.2       2018-10-30 [1]
#>  rlang          0.3.0.9002  2019-01-04 [1]
#>  rmarkdown      1.11        2018-12-08 [1]
#>  rprojroot      1.3-2       2018-01-03 [1]
#>  sandwich       2.5-0       2018-08-17 [1]
#>  scales         1.0.0       2018-08-09 [1]
#>  sessioninfo    1.1.1       2018-11-05 [1]
#>  sjlabelled     1.0.15      2018-11-22 [1]
#>  sjmisc         2.7.7       2019-01-02 [1]
#>  sjstats        0.17.3      2019-01-05 [1]
#>  snakecase      0.9.2       2018-08-14 [1]
#>  stringdist     0.9.5.1     2018-06-08 [1]
#>  stringi        1.2.4       2018-07-20 [1]
#>  stringr        1.3.1       2018-05-10 [1]
#>  survival       2.43-3      2018-11-26 [2]
#>  testthat       2.0.1       2018-10-13 [1]
#>  TH.data        1.0-9       2018-07-10 [1]
#>  tibble         2.0.0       2019-01-04 [1]
#>  tidyr          0.8.2       2018-10-28 [1]
#>  tidyselect     0.2.5       2018-10-11 [1]
#>  TMB            1.7.15      2018-11-09 [1]
#>  usethis        1.4.0.9000  2018-12-12 [1]
#>  withr          2.1.2       2018-03-15 [1]
#>  xfun           0.4         2018-10-23 [1]
#>  xtable         1.8-3       2018-08-29 [1]
#>  yaml           2.2.0       2018-07-25 [1]
#>  zoo            1.8-4       2018-09-19 [1]
#>  source                               
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  Github (tidymodels/broom@a1ac666)    
#>  CRAN (R 3.6.0)                       
#>  Github (r-lib/cli@56538e3)           
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.2)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  Github (r-lib/desc@7c12d36)          
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  Github (tidyverse/ggplot2@9292832)   
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.0)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.6.0)                       
#>  Github (tidyverse/purrr@3b4a013)     
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.6.0)                       
#>  Github (r-lib/rlang@67ff440)         
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.6.0)                       
#>  Github (strengejacke/sjstats@5532689)
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  Github (tidyverse/tibble@d06dd5c)    
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  Github (r-lib/usethis@923dd75)       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.6.0)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.1)                       
#>  CRAN (R 3.5.2)                       
#> 
#> [1] C:/Users/inp099/Documents/R/win-library/3.6
#> [2] C:/Program Files/R/R-devel/library

strengejacke commented 5 years ago

Could you please check both models / package versions with ci.lvl = .95?

IndrajeetPatil commented 5 years ago

Yepp, your diagnosis is correct! 0.17.2 was indeed ignoring the value of ci.lvl and was always defaulting to 0.95.

# package version
packageVersion("sjstats")
#> [1] '0.17.2'

# model
set.seed(123)
mod <- stats::lm(
  formula = mpg ~ hp * wt,
  data = mtcars
)

# eta-squared
sjstats::eta_sq(mod, FALSE, 0.95, 100)
#>    term etasq conf.low conf.high
#> 1    hp 0.602    0.468     0.782
#> 2    wt 0.224    0.076     0.366
#> 3 hp:wt 0.058   -0.010     0.107

Created on 2019-01-05 by the reprex package (v0.2.1)

Session info ``` r devtools::session_info() #> - Session info ---------------------------------------------------------- #> setting value #> version R Under development (unstable) (2018-11-30 r75724) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United States.1252 #> ctype English_United States.1252 #> tz Asia/Calcutta #> date 2019-01-05 #> #> - Packages -------------------------------------------------------------- #> package * version date lib #> assertthat 0.2.0 2017-04-11 [1] #> backports 1.1.3 2018-12-14 [1] #> bayesplot 1.6.0 2018-08-02 [1] #> bindr 0.1.1 2018-03-13 [1] #> bindrcpp * 0.2.2 2018-03-29 [1] #> broom 0.5.1.9000 2018-12-24 [1] #> callr 3.1.1 2018-12-21 [1] #> cli 1.0.1.9000 2018-10-30 [1] #> coda 0.19-2 2018-10-08 [1] #> codetools 0.2-16 2018-12-24 [1] #> coin 1.2-2 2017-11-28 [1] #> colorspace 1.3-2 2016-12-14 [1] #> crayon 1.3.4 2017-09-16 [1] #> data.table 1.11.8 2018-09-30 [1] #> desc 1.2.0 2018-10-30 [1] #> devtools 2.0.1 2018-10-26 [1] #> digest 0.6.18 2018-10-10 [1] #> dplyr 0.7.8 2018-11-10 [1] #> emmeans 1.3.1 2018-12-13 [1] #> estimability 1.3 2018-02-11 [1] #> evaluate 0.12 2018-10-09 [1] #> forcats 0.3.0 2018-02-19 [1] #> fs 1.2.6 2018-08-23 [1] #> generics 0.0.2 2018-11-29 [1] #> ggplot2 3.1.0.9000 2018-12-15 [1] #> ggridges 0.5.1 2018-09-27 [1] #> glmmTMB 0.2.2.0 2018-07-03 [1] #> glue 1.3.0 2018-07-17 [1] #> gtable 0.2.0 2016-02-26 [1] #> haven 2.0.0 2018-11-22 [1] #> highr 0.7 2018-06-09 [1] #> hms 0.4.2 2018-03-10 [1] #> htmltools 0.3.6 2017-04-28 [1] #> knitr 1.21 2018-12-10 [1] #> lattice 0.20-38 2018-11-04 [2] #> lazyeval 0.2.1 2017-10-29 [1] #> lme4 1.1-19 2018-11-10 [1] #> magrittr 1.5 2014-11-22 [1] #> MASS 7.3-51.1 2018-11-01 [2] #> Matrix 1.2-15 2018-11-01 [1] #> memoise 1.1.0 2017-04-21 [1] #> minqa 1.2.4 2014-10-09 [1] #> modelr 0.1.2 2018-05-11 [1] #> modeltools 0.2-22 2018-07-16 [1] #> multcomp 1.4-8 2017-11-08 [1] #> munsell 0.5.0 2018-06-12 [1] #> mvtnorm 1.0-8 2018-05-31 [1] #> nlme 3.1-137 2018-04-07 [2] #> nloptr 1.2.1 2018-10-03 [1] #> pillar 1.3.1 2018-12-15 [1] #> pkgbuild 1.0.2 2018-10-16 [1] #> pkgconfig 2.0.2 2018-08-16 [1] #> pkgload 1.0.2 2018-10-29 [1] #> plyr 1.8.4 2016-06-08 [1] #> prediction 0.3.6.1 2018-12-04 [1] #> prettyunits 1.0.2 2015-07-13 [1] #> processx 3.2.1 2018-12-05 [1] #> ps 1.3.0 2018-12-21 [1] #> purrr 0.2.99.9000 2019-01-04 [1] #> pwr 1.2-2 2018-03-03 [1] #> R6 2.3.0 2018-10-04 [1] #> Rcpp 1.0.0 2018-11-07 [1] #> remotes 2.0.2 2018-10-30 [1] #> rlang 0.3.0.9002 2019-01-04 [1] #> rmarkdown 1.11 2018-12-08 [1] #> rprojroot 1.3-2 2018-01-03 [1] #> sandwich 2.5-0 2018-08-17 [1] #> scales 1.0.0 2018-08-09 [1] #> sessioninfo 1.1.1 2018-11-05 [1] #> sjlabelled 1.0.15 2018-11-22 [1] #> sjmisc 2.7.7 2019-01-02 [1] #> sjstats 0.17.2 2018-11-15 [1] #> snakecase 0.9.2 2018-08-14 [1] #> stringdist 0.9.5.1 2018-06-08 [1] #> stringi 1.2.4 2018-07-20 [1] #> stringr 1.3.1 2018-05-10 [1] #> survival 2.43-3 2018-11-26 [2] #> testthat 2.0.1 2018-10-13 [1] #> TH.data 1.0-9 2018-07-10 [1] #> tibble 2.0.0 2019-01-04 [1] #> tidyr 0.8.2 2018-10-28 [1] #> tidyselect 0.2.5 2018-10-11 [1] #> TMB 1.7.15 2018-11-09 [1] #> usethis 1.4.0.9000 2018-12-12 [1] #> withr 2.1.2 2018-03-15 [1] #> xfun 0.4 2018-10-23 [1] #> xtable 1.8-3 2018-08-29 [1] #> yaml 2.2.0 2018-07-25 [1] #> zoo 1.8-4 2018-09-19 [1] #> source #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (tidymodels/broom@a1ac666) #> CRAN (R 3.6.0) #> Github (r-lib/cli@56538e3) #> CRAN (R 3.5.1) #> CRAN (R 3.5.2) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (r-lib/desc@7c12d36) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> Github (tidyverse/ggplot2@9292832) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> Github (tidyverse/purrr@3b4a013) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> Github (r-lib/rlang@67ff440) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.2) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (tidyverse/tibble@d06dd5c) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> Github (r-lib/usethis@923dd75) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.2) #> #> [1] C:/Users/inp099/Documents/R/win-library/3.6 #> [2] C:/Program Files/R/R-devel/library ```
# package version
packageVersion("sjstats")
#> [1] '0.17.3'

# model
set.seed(123)
mod <- stats::lm(
  formula = mpg ~ hp * wt,
  data = mtcars
)

# eta-squared
sjstats::eta_sq(mod, FALSE, 0.95, 100)
#>    term etasq conf.low conf.high
#> 1    hp 0.602    0.468     0.782
#> 2    wt 0.224    0.076     0.366
#> 3 hp:wt 0.058   -0.010     0.107

Created on 2019-01-05 by the reprex package (v0.2.1)

Session info ``` r devtools::session_info() #> - Session info ---------------------------------------------------------- #> setting value #> version R Under development (unstable) (2018-11-30 r75724) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United States.1252 #> ctype English_United States.1252 #> tz Asia/Calcutta #> date 2019-01-05 #> #> - Packages -------------------------------------------------------------- #> package * version date lib #> assertthat 0.2.0 2017-04-11 [1] #> backports 1.1.3 2018-12-14 [1] #> bayesplot 1.6.0 2018-08-02 [1] #> bindr 0.1.1 2018-03-13 [1] #> bindrcpp * 0.2.2 2018-03-29 [1] #> broom 0.5.1.9000 2018-12-24 [1] #> callr 3.1.1 2018-12-21 [1] #> cli 1.0.1.9000 2018-10-30 [1] #> coda 0.19-2 2018-10-08 [1] #> codetools 0.2-16 2018-12-24 [1] #> coin 1.2-2 2017-11-28 [1] #> colorspace 1.3-2 2016-12-14 [1] #> crayon 1.3.4 2017-09-16 [1] #> data.table 1.11.8 2018-09-30 [1] #> desc 1.2.0 2018-10-30 [1] #> devtools 2.0.1 2018-10-26 [1] #> digest 0.6.18 2018-10-10 [1] #> dplyr 0.7.8 2018-11-10 [1] #> emmeans 1.3.1 2018-12-13 [1] #> estimability 1.3 2018-02-11 [1] #> evaluate 0.12 2018-10-09 [1] #> forcats 0.3.0 2018-02-19 [1] #> fs 1.2.6 2018-08-23 [1] #> generics 0.0.2 2018-11-29 [1] #> ggplot2 3.1.0.9000 2018-12-15 [1] #> ggridges 0.5.1 2018-09-27 [1] #> glmmTMB 0.2.2.0 2018-07-03 [1] #> glue 1.3.0 2018-07-17 [1] #> gtable 0.2.0 2016-02-26 [1] #> haven 2.0.0 2018-11-22 [1] #> highr 0.7 2018-06-09 [1] #> hms 0.4.2 2018-03-10 [1] #> htmltools 0.3.6 2017-04-28 [1] #> knitr 1.21 2018-12-10 [1] #> lattice 0.20-38 2018-11-04 [2] #> lazyeval 0.2.1 2017-10-29 [1] #> lme4 1.1-19 2018-11-10 [1] #> magrittr 1.5 2014-11-22 [1] #> MASS 7.3-51.1 2018-11-01 [2] #> Matrix 1.2-15 2018-11-01 [1] #> memoise 1.1.0 2017-04-21 [1] #> minqa 1.2.4 2014-10-09 [1] #> modelr 0.1.2 2018-05-11 [1] #> modeltools 0.2-22 2018-07-16 [1] #> multcomp 1.4-8 2017-11-08 [1] #> munsell 0.5.0 2018-06-12 [1] #> mvtnorm 1.0-8 2018-05-31 [1] #> nlme 3.1-137 2018-04-07 [2] #> nloptr 1.2.1 2018-10-03 [1] #> pillar 1.3.1 2018-12-15 [1] #> pkgbuild 1.0.2 2018-10-16 [1] #> pkgconfig 2.0.2 2018-08-16 [1] #> pkgload 1.0.2 2018-10-29 [1] #> plyr 1.8.4 2016-06-08 [1] #> prediction 0.3.6.1 2018-12-04 [1] #> prettyunits 1.0.2 2015-07-13 [1] #> processx 3.2.1 2018-12-05 [1] #> ps 1.3.0 2018-12-21 [1] #> purrr 0.2.99.9000 2019-01-04 [1] #> pwr 1.2-2 2018-03-03 [1] #> R6 2.3.0 2018-10-04 [1] #> Rcpp 1.0.0 2018-11-07 [1] #> remotes 2.0.2 2018-10-30 [1] #> rlang 0.3.0.9002 2019-01-04 [1] #> rmarkdown 1.11 2018-12-08 [1] #> rprojroot 1.3-2 2018-01-03 [1] #> sandwich 2.5-0 2018-08-17 [1] #> scales 1.0.0 2018-08-09 [1] #> sessioninfo 1.1.1 2018-11-05 [1] #> sjlabelled 1.0.15 2018-11-22 [1] #> sjmisc 2.7.7 2019-01-02 [1] #> sjstats 0.17.3 2019-01-05 [1] #> snakecase 0.9.2 2018-08-14 [1] #> stringdist 0.9.5.1 2018-06-08 [1] #> stringi 1.2.4 2018-07-20 [1] #> stringr 1.3.1 2018-05-10 [1] #> survival 2.43-3 2018-11-26 [2] #> testthat 2.0.1 2018-10-13 [1] #> TH.data 1.0-9 2018-07-10 [1] #> tibble 2.0.0 2019-01-04 [1] #> tidyr 0.8.2 2018-10-28 [1] #> tidyselect 0.2.5 2018-10-11 [1] #> TMB 1.7.15 2018-11-09 [1] #> usethis 1.4.0.9000 2018-12-12 [1] #> withr 2.1.2 2018-03-15 [1] #> xfun 0.4 2018-10-23 [1] #> xtable 1.8-3 2018-08-29 [1] #> yaml 2.2.0 2018-07-25 [1] #> zoo 1.8-4 2018-09-19 [1] #> source #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (tidymodels/broom@a1ac666) #> CRAN (R 3.6.0) #> Github (r-lib/cli@56538e3) #> CRAN (R 3.5.1) #> CRAN (R 3.5.2) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (r-lib/desc@7c12d36) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> Github (tidyverse/ggplot2@9292832) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> Github (tidyverse/purrr@3b4a013) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> Github (r-lib/rlang@67ff440) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> Github (strengejacke/sjstats@5532689) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (tidyverse/tibble@d06dd5c) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> Github (r-lib/usethis@923dd75) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.2) #> #> [1] C:/Users/inp099/Documents/R/win-library/3.6 #> [2] C:/Program Files/R/R-devel/library ```