nobs: Extract total number of observations used in frontier models

nobsR Documentation

Extract total number of observations used in frontier models

Description

This function extracts the total number of 'observations' from a fitted frontier model.

Usage

## S3 method for class 'sfacross'
nobs(object, ...)

## S3 method for class 'sfalcmcross'
nobs(object, ...)

## S3 method for class 'sfaselectioncross'
nobs(object, ...)

Arguments

object

a sfacross, sfalcmcross, or sfaselectioncross object for which the number of total observations is to be extracted.

...

Currently ignored.

Details

nobs gives the number of observations actually used by the estimation procedure. It is not necessarily the number of observations of the model frame (number of rows in the model frame), because sometimes the model frame is further reduced by the estimation procedure especially in the presence of NA. In the case of sfaselectioncross, nobs returns the number of observations used in the frontier equation.

Value

A single number, normally an integer.

See Also

sfacross, for the stochastic frontier analysis model fitting function using cross-sectional or pooled data.

sfalcmcross, for the latent class stochastic frontier analysis model fitting function using cross-sectional or pooled data.

sfaselectioncross for sample selection in stochastic frontier model fitting function using cross-sectional or pooled data.

Examples


## Not run: 
## Using data on fossil fuel fired steam electric power generation plants in the U.S.
# Translog (cost function) half normal with heteroscedasticity
tl_u_h <- sfacross(formula = log(tc/wf) ~ log(y) + I(1/2 * (log(y))^2) +
log(wl/wf) + log(wk/wf) + I(1/2 * (log(wl/wf))^2) + I(1/2 * (log(wk/wf))^2) +
I(log(wl/wf) * log(wk/wf)) + I(log(y) * log(wl/wf)) + I(log(y) * log(wk/wf)),
udist = 'hnormal', uhet = ~ regu, data = utility, S = -1, method = 'bfgs')
nobs(tl_u_h)

## End(Not run)


sfaR documentation built on Oct. 29, 2024, 9:07 a.m.