n_parameters {insight} | R Documentation |
Count number of parameters in a model
Description
Returns the number of parameters (coefficients) of a model.
Usage
n_parameters(x, ...)
## Default S3 method:
n_parameters(x, remove_nonestimable = FALSE, ...)
## S3 method for class 'merMod'
n_parameters(x, effects = "fixed", remove_nonestimable = FALSE, ...)
## S3 method for class 'glmmTMB'
n_parameters(
x,
effects = "fixed",
component = "all",
remove_nonestimable = FALSE,
...
)
Arguments
x |
A statistical model. |
... |
Arguments passed to or from other methods. |
remove_nonestimable |
Logical, if |
effects |
Should variables for fixed effects ( |
component |
Which type of parameters to return, such as parameters for the conditional model, the zero-inflated part of the model, the dispersion term, the instrumental variables or marginal effects be returned? Applies to models with zero-inflated and/or dispersion formula, or to models with instrumental variables (so called fixed-effects regressions), or models with marginal effects (from mfx). See details in section Model Components .May be abbreviated. Note that the conditional component also refers to the count or mean component - names may differ, depending on the modeling package. There are three convenient shortcuts (not applicable to all model classes):
|
Value
The number of parameters in the model.
Note
This function returns the number of parameters for the fixed effects by
default, as returned by find_parameters(x, effects = "fixed")
. It does not
include all estimated model parameters, i.e. auxiliary parameters like
sigma or dispersion are not counted. To get the number of all estimated
parameters, use get_df(x, type = "model")
.
Examples
data(iris)
model <- lm(Sepal.Length ~ Sepal.Width * Species, data = iris)
n_parameters(model)