Learn R Programming

micEcon (version 0.4-0)

nParam: Number of model parameters

Description

This function returns the number of model parameters. The default method returns the component x$param$nParam.

Usage

nParam(x, ...)
## S3 method for class 'default':
nParam(x, \dots)
## S3 method for class 'lm':
nParam(x, \dots)

Arguments

x
a statistical model
...
other arguments for methods

Value

  • Number of parameters in the model

Details

Not all parameters need to be free nor independent. The number may depend on the normalisation.

See Also

nObs for number of observations

Examples

Run this code
# Construct a simple OLS regression:
x1 <- runif(100)
x2 <- runif(100)
y <- 3 + 4*x1 + 5*x2 + rnorm(100)
m <- lm(y~x1+x2)  # estimate it
summary(m)
nParam(m) # you get 3

Run the code above in your browser using DataLab