Learn R Programming

snreg (version 1.2.0)

residuals.snreg: Residuals for snreg Objects

Description

residuals.snreg is the S3 method for extracting residuals from a fitted snreg model. Residuals may be returned either for the full data or only for the estimation sample.

Usage

# S3 method for snreg
residuals(object, esample = TRUE, ...)

Value

A numeric vector of residuals. If esample = TRUE, the vector matches the length of the original data and contains NA for non-estimation observations. If esample = FALSE, only the computed residuals are returned.

Arguments

object

an object of class "snreg", typically produced by snreg.

esample

logical. If TRUE (default), residuals are returned only for observations used in estimation (others are NA). If FALSE, the raw vector of residuals (obj$resid) is returned.

...

additional arguments (currently unused).

Details

Extract Residuals from an snreg Model

This method simply accesses the obj$resid component of a fitted "snreg" object. An informative error is produced if residuals are not available.

See Also

snsf, snreg, lm.mle, vcov.snreg, coef.snreg

Examples

Run this code
library(snreg)

data("banks07")
head(banks07)

# Translog cost function specification

spe.tl <- log(TC) ~ (log(Y1) + log(Y2) + log(W1) + log(W2))^2 +
  I(0.5 * log(Y1)^2) + I(0.5 * log(Y2)^2) +
  I(0.5 * log(W1)^2) + I(0.5 * log(W2)^2)

# Specification 1: homoskedastic noise and skewness

formSV <- NULL   # variance equation; constant variance
formSK <- NULL   # skewness equation; constant skewness

m1 <- snreg(
  formula  = spe.tl,
  data     = banks07,
  ln.var.v = formSV,
  skew.v   = formSK
)

residuals(m1)

Run the code above in your browser using DataLab