PreprintPDF Available

Abstract

The recent growth of data science is partly fueled by the ever-growing amount of data and the joint important developments in statistical modeling, with new and powerful models and frameworks becoming accessible to users. Although there exist some generic functions to obtain model summaries and parameters, many package specific modeling functions do not provide such methods to allow users to access such valuable information.
Extracting, Computing and Exploring the Parameters of
Statistical Models using R
Daniel Lüdecke1, Mattan S. Ben-Shachar2, Indrajeet Patil3, and
Dominique Makowski4
1University Medical Center Hamburg-Eppendorf, Germany 2Ben-Gurion University of the Negev,
Israel 3Max Planck Institute for Human Development, Germany 4Nanyang Technological
University, Singapore
DOI: 10.21105/joss.02445
Software
Review
Repository
Archive
Editor: Sebastian Benthall
Reviewers:
@cmaimone
@Ohlsen
Submitted: 01 July 2020
Published: 09 September 2020
License
Authors of papers retain
copyright and release the work
under a Creative Commons
Attribution 4.0 International
License (CC BY 4.0).
Summary
The recent growth of data science is partly fueled by the ever-growing amount of data and
the joint important developments in statistical modeling, with new and powerful models and
frameworks becoming accessible to users. Although there exist some generic functions to
obtain model summaries and parameters, many package-specic modeling functions do not
provide such methods to allow users to access such valuable information.
Aims of the Package
parameters is an R-package (R Core Team, 2020) that lls this important gap. Its primary
goal is to provide utilities for processing the parameters of various statistical models. Beyond
computing p-values, standard errors, condence intervals (CI), Bayesian indices and other
measures for a wide variety of models, this package implements features like parameters
bootstrapping and engineering (such as variables reduction and/or selection), as well as tools
for data reduction like functions to perform cluster, factor or principal component analysis.
Another important goal of the parameters package is to facilitate and streamline the process
of reporting results of statistical models, which includes the easy and intuitive calculation
of standardized estimates in addition to robust standard errors and p-values. parameters
therefor oers a simple and unied syntax to process a large variety of (model) objects from
many dierent packages.
parameters is part of the easystats ecosystem, a collaborative project created to facilitate
the usage of R for statistical analyses.
Comparison to other Packages
parameters functionality is in part comparable to packages like broom (Robinson, Hayes,
& Couch, 2020), nalt (Harrison, Drake, & Ots, 2020) or stargazer (Hlavac, 2018) (and
maybe some more). Yet, there are some notable dierences, e.g.:
broom (via glance()), nalt (via ff_metrics()) and stargazer (via stargazer())
report t indices (such as R2 or AIC) by default, while parameters does not. However,
there is a dedicated package in the easystats project for assessing regression model
quality and t indices, performance (Lüdecke et al., 2020b).
Lüdecke et al., (2020). Extracting, Computing and Exploring the Parameters of Statistical Models using R. Journal of Open Source Software,
5(53), 2445. https://doi.org/10.21105/joss.02445
1
parameters easily allows to compute standardized estimates, robust estimation, small-
sample-size corrections for degrees of freedom (like Satterthwaite or Kenward-Roger),
bootstrapping or simulating parameters, and feature reduction. Furthermore, param-
eters provides functions to test for the presence or absence of an eect (equivalence
testing, see Lakens, Scheel, & Isager, 2018).
For most functions, easy-to-use plot()-methods exist to quickly create nice looking
plots (powered by the see package (Lüdecke et al., 2020a)).
parameters is a very lightweight package. Its main functionality only relies on the
insight, the bayestestR, and the eectsize packages (Ben-Shachar, Makowski, &
Lüdecke, 2020; Lüdecke, Waggoner, & Makowski, 2019; Makowski, Ben-Shachar, &
Lüdecke, 2019) to access and process information contained in models, and these pack-
ages in turn only depend on R core packages. However, additional features that do not
belong to the core functions of parameters require the installation of other packages,
such as sandwich (Zeileis, 2006) for robust estimation, psych (Revelle, 2019) for factor
analysis or PCA or cAIC4 (Saefken, Ruegamer, Kneib, & Greven, 2018) for parameter
selection for mixed models.
Examples of Features
As stated above, parameters creates summary tables of many dierent statistical models.
The workow is simple: t a model and pass it to the model_parameters() function (or its
shortcut, parameters()) to obtain information about the model’s parameters.
In the following, we show some brief examples. However, a comprehensive overview includ-
ing in-depth examples are accessible via the dedicated website (https://easystats.github.io/
parameters/).
Summary of Model Parameters
model_parameters() allows you to extract the parameters and their characteristics from
various models in a consistent way.
library(parameters)
model <- lm(Sepal.Length ~Species, data = iris)
parameters(model)
Lüdecke et al., (2020). Extracting, Computing and Exploring the Parameters of Statistical Models using R. Journal of Open Source Software,
5(53), 2445. https://doi.org/10.21105/joss.02445
2
#> Parameter | Coefficient | SE | 95% CI | p
#> -----------------------------------------------------------------
#> (Intercept) | 5.01 | 0.07 | [4.86, 5.15] | < .001
#> Species [versicolor] | 0.93 | 0.10 | [0.73, 1.13] | < .001
#> Species [virginica] | 1.58 | 0.10 | [1.38, 1.79] | < .001
Extraction of robust indices is possible for many models, in particular models supported by
the sandwich (Zeileis, 2006) and clubSandwich (Pustejovsky, 2020) packages.
parameters(model, robust = TRUE)
#> Parameter | Coefficient | SE | 95% CI | p
#> -----------------------------------------------------------------
#> (Intercept) | 5.01 | 0.05 | [4.91, 5.11] | < .001
#> Species [versicolor] | 0.93 | 0.09 | [0.75, 1.11] | < .001
#> Species [virginica] | 1.58 | 0.10 | [1.38, 1.79] | < .001
For linear mixed models, parameters() also allows to specify the method for approximating
degrees of freedom, which may improve the accurracy for calculated standard errors or p-
values.
library(lme4)
model <- lmer(
Sepal.Length ~Sepal.Width *Petal.Length +(1|Species),
data = iris
)
parameters(model, digits = 3)
#> Parameter | Coefficient | SE | 95% CI | p
#> --------------------------------------------------------------------------
#> (Intercept) | 0.707 | 0.652 | [-0.57, 1.98] | 0.278
#> Sepal.Width | 0.731 | 0.156 | [ 0.43, 1.04] | < .001
#> Petal.Length | 1.023 | 0.143 | [ 0.74, 1.30] | < .001
#> Sepal.Width * Petal.Length | -0.084 | 0.040 | [-0.16, -0.01] | 0.035
parameters(model, digits = 3,df_method = "kenward")
#> Parameter | Coefficient | SE | 95% CI | p
#> --------------------------------------------------------------------------
#> (Intercept) | 0.707 | 0.654 | [-0.70, 2.11] | 0.298
#> Sepal.Width | 0.731 | 0.157 | [ 0.42, 1.04] | < .001
#> Petal.Length | 1.023 | 0.145 | [ 0.74, 1.31] | < .001
#> Sepal.Width * Petal.Length | -0.084 | 0.040 | [-0.16, -0.01] | 0.037
Visualisation
parameters functions also include plotting capabilities via the see package (Lüdecke et al.,
2020a). A complete overview of plotting functions is available at the see website (https:
//easystats.github.io/see/articles/parameters.html).
Lüdecke et al., (2020). Extracting, Computing and Exploring the Parameters of Statistical Models using R. Journal of Open Source Software,
5(53), 2445. https://doi.org/10.21105/joss.02445
3
library(see)
model <- lm(Sepal.Length ~Petal.Width *Species, data=iris)
plot(parameters(model))
Licensing and Availability
parameters is licensed under the GNU General Public License (v3.0), with all source code
stored at GitHub (https://github.com/easystats/parameters), and with a corresponding issue
tracker for bug reporting and feature enhancements. In the spirit of honest and open science,
we encourage requests/tips for xes, feature updates, as well as general questions and concerns
via direct interaction with contributors and developers.
Acknowledgments
parameters is part of the collaborative easystats ecosystem. Thus, we would like to thank
the members of easystats as well as the users.
References
Ben-Shachar, M. S., Makowski, D., & Lüdecke, D. (2020). eectsize: Compute and interpret
indices of eect size. CRAN. doi:10.5281/zenodo.3952214
Harrison, E., Drake, T., & Ots, R. (2020). nalt: Quickly create elegant regression results
tables and plots when modelling. Retrieved from https://CRAN.R-project.org/package=
finalfit
Lüdecke et al., (2020). Extracting, Computing and Exploring the Parameters of Statistical Models using R. Journal of Open Source Software,
5(53), 2445. https://doi.org/10.21105/joss.02445
4
Hlavac, M. (2018). stargazer: Well-formatted regression and summary statistics tables.
Bratislava, Slovakia: Central European Labour Studies Institute (CELSI). Retrieved from
https://CRAN.R-project.org/package=stargazer
Lakens, D., Scheel, A. M., & Isager, P. M. (2018). Equivalence testing for psychological
research: A tutorial. Advances in Methods and Practices in Psychological Science,1(2),
259–269. doi:10.1177/2515245918770963
Lüdecke, D., Ben-Shachar, M. S., Waggoner, P., & Makowski, D. (2020a). see: Visualisation
toolbox for ’easystats’ and extra geoms, themes and color palettes for ’ggplot2’. CRAN.
doi:10.5281/zenodo.3952153
Lüdecke, D., Makowski, D., Waggoner, P., & Patil, I. (2020b). performance: Assessment of
regression models performance. CRAN. doi:10.5281/zenodo.3952174
Lüdecke, D., Waggoner, P., & Makowski, D. (2019). insight: A unied interface to access
information from model objects in R. Journal of Open Source Software,4(38), 1412.
doi:10.21105/joss.01412
Makowski, D., Ben-Shachar, M., & Lüdecke, D. (2019). bayestestR: Describing eects and
their uncertainty, existence and signicance within the bayesian framework. Journal of
Open Source Software,4(40), 1541. doi:10.21105/joss.01541
Pustejovsky, J. (2020). clubSandwich: Cluster-robust (sandwich) variance estimators
with small-sample corrections. Retrieved from https://CRAN.R-project.org/package=
clubSandwich
R Core Team. (2020). R: A language and environment for statistical computing. Vienna,
Austria: R Foundation for Statistical Computing. Retrieved from https://www.R-project.
org/
Revelle, W. (2019). psych: Procedures for psychological, psychometric, and personality
research. Evanston, Illinois: Northwestern University. Retrieved from https://CRAN.
R-project.org/package=psych
Robinson, D., Hayes, A., & Couch, S. (2020). broom: Convert statistical objects into tidy
tibbles. Retrieved from https://CRAN.R-project.org/package=broom
Saefken, B., Ruegamer, D., Kneib, T., & Greven, S. (2018). Conditional model selection in
mixed-eects models with cAIC4. ArXiv e-prints. Retrieved from https://arxiv.org/abs/
1803.05664
Zeileis, A. (2006). Object-oriented computation of sandwich estimators. Journal of Statistical
Software,16(9), 1–16. doi:10.18637/jss.v016.i09
Lüdecke et al., (2020). Extracting, Computing and Exploring the Parameters of Statistical Models using R. Journal of Open Source Software,
5(53), 2445. https://doi.org/10.21105/joss.02445
5
ResearchGate has not been able to resolve any citations for this publication.
Article
Full-text available
The Bayesian framework for statistics is quickly gaining in popularity among scientists, for reasons such as reliability and accuracy (particularly in noisy data and small samples), the possibility of incorporating prior knowledge into the analysis, and the intuitive interpretation of results (Andrews & Baguley, 2013; Etz & Vandekerckhove, 2016; Kruschke, 2010; Kruschke, Aguinis, & Joo, 2012; Wagenmakers et al., 2017). Adopting the Bayesian framework is more of a shift in the paradigm than a change in the methodology; all the common statistical procedures (t-tests, correlations, ANOVAs, regressions, etc.) can also be achieved within the Bayesian framework. One of the core difference is that in the frequentist view, the effects are fixed (but unknown) and data are random. On the other hand, instead of having single estimates of the “true effect”, the Bayesian inference process computes the probability of different effects given the observed data, resulting in a distribution of possible values for the parameters, called the posterior distribution. The bayestestR package provides tools to describe these posterior distributions.
Article
Full-text available
Psychologists must be able to test both for the presence of an effect and for the absence of an effect. In addition to testing against zero, researchers can use the two one-sided tests (TOST) procedure to test for equivalence and reject the presence of a smallest effect size of interest (SESOI). The TOST procedure can be used to determine if an observed effect is surprisingly small, given that a true effect at least as extreme as the SESOI exists. We explain a range of approaches to determine the SESOI in psychological science and provide detailed examples of how equivalence tests should be performed and reported. Equivalence tests are an important extension of the statistical tools psychologists currently use and enable researchers to falsify predictions about the presence, and declare the absence, of meaningful effects.
Article
Full-text available
Model selection in mixed models based on the conditional distribution is appropriate for many practical applications and has been a focus of recent statistical research. In this paper we introduce the R-package cAIC4 that allows for the computation of the conditional Akaike Information Criterion (cAIC). Computation of the conditional AIC needs to take into account the uncertainty of the random effects variance and is therefore not straightforward. We introduce a fast and stable implementation for the calculation of the cAIC for linear mixed models estimated with lme4 and additive mixed models estimated with gamm4 . Furthermore, cAIC4 offers a stepwise function that allows for a fully automated stepwise selection scheme for mixed models based on the conditional AIC. Examples of many possible applications are presented to illustrate the practical impact and easy handling of the package.
Article
Full-text available
Sandwich covariance matrix estimators are a popular tool in applied regression modeling for performing inference that is robust to certain types of model misspecification. Suitable implementations are available in the R system for statistical computing for certain model fitting functions only (in particular lm()), but not for other standard regression functions, such as glm(), nls(), or survreg(). Therefore, conceptual tools and their translation to computational tools in the package sandwich are discussed, enabling the computation of sandwich estimators in general parametric models. Object orientation can be achieved by providing a few extractor functions—most importantly for the empirical estimating functions—from which various types of sandwich estimators can be computed.
effectsize: Compute and interpret indices of effect size
  • M S Ben-Shachar
  • D Makowski
  • D Lüdecke
Ben-Shachar, M. S., Makowski, D., & Lüdecke, D. (2020). effectsize: Compute and interpret indices of effect size. CRAN. doi:10.5281/zenodo.3952214
finalfit: Quickly create elegant regression results tables and plots when modelling
  • E Harrison
  • T Drake
  • R Ots
Harrison, E., Drake, T., & Ots, R. (2020). finalfit: Quickly create elegant regression results tables and plots when modelling. Retrieved from https://CRAN.R-project.org/package= finalfit
stargazer: Well-formatted regression and summary statistics tables
  • M Hlavac
Hlavac, M. (2018). stargazer: Well-formatted regression and summary statistics tables. Bratislava, Slovakia: Central European Labour Studies Institute (CELSI). Retrieved from https://CRAN.R-project.org/package=stargazer
see: Visualisation toolbox for 'easystats' and extra geoms, themes and color palettes for 'ggplot2
  • D Lüdecke
  • M S Ben-Shachar
  • P Waggoner
  • D Makowski
Lüdecke, D., Ben-Shachar, M. S., Waggoner, P., & Makowski, D. (2020a). see: Visualisation toolbox for 'easystats' and extra geoms, themes and color palettes for 'ggplot2'. CRAN. doi:10.5281/zenodo.3952153