Learn R Programming

micEcon (version 0.4-0)

nObs: Return number of observations for statistical models

Description

Returns number of observations for statistical models. The default method assumes presence of a component $param$nObs in {x}.

Usage

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

Arguments

x
a statistical model, such as created by lm
...
further arguments for methods

Value

  • numeric, number of observations

Details

This is a generic function. The default method returns the component x$param$nObs. The lm-method is based on qr-decomposition, in the same way as the does summary.lm.

See Also

nParam

Examples

Run this code
## Do a trivial probit example and find number of observations
x <- runif(100)
y <- x + rnorm(100) > 0
p <- probit(y ~ x)
nObs(p)

Run the code above in your browser using DataLab