Describe and understand your model’s parameters!

parameters’ primary goal is to provide utilities for processing the parameters of various statistical 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).

Installation

Run the following:

install.packages("parameters")
library("parameters")

Documentation

Documentation Blog Features

Click on the buttons above to access the package documentation and the easystats blog, and check-out these vignettes:

Features

Model’s parameters description

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 |  df |      p
# ------------------------------------------------------------------------------------------------
# (Intercept)                         |        2.89 | 0.36 | [ 2.18,  3.60] |  8.01 | 143 | < .001
# Petal.Length                        |        0.26 | 0.25 | [-0.22,  0.75] |  1.07 | 143 | 0.287 
# Species [versicolor]                |       -1.66 | 0.53 | [-2.71, -0.62] | -3.14 | 143 | 0.002 
# Species [virginica]                 |       -1.92 | 0.59 | [-3.08, -0.76] | -3.28 | 143 | 0.001 
# Petal.Width                         |        0.62 | 0.14 | [ 0.34,  0.89] |  4.41 | 143 | < .001
# Petal.Length * Species [versicolor] |       -0.09 | 0.26 | [-0.61,  0.42] | -0.36 | 143 | 0.721 
# Petal.Length * Species [virginica]  |       -0.13 | 0.26 | [-0.64,  0.38] | -0.50 | 143 | 0.618

# standardized parameters
model_parameters(model, standardize = "refit")
# Parameter                           | Coefficient (std.) |   SE |         95% CI |     t |  df |      p
# -------------------------------------------------------------------------------------------------------
# (Intercept)                         |               3.59 | 1.30 | [ 1.01,  6.17] |  8.01 | 143 | 0.007 
# Petal.Length                        |               1.07 | 1.00 | [-0.91,  3.04] |  1.07 | 143 | 0.287 
# Species [versicolor]                |              -4.62 | 1.31 | [-7.21, -2.03] | -3.14 | 143 | < .001
# Species [virginica]                 |              -5.51 | 1.38 | [-8.23, -2.79] | -3.28 | 143 | < .001
# Petal.Width                         |               1.08 | 0.24 | [ 0.59,  1.56] |  4.41 | 143 | < .001
# Petal.Length * Species [versicolor] |              -0.38 | 1.06 | [-2.48,  1.72] | -0.36 | 143 | 0.721 
# Petal.Length * Species [virginica]  |              -0.52 | 1.04 | [-2.58,  1.54] | -0.50 | 143 | 0.618

Variable and parameters selection

parameters_selection() can help you quickly select and retain the most relevant predictors using methods tailored for the model type.

This function also works for mixed or Bayesian models:

Miscellaneous

This packages also contains a lot of other useful functions:

Describe a Distribution

Mean SD Min Max Skewness Kurtosis n n_Missing
-0.1 1 -3 3 0 -0.3 300 0