diff --git a/README.Rmd b/README.Rmd index 895fa02a8..e7c540577 100644 --- a/README.Rmd +++ b/README.Rmd @@ -26,7 +26,7 @@ library(performance) ``` [![DOI](https://joss.theoj.org/papers/10.21105/joss.03139/status.svg)](https://doi.org/10.21105/joss.03139) -[![downloads](http://cranlogs.r-pkg.org/badges/performance)](https://cran.r-project.org/package=performance) [![total](https://cranlogs.r-pkg.org/badges/grand-total/performance)](https://cranlogs.r-pkg.org/) [![status](https://tinyverse.netlify.com/badge/performance)](https://CRAN.R-project.org/package=performance) +[![downloads](http://cranlogs.r-pkg.org/badges/performance)](https://cran.r-project.org/package=performance) [![total](https://cranlogs.r-pkg.org/badges/grand-total/performance)](https://cranlogs.r-pkg.org/) ***Test if your model is a good model!*** @@ -145,7 +145,7 @@ icc(model) ``` ...and models of class `brmsfit`. - + ```{r, echo=FALSE, eval=curl::has_internet()} model <- insight::download_model("brms_mixed_1") ``` @@ -224,7 +224,7 @@ model <- lmer( check_singularity(model) ``` -Remedies to cure issues with singular fits can be found [here](https://easystats.github.io/performance/reference/check_singularity.html). +Remedies to cure issues with singular fits can be found [here](https://easystats.github.io/performance/reference/check_singularity.html). #### Check for heteroskedasticity diff --git a/README.md b/README.md index e4e0352dc..5153170da 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ [![DOI](https://joss.theoj.org/papers/10.21105/joss.03139/status.svg)](https://doi.org/10.21105/joss.03139) [![downloads](http://cranlogs.r-pkg.org/badges/performance)](https://cran.r-project.org/package=performance) [![total](https://cranlogs.r-pkg.org/badges/grand-total/performance)](https://cranlogs.r-pkg.org/) -[![status](https://tinyverse.netlify.com/badge/performance)](https://CRAN.R-project.org/package=performance) ***Test if your model is a good model!*** @@ -58,13 +57,13 @@ To cite performance in publications use: ``` r citation("performance") #> To cite package 'performance' in publications use: -#> +#> #> Lüdecke et al., (2021). performance: An R Package for Assessment, Comparison and #> Testing of Statistical Models. Journal of Open Source Software, 6(60), 3139. #> https://doi.org/10.21105/joss.03139 -#> +#> #> A BibTeX entry for LaTeX users is -#> +#> #> @Article{, #> title = {{performance}: An {R} Package for Assessment, Comparison and Testing of Statistical Models}, #> author = {Daniel Lüdecke and Mattan S. Ben-Shachar and Indrajeet Patil and Philip Waggoner and Dominique Makowski}, @@ -146,15 +145,15 @@ model <- stan_glmer( r2(model) #> # Bayesian R2 with Compatibility Interval -#> +#> #> Conditional R2: 0.953 (95% CI [0.942, 0.964]) -#> Marginal R2: 0.824 (95% CI [0.720, 0.898]) +#> Marginal R2: 0.826 (95% CI [0.724, 0.900]) library(lme4) model <- lmer(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy) r2(model) #> # R2 for Mixed Models -#> +#> #> Conditional R2: 0.799 #> Marginal R2: 0.279 ``` @@ -173,7 +172,7 @@ library(lme4) model <- lmer(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy) icc(model) #> # Intraclass Correlation Coefficient -#> +#> #> Adjusted ICC: 0.722 #> Unadjusted ICC: 0.521 ``` @@ -189,9 +188,9 @@ model <- brm(mpg ~ wt + (1 | cyl) + (1 + wt | gear), data = mtcars) ``` r icc(model) #> # Intraclass Correlation Coefficient -#> -#> Adjusted ICC: 0.930 -#> Unadjusted ICC: 0.771 +#> +#> Adjusted ICC: 0.941 +#> Unadjusted ICC: 0.779 ``` ### Model diagnostics @@ -210,7 +209,7 @@ data(Salamanders) model <- glm(count ~ spp + mined, family = poisson, data = Salamanders) check_overdispersion(model) #> # Overdispersion test -#> +#> #> dispersion ratio = 2.946 #> Pearson's Chi-Squared = 1873.710 #> p-value = < 0.001 @@ -235,7 +234,7 @@ fitted model. model <- glm(count ~ spp + mined, family = poisson, data = Salamanders) check_zeroinflation(model) #> # Check for zero-inflation -#> +#> #> Observed zeros: 387 #> Predicted zeros: 298 #> Ratio: 0.77 @@ -323,7 +322,7 @@ be r-squared, AIC, BIC, RMSE, ICC or LOOIC. m1 <- lm(mpg ~ wt + cyl, data = mtcars) model_performance(m1) #> # Indices of model performance -#> +#> #> AIC | AICc | BIC | R2 | R2 (adj.) | RMSE | Sigma #> --------------------------------------------------------------- #> 156.010 | 157.492 | 161.873 | 0.830 | 0.819 | 2.444 | 2.568 @@ -335,7 +334,7 @@ model_performance(m1) m2 <- glm(vs ~ wt + mpg, data = mtcars, family = "binomial") model_performance(m2) #> # Indices of model performance -#> +#> #> AIC | AICc | BIC | Tjur's R2 | RMSE | Sigma | Log_loss | Score_log | Score_spherical | PCP #> ----------------------------------------------------------------------------------------------------- #> 31.298 | 32.155 | 35.695 | 0.478 | 0.359 | 1.000 | 0.395 | -14.903 | 0.095 | 0.743 @@ -348,7 +347,7 @@ library(lme4) m3 <- lmer(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy) model_performance(m3) #> # Indices of model performance -#> +#> #> AIC | AICc | BIC | R2 (cond.) | R2 (marg.) | ICC | RMSE | Sigma #> ---------------------------------------------------------------------------------- #> 1755.628 | 1756.114 | 1774.786 | 0.799 | 0.279 | 0.722 | 23.438 | 25.592 @@ -368,12 +367,12 @@ m4 <- glm(counts ~ outcome + treatment, family = poisson()) compare_performance(m1, m2, m3, m4, verbose = FALSE) #> # Comparison of Model Performance Indices -#> +#> #> Name | Model | AIC (weights) | AICc (weights) | BIC (weights) | RMSE | Sigma | Score_log | Score_spherical | R2 | R2 (adj.) | Tjur's R2 | Log_loss | PCP | R2 (cond.) | R2 (marg.) | ICC | Nagelkerke's R2 #> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -#> m1 | lm | 156.0 (<.001) | 157.5 (<.001) | 161.9 (<.001) | 2.444 | 2.568 | | | 0.830 | 0.819 | | | | | | | -#> m2 | glm | 31.3 (>.999) | 32.2 (>.999) | 35.7 (>.999) | 0.359 | 1.000 | -14.903 | 0.095 | | | 0.478 | 0.395 | 0.743 | | | | -#> m3 | lmerMod | 1764.0 (<.001) | 1764.5 (<.001) | 1783.1 (<.001) | 23.438 | 25.592 | | | | | | | | 0.799 | 0.279 | 0.722 | +#> m1 | lm | 156.0 (<.001) | 157.5 (<.001) | 161.9 (<.001) | 2.444 | 2.568 | | | 0.830 | 0.819 | | | | | | | +#> m2 | glm | 31.3 (>.999) | 32.2 (>.999) | 35.7 (>.999) | 0.359 | 1.000 | -14.903 | 0.095 | | | 0.478 | 0.395 | 0.743 | | | | +#> m3 | lmerMod | 1764.0 (<.001) | 1764.5 (<.001) | 1783.1 (<.001) | 23.438 | 25.592 | | | | | | | | 0.799 | 0.279 | 0.722 | #> m4 | glm | 56.8 (<.001) | 76.8 (<.001) | 57.7 (<.001) | 3.043 | 1.000 | -2.598 | 0.324 | | | | | | | | | 0.657 ``` @@ -386,7 +385,7 @@ of model performance and sort the models from the best one to the worse. ``` r compare_performance(m1, m2, m3, m4, rank = TRUE, verbose = FALSE) #> # Comparison of Model Performance Indices -#> +#> #> Name | Model | RMSE | Sigma | AIC weights | AICc weights | BIC weights | Performance-Score #> ----------------------------------------------------------------------------------------------- #> m2 | glm | 0.359 | 1.000 | 1.000 | 1.000 | 1.000 | 100.00% @@ -424,7 +423,7 @@ lm4 <- lm(Sepal.Length ~ Species * Sepal.Width + Petal.Length + Petal.Width, dat test_performance(lm1, lm2, lm3, lm4) #> Name | Model | BF | Omega2 | p (Omega2) | LR | p (LR) #> ------------------------------------------------------------ -#> lm1 | lm | | | | | +#> lm1 | lm | | | | | #> lm2 | lm | > 1000 | 0.69 | < .001 | -6.25 | < .001 #> lm3 | lm | > 1000 | 0.36 | < .001 | -3.44 | < .001 #> lm4 | lm | > 1000 | 0.73 | < .001 | -7.77 | < .001 @@ -432,12 +431,12 @@ test_performance(lm1, lm2, lm3, lm4) test_bf(lm1, lm2, lm3, lm4) #> Bayes Factors for Model Comparison -#> +#> #> Model BF #> [lm2] Species + Petal.Length 3.45e+26 #> [lm3] Species * Sepal.Width 4.69e+07 #> [lm4] Species * Sepal.Width + Petal.Length + Petal.Width 7.58e+29 -#> +#> #> * Against Denominator: [lm1] Species #> * Bayes Factor Type: BIC approximation ``` diff --git a/man/figures/unnamed-chunk-14-1.png b/man/figures/unnamed-chunk-14-1.png index 67f5eb31d..c8ac9bd3a 100644 Binary files a/man/figures/unnamed-chunk-14-1.png and b/man/figures/unnamed-chunk-14-1.png differ diff --git a/man/figures/unnamed-chunk-20-1.png b/man/figures/unnamed-chunk-20-1.png index a0b924679..17d827a8a 100644 Binary files a/man/figures/unnamed-chunk-20-1.png and b/man/figures/unnamed-chunk-20-1.png differ