qme: Estimation of truncated regression models using the Quadratic...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/qme.R

Description

Estimation of linear regression models with truncated response variables (fixed truncation point), using the Quadratic Mode Estimator (QME) (Lee 1993 and Laitila 2001)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
qme(formula, data, point = 0, direction = "left", cval = "ml", 
  const = 1, beta = "ml", covar = FALSE, na.action, ...)
## S4 method for signature 'qme'
print(x, digits = max(3, getOption("digits") - 3), ...)
## S4 method for signature 'qme'
summary(object, level=0.95, ...)
## S4 method for signature 'summary.qme'
print(x, digits = max(3, getOption("digits") - 3), ...)
## S4 method for signature 'qme'
coef(object,...)
## S4 method for signature 'qme'
vcov(object,...)
## S4 method for signature 'qme'
residuals(object,...)
## S4 method for signature 'qme'
fitted(object,...)

Arguments

x, object

an object of class "qme"

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"

cval

the threshold value to be used when trimming the conditional density of the errors. The default is "ml" meaning that the estimated residual standard deviation from a maximum likelihood model for truncated regression, fitted using truncreg, is used. Method "ols" uses the residual standard deviation from fitting a linear model using lm. It is also possible to manually supply the threshold by setting cval to be equal to a number or numeric vector of length one.

const

a number that can be used to alter the size of the threshold value. const=0.5 would give a threshold value that is half the original size. The default value is 1.

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 for truncated regression, assuming Gaussian errors, are used. The maximum likelihood model is fitted using truncreg.

  • Method "ols" means that the estimated regression coefficients from fitting a linear model with lm are used.

  • The third option is to manually provide starting values as either a vector, column matrix or row matrix.

covar

logical. Indicates whether or not the covariance matrix should be estimated. If TRUE the covariance matrix is estimated using bootstrap, as described in Karlsson (2004). The default number of replicates is 2000 but this can be adjusted (see argument ...). However, since the bootstrap procedure is time-consuming the default is covar=FALSE.

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.qme. A number between 0 and 1. The default value is 0.95.

...

additional arguments. For qme the number of bootstrap replicates can be adjusted by setting R=the desired number of replicates. Also the control argument of optim can be set by control=list() (for more information on this see Details).

Details

Finds the QME estimates of the regression coefficients by maximizing the objective function described in Lee (1993) wrt the vector of regression coefficients. The maximization is performed by optim using the "Nelder–Mead" method. 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).

The starting values of the regression coefficients can have a great impact on the result of the maximization. For this reason 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. For more detailed information see Karlsson and Lindmark (2014).

Value

qme returns an object of class "qme".

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 qme

An object of class "qme", a list with elements:

coefficients

the named vector of coefficients

startcoef

the starting values of the regression coefficients used by optim

cval

information about the threshold value used. The method and constant value used and the resulting threshold value.

value

the value of the objective function corresponding to coefficients

counts

number of iterations used by optim. See the documentation for optim for further details

convergence

from 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.

message

from optim. A character string giving any additional information returned by the optimizer, or NULL.

residuals

the residuals of the model

fitted.values

the fitted values

df.residual

the residual degrees of freedom

call

the matched call

covariance

if covar=TRUE, the estimated covariance matrix

R

if covar=TRUE, the number of bootstrap replicates

bootrepl

if covar=TRUE, the bootstrap replicates

Author(s)

Anita Lindmark and Maria Karlsson

References

Karlsson, M. (2004) Finite sample properties of the QME, Communications in Statistics - Simulation and Computation, 5, pp 567–583

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/

Laitila, T. (2001) Properties of the QME under asymmetrically distributed disturbances, Statistics & Probability Letters, 52, pp 347–352

Lee, M. (1993) Quadratic mode regression, Journal of Econometrics, 57, pp 1-19

Lee, M. & Kim, H. (1998) Semiparametric econometric estimators for a truncated regression model: a review with an extension, Statistica Neerlandica, 52(2), pp 200–225

See Also

qme.fit, the function that does the actual fitting

lt, for estimation of models with truncated response variables using the LT 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##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 qme to consistently estimate the slope parameters
qme(y~x1+x2+x3, dtrunc, point=0, direction="left", cval="ml", const=1, 
   beta="ml", covar=FALSE)
   
##Example using data "PM10trunc"
data(PM10trunc)

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

summary(qmepm10)

truncSP documentation built on May 1, 2019, 8:46 p.m.