truncSP (version 1.2.2)

lt: Estimation of truncated regression models using the Left Truncated (LT) estimator

Description

Estimates linear regression models with truncated response variables (fixed truncation point), using the LT estimator (Karlsson 2006).

Usage

lt(formula, data, point = 0, direction = "left", clower = "ml", const = 1, cupper = 2,
   beta = "ml", covar = FALSE, na.action, ...)
## S3 method for class 'lt':
print(x, digits = max(3, getOption("digits") - 3), ...)
## S3 method for class 'lt':
summary(object, level=0.95, ...)
## S3 method for class 'summary.lt':
print(x, digits= max(3, getOption("digits") - 3), ...)
## S3 method for class 'lt':
coef(object,...)
## S3 method for class 'lt':
vcov(object,...)
## S3 method for class 'lt':
residuals(object,...)
## S3 method for class 'lt':
fitted(object,...)

Arguments

x, object
an object of class "lt"
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 "left" (the default) or "right"
clower
the lower threshold value to be used when trimming the conditional density of the errors from below. The default is "ml" meaning that the residual standard deviation from fitting a maximum likelihood model for truncated regression, using
const
a number that can be used to alter the size of the lower threshold. const=0.5 would give a lower threshold value that is half the original size. The default value is 1.
cupper
number indicating what upper threshold to use when trimming the conditional density of the errors from above. The number is used to multiply the lower threshold value, i.e. if cupper=2 (the default value) the upper threshold value is two time
beta
the method of determining the starting values of the regression coefficients (See Details for more information):
  • The default method is"ml", meaning that the estimated regression coefficients from fitting a maximum likelihood model fo
covar
logical. Indicates whether or not the covariance matrix should be estimated. If TRUE the covariance matrix is estimated using bootstrap. The default number of replicates is 2000 but this can be adjusted (see argument ...). Howeve
na.action
a function which indicates what should happen when the data contain NAs.
digits
the number of digits to be printed
level
the desired level of confidence, for confidence intervals provided by summary.lt. A number between 0 and 1. The default value is 0.95.
...
additional arguments. For lt the number of bootstrap replicates can be adjusted by setting R=the desired number of replicates. Also the control argument of optim can be

Value

  • lt returns an object of class "lt". 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 lt An object of class "lt", a list with elements:
  • coefficientsthe named vector of coefficients
  • startcoefthe starting values of the regression coefficients used by optim
  • cvaluesinformation about the thresholds used. The method and constant used and the resulting lower and upper threshold values.
  • valuethe value of the objective function corresponding to coefficients
  • countsnumber of iterations used by optim. See the documentation for optim for further details
  • convergencefrom optim. An integer code. 0 indicates successful completion. Possible error codes are 1 indicating that the iteration limit maxit had been reached. 10 indicating degeneracy of the Nelder--Mead simplex.
  • messagefrom optim. A character string giving any additional information returned by the optimizer, or NULL.
  • residualsthe residuals of the model
  • fitted.valuesthe fitted values
  • df.residualthe residual degrees of freedom
  • callthe matched call
  • covarianceif covar=TRUE, the estimated covariance matrix
  • Rif covar=TRUE, the number of bootstrap replicates
  • bootreplif covar=TRUE, the bootstrap replicates

Details

Minimizes the objective function described in Karlsson (2006) wrt the vector of regression coefficients, in order to find the LT estimates. The minimization is performed by optim using the "Nelder--Mead" method, and a maximum number of iterations of 2000. The maximum number of iterations can be adjusted by setting control=list(maxit=...) (for more information see the documentation for optim). It is recommended to use one of the methods for generating the starting values of the regression coefficients (see argument beta) rather than supplying these manually, unless one is confident that one has a good idea of what these should be. This because the starting values can have a great impact on the result of the minimization. Note that setting cupper=1 means that the LT estimates will coincide with the estimates from the Quadratic Mode Estimator (see function qme). For more detailed information see Karlsson and Lindmark (2014).

References

Karlsson, M. (2006) Estimators of regression parameters for truncated and censored data, Metrika, 63, pp 329--341 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/

See Also

lt.fit, the function that does the actual fitting qme, for estimation of models with truncated response variables using the QME estimator stls, for estimation of models with truncated response variables using the STLS estimator truncreg for estimating models with truncated response variables by maximum likelihood, assuming Gaussian errors

Examples

Run this code
##Simulate a data.frame (model with asymmetrically distributed errors)
n <- 10000
x1 <- runif(n,0,10)
x2 <- runif(n,0,10)
x3 <- runif(n,-5,5)
eps <- rexp(n,0.2)- 5
y <- 2-2*x1+x2+2*x3+eps
d <- data.frame(y=y,x1=x1,x2=x2,x3=x3)


##Use a truncated subsample
dtrunc <- subset(d, y>0)

##Use lt to consistently estimate the slope parameters
lt(y~x1+x2+x3, dtrunc, point=0, direction="left", clower="ml", const=1, 
   cupper=2, beta="ml", covar=FALSE)
   
##Example using data "PM10trunc"
data(PM10trunc)

ltpm10 <- lt(PM10~cars+temp+wind.speed+temp.diff+wind.dir+hour+day, 
   data=PM10trunc, point=2, control=list(maxit=2500))

summary(ltpm10)

Run the code above in your browser using DataCamp Workspace