Parameters
:bar_chart: Computation and processing of models' parameters
Install / Use
/learn @easystats/ParametersREADME
parameters <img src="man/figures/logo.png" align="right" height="139" />
Describe and understand your model’s parameters!
parameters’ primary goal is to provide utilities for processing the parameters of various statistical models (see here for a list of supported models). Beyond computing p-values, CIs, Bayesian indices and other measures for a wide variety of models, this package implements features like bootstrapping of parameters and models, feature reduction (feature extraction and variable selection), or 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 or robust standard errors and p-values. parameters therefor offers a simple and unified syntax to process a large variety of (model) objects from many different packages.
Installation
| Type | Source | Command |
|----|----|----|
| Release | CRAN | install.packages("parameters") |
| Development | r - universe | install.packages("parameters", repos = "https://easystats.r-universe.dev") |
| Development | GitHub | remotes::install_github("easystats/parameters") |
Tip
Instead of
library(parameters), uselibrary(easystats). This will make all features of the easystats-ecosystem available.To stay updated, use
easystats::install_latest().
Documentation
Click on the buttons above to access the package documentation and the easystats blog, and check-out these vignettes:
- Summary of Model Parameters
- Parameter and Model Standardization
- Robust Estimation of Standard Errors, Confidence Intervals and p-values
- Model Parameters and Missing Data
- Feature reduction (PCA, cMDS, ICA…)
- Structural models (EFA, CFA, SEM…)
- Parameters selection
- A Practical Guide for Panel Data Analysis
- Plotting functions
Contributing and Support
In case you want to file an issue or contribute in another way to the package, please follow this guide. For questions about the functionality, you may either contact us via email or also file an issue.
Features
Model’s parameters description
<img src="man/figures/figure1.png" width="100%" style="display: block; margin: auto;" />The
model_parameters()
function (that can be accessed via the parameters() shortcut) allows
you to extract the parameters and their characteristics from various
models in a consistent way. It can be considered as a lightweight
alternative to broom::tidy(),
with some notable differences:
- The column names of the returned data frame are specific to their
content. For instance, the column containing the statistic is named
following the statistic name, i.e., t, z, etc., instead of a
generic name such as statistic (however, you can get standardized
(generic) column names using
standardize_names()). - It is able to compute or extract indices not available by default, such as p-values, CIs, etc.
- It includes feature engineering capabilities, including parameters bootstrapping.
Classical Regression Models
model <- lm(Sepal.Width ~ Petal.Length * Species + Petal.Width, data = iris)
# regular model parameters
model_parameters(model)
#> Parameter | Coefficient | SE | 95% CI | t(143) | p
#> -------------------------------------------------------------------------------------------
#> (Intercept) | 2.89 | 0.36 | [ 2.18, 3.60] | 8.01 | < .001
#> Petal Length | 0.26 | 0.25 | [-0.22, 0.75] | 1.07 | 0.287
#> Species [versicolor] | -1.66 | 0.53 | [-2.71, -0.62] | -3.14 | 0.002
#> Species [virginica] | -1.92 | 0.59 | [-3.08, -0.76] | -3.28 | 0.001
#> Petal Width | 0.62 | 0.14 | [ 0.34, 0.89] | 4.41 | < .001
#> Petal Length × Species [versicolor] | -0.09 | 0.26 | [-0.61, 0.42] | -0.36 | 0.721
#> Petal Length × Species [virginica] | -0.13 | 0.26 | [-0.64, 0.38] | -0.50 | 0.618
# standardized parameters
model_parameters(model, standardize = "refit")
#> Parameter | Coefficient | SE | 95% CI | t(143) | p
#> -------------------------------------------------------------------------------------------
#> (Intercept) | 3.59 | 1.30 | [ 1.01, 6.17] | 2.75 | 0.007
#> Petal Length | 1.07 | 1.00 | [-0.91, 3.04] | 1.07 | 0.287
#> Species [versicolor] | -4.62 | 1.31 | [-7.21, -2.03] | -3.53 | < .001
#> Species [virginica] | -5.51 | 1.38 | [-8.23, -2.79] | -4.00 | < .001
#> Petal Width | 1.08 | 0.24 | [ 0.59, 1.56] | 4.41 | < .001
#> Petal Length × Species [versicolor] | -0.38 | 1.06 | [-2.48, 1.72] | -0.36 | 0.721
#> Petal Length × Species [virginica] | -0.52 | 1.04 | [-2.58, 1.54] | -0.50 | 0.618
# heteroscedasticity-consitent SE and CI
model_parameters(model, vcov = "HC3")
#> Parameter | Coefficient | SE | 95% CI | t(143) | p
#> -------------------------------------------------------------------------------------------
#> (Intercept) | 2.89 | 0.43 | [ 2.03, 3.75] | 6.66 | < .001
#> Petal Length | 0.26 | 0.29 | [-0.30, 0.83] | 0.92 | 0.357
#> Species [versicolor] | -1.66 | 0.53 | [-2.70, -0.62] | -3.16 | 0.002
#> Species [virginica] | -1.92 | 0.77 | [-3.43, -0.41] | -2.51 | 0.013
#> Petal Width | 0.62 | 0.12 | [ 0.38, 0.85] | 5.23 | < .001
#> Petal Length × Species [versicolor] | -0.09 | 0.29 | [-0.67, 0.48] | -0.32 | 0.748
#> Petal Length × Species [virginica] | -0.13 | 0.31 | [-0.73, 0.48] | -0.42 | 0.675
Mixed Models
library(lme4)
model <- lmer(Sepal.Width ~ Petal.Length + (1 | Species), data = iris)
# model parameters with CI, df and p-values based on Wald approximation
model_parameters(model)
#> # Fixed Effects
#>
#> Parameter | Coefficient | SE | 95% CI | t(146) | p
#> ------------------------------------------------------------------
#> (Intercept) | 2.00 | 0.56 | [0.89, 3.11] | 3.56 | < .001
#> Petal Length | 0.28 | 0.06 | [0.16, 0.40] | 4.75 | < .001
#>
#> # Random Effects
#>
#> Parameter | Coefficient | SE | 95% CI
#> -----------------------------------------------------------
#> SD (Intercept: Species) | 0.89 | 0.46 | [0.33, 2.43]
#> SD (Residual) | 0.32 | 0.02 | [0.28, 0.35]
# model parameters with CI, df and p-values based on Kenward-Roger approximation
model_parameters(model, ci_method = "kenward", effects = "fixed")
#> # Fixed Effects
#>
#> Parameter | Coefficient | SE | 95% CI | t | df | p
#> -------------------------------------------------------------------------
#> (Intercept) | 2.00 | 0.57 | [0.07, 3.93] | 3.53 | 2.67 | 0.046
#> Petal Length | 0.28 | 0.06 | [0.16, 0.40] | 4.58 | 140.98 | < .001
Structural Models
Besides many types of regression models and packages, it also works for other types of models, such as structural models (EFA, CFA, SEM…).
library(psych)
model <- psych::fa(attitude, nfactors = 3)
model_parameters(model)
#> # Rotated loadings from Factor Analysis (oblimin-rotation)
#>
#> Variable | MR
Related Skills
node-connect
335.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
335.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.7kCommit, push, and open a PR
