stls {truncSP} | R Documentation |
Estimation of truncated regression models using the Symmetrically Trimmed Least Squares (STLS) estimator
Description
Function for estimation of linear regression models with truncated response variables (fixed truncation point), using the STLS estimator (Powell 1986)
Usage
stls(formula, data, point = 0, direction = "left", beta = "ml",
covar = FALSE, na.action, ...)
## S4 method for signature 'stls'
print(x, digits = max(3, getOption("digits") - 3), ...)
## S4 method for signature 'stls'
summary(object, level=0.95, ...)
## S4 method for signature 'summary.stls'
print(x, digits= max(3, getOption("digits") - 3), ...)
## S4 method for signature 'stls'
coef(object,...)
## S4 method for signature 'stls'
vcov(object,...)
## S4 method for signature 'stls'
residuals(object,...)
## S4 method for signature 'stls'
fitted(object,...)
Arguments
x , object |
an object of class |
formula |
a symbolic description of the model to be estimated |
data |
an optional data frame |
point |
the value of truncation (the default is 0) |
direction |
the direction of truncation, either |
beta |
the method of determining the starting values of the regression coefficients (See Details for more information):
|
covar |
logical. Indicates whether or not the covariance matrix should be estimated. If |
na.action |
a function which indicates what should happen when the data contain |
digits |
the number of digits to be printed |
level |
the desired level of confidence, for confidence intervals provided by |
... |
additional arguments. For |
Details
Uses optim
("Nelder–Mead" method) to minimize the objective function described in Powell (1986) wrt the vector of regression coefficients in order to find the STLS estimates (see Karlsson and Lindmark 2014 for more detailed information and background). The maximum number of iterations is set at 2000, but this can be adjusted by setting control=list(maxit=...)
(for more information see the documentation for optim
).
As the starting values of the regression coefficients can have a great impact on the result of the minimization it is recommended to use one of the methods for generating these rather than supplying the values manually (unless one is confident that one has a good idea of what the starting values should be).
Value
stls
returns an object of class "stls"
.
The function summary
prints a summary of the results, including two types of confidence intervals (normal approximation and percentile method). The generic accessor functions
coef
, fitted
, residuals
and vcov
extract various useful features of the value returned by stls
An object of class "stls"
, a list with elements:
coefficients |
the named vector of coefficients |
startcoef |
the starting values of the regression coefficients used by |
value |
the value of the objective function corresponding to |
counts |
number of iterations used by |
convergence |
from |
message |
from |
residuals |
the residuals of the model |
fitted.values |
the fitted values |
df.residual |
the residual degrees of freedom |
call |
the matched call |
covariance |
if |
R |
if |
bootrepl |
if |
Author(s)
Anita Lindmark and Maria Karlsson
References
Karlsson, M., Lindmark, A. (2014) truncSP: An R Package for Estimation of Semi-Parametric Truncated Linear Regression Models, Journal of Statistical Software, 57(14), pp 1–19, http://www.jstatsoft.org/v57/i14/
Powell, J. (1986) Symmetrically Trimmed Least Squares Estimation for Tobit Models, Econometrika, 54(6), pp 1435–1460
See Also
stls.fit
, the function that does the actual fitting
qme
, for estimation of models with truncated response variables using the QME estimator
lt
, for estimation of models with truncated response variables using the LT estimator
truncreg
for estimating models with truncated response variables by maximum likelihood, assuming Gaussian errors
Examples
##Simulate a data.frame
n <- 10000
x1 <- runif(n,0,10)
x2 <- runif(n,0,10)
x3 <- runif(n,-5,5)
y <- 1-2*x1+x2+2*x3+rnorm(n,0,2)
d <- data.frame(y=y,x1=x1,x2=x2,x3=x3)
##Use a truncated subsample
dtrunc <- subset(d, y>0)
##Use stls to estimate the model
stls(y~x1+x2+x3, dtrunc, point=0, direction="left", beta="ml", covar=FALSE)
##Example using data "PM10trunc"
data(PM10trunc)
stlspm10 <-
stls(PM10~cars+temp+wind.speed+temp.diff+wind.dir+hour+day, data=PM10trunc, point=2)
summary(stlspm10)