nParam: Number of model parameters

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/nParam.R

Description

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

Usage

1
2
3
4
5
nParam(x, free=FALSE, ...)
## Default S3 method:
nParam(x, ...)
## S3 method for class 'lm'
nParam(x, ...)

Arguments

x

a statistical model

free

logical, whether to report only the free parameters or the total number of parameters (default)

...

other arguments for methods

Details

Free parameters are the parameters with no equality restrictions. Some parameters may be restricted (e.g. sum of two probabilities may be restricted to equal unity). In this case the total number of parameters may depend on the normalisation.

Value

Number of parameters in the model

Author(s)

Ott Toomet, otoomet@econ.au.dk

See Also

nObs for number of observations

Examples

1
2
3
4
5
6
7
# 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

miscTools documentation built on Dec. 9, 2019, 3 a.m.

Related to nParam in miscTools...