residuals {sfaR} | R Documentation |
Extract residuals of stochastic frontier models
Description
This function returns the residuals' values from stochastic frontier models
estimated with sfacross
, sfalcmcross
, or
sfaselectioncross
.
Usage
## S3 method for class 'sfacross'
residuals(object, ...)
## S3 method for class 'sfalcmcross'
residuals(object, ...)
## S3 method for class 'sfaselectioncross'
residuals(object, ...)
Arguments
object |
A stochastic frontier model returned
by |
... |
Currently ignored. |
Value
When the object
is of class 'sfacross'
, or
'sfaselectioncross'
, residuals
returns a vector of
residuals values.
When the object
is of 'sfalcmcross'
,
residuals
returns a data frame containing the residuals values
for each latent class, where each variable ends with '_c#'
,
'#'
being the class number.
Note
The residuals values are ordered in the same way as the corresponding observations in the dataset used for the estimation.
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 SFA (cost function) truncated normal with scaling property
tl_u_ts <- 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 = 'tnormal', muhet = ~ regu, uhet = ~ regu, data = utility, S = -1,
scaling = TRUE, method = 'mla')
resid.tl_u_ts <- residuals(tl_u_ts)
head(resid.tl_u_ts)
## Using data on eighty-two countries production (GDP)
# LCM Cobb Douglas (production function) half normal distribution
cb_2c_h <- sfalcmcross(formula = ly ~ lk + ll + yr, udist = 'hnormal',
data = worldprod, S = 1)
resid.cb_2c_h <- residuals(cb_2c_h)
head(resid.cb_2c_h)
## End(Not run)