easystats / performance

:muscle: Models' quality and performance metrics (R2, ICC, LOO, AIC, BF, ...)
https://easystats.github.io/performance/
GNU General Public License v3.0
1k stars 87 forks source link

`model_performance` prints `summary.gamlss` output in addition to its own #244

Closed vincentarelbundock closed 3 years ago

vincentarelbundock commented 3 years ago

When I assign the output of model_performance to a variable and the model I am summarizing is lm, then the procedure is silent.

When I do the same but the model is a gamlss, then the procedure spits out verbose results from summary.gamlss. I think the silent behavior is intended.

library(gamlss)
library(performance)

mod <- lm(hp ~ mpg, mtcars)
x <- model_performance(mod)

dat <- rgamma(100, shape=1, scale=10)
mod <- gamlss(dat ~ 1, family = GA, trace = FALSE)
x <- model_performance(mod)
#> ******************************************************************
#> Family:  c("GA", "Gamma") 
#> 
#> Call:  gamlss(formula = dat ~ 1, family = GA, trace = FALSE) 
#> 
#> Fitting method: RS() 
#> 
#> ------------------------------------------------------------------
#> Mu link function:  log
#> Mu Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)   2.3039     0.1046   22.03   <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> ------------------------------------------------------------------
#> Sigma link function:  log
#> Sigma Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)
#> (Intercept)  0.04486    0.06176   0.726    0.469
#> 
#> ------------------------------------------------------------------
#> No. of observations in the fit:  100 
#> Degrees of Freedom for the fit:  2
#>       Residual Deg. of Freedom:  98 
#>                       at cycle:  2 
#>  
#> Global Deviance:     660.239 
#>             AIC:     664.239 
#>             SBC:     669.4493 
#> ******************************************************************
IndrajeetPatil commented 3 years ago

Reprex after the merged fix:

library(gamlss)
#> Loading required package: splines
#> Loading required package: gamlss.data
#> 
#> Attaching package: 'gamlss.data'
#> The following object is masked from 'package:datasets':
#> 
#>     sleep
#> Loading required package: gamlss.dist
#> Loading required package: MASS
#> Loading required package: nlme
#> Loading required package: parallel
#>  **********   GAMLSS Version 5.3-4  **********
#> For more on GAMLSS look at https://www.gamlss.com/
#> Type gamlssNews() to see new features/changes/bug fixes.
library(performance)

mod <- lm(hp ~ mpg, mtcars)
x <- model_performance(mod)

dat <- rgamma(100, shape=1, scale=10)
mod <- gamlss(dat ~ 1, family = GA, trace = FALSE)
x <- model_performance(mod)

Created on 2021-04-01 by the reprex package (v1.0.0)