easystats / parameters

:bar_chart: Computation and processing of models' parameters
https://easystats.github.io/parameters/
GNU General Public License v3.0
439 stars 36 forks source link

Simply extracting random effects variances #717

Closed strengejacke closed 2 years ago

strengejacke commented 2 years ago

We could probably simplify a lot for merMod and glmmTMB objects:

m <- lme4::lmer(angle ~ poly(temp, 2) + (poly(temp, 2)|replicate) + (temperature|recipe),
                data = lme4::cake)
#> boundary (singular) fit: see help('isSingular')

as.data.frame(lme4::VarCorr(m), order = "lower.tri")
#>          grp           var1           var2          vcov       sdcor
#> 1  replicate    (Intercept)           <NA>  39.289063184  6.26809885
#> 2  replicate    (Intercept) poly(temp, 2)1  42.565947869  0.62190190
#> 3  replicate    (Intercept) poly(temp, 2)2  17.810281023  0.32657990
#> 4  replicate poly(temp, 2)1           <NA> 119.236487929 10.91954614
#> 5  replicate poly(temp, 2)1 poly(temp, 2)2  89.615008219  0.94325840
#> 6  replicate poly(temp, 2)2           <NA>  75.699143015  8.70052544
#> 7     recipe    (Intercept)           <NA>   0.629862937  0.79363905
#> 8     recipe    (Intercept)  temperature.L  -0.108512942 -1.00000000
#> 9     recipe    (Intercept)  temperature.Q  -0.218140798 -0.95405846
#> 10    recipe    (Intercept)  temperature.C  -0.973441126 -0.99998229
#> 11    recipe    (Intercept)  temperature^4  -1.384011822 -0.99823861
#> 12    recipe    (Intercept)  temperature^5  -0.018849548 -0.09504993
#> 13    recipe  temperature.L           <NA>   0.018694636  0.13672833
#> 14    recipe  temperature.L  temperature.Q   0.037581350  0.95405846
#> 15    recipe  temperature.L  temperature.C   0.167704676  0.99998229
#> 16    recipe  temperature.L  temperature^4   0.238437897  0.99823861
#> 17    recipe  temperature.L  temperature^5   0.003247405  0.09504993
#> 18    recipe  temperature.Q           <NA>   0.082999939  0.28809710
#> 19    recipe  temperature.Q  temperature.C   0.337762423  0.95582435
#> 20    recipe  temperature.Q  temperature^4   0.470380117  0.93460406
#> 21    recipe  temperature.Q  temperature^5  -0.014942360 -0.20756504
#> 22    recipe  temperature.C           <NA>   1.504487939  1.22657570
#> 23    recipe  temperature.C  temperature^4   2.138207522  0.99786799
#> 24    recipe  temperature.C  temperature^5   0.027316308  0.08912541
#> 25    recipe  temperature^4           <NA>   3.051861461  1.74695777
#> 26    recipe  temperature^4  temperature^5   0.067198680  0.15394027
#> 27    recipe  temperature^5           <NA>   0.062438464  0.24987690
#> 28  Residual           <NA>           <NA>  21.566909051  4.64401863

If var2 is given, it's a correlation, if var2 is NA, it's a SD.

Originally posted by @strengejacke in https://github.com/easystats/parameters/issues/716#issuecomment-1140758184

strengejacke commented 2 years ago

I checked this for packages lme4, glmmTMB, nlme, GLMMadaptive, ordinal (clmm) and cplm (cpglmm), which work fine now. We still need to check classes mjoint and glmmadmb.