Learn R Programming

npsf (version 0.8.0)

truncreg: Parametric truncated regression for cross-sectional data

Description

truncreg performs maximum likelihood estimation of the parameters in cross-sectional truncated regression.

Usage

truncreg(formula, data, subset, 
 ll = -Inf, ul = Inf, 
 lmtol = .Machine$double.eps, maxiter = 150, 
 marg.eff = FALSE, 
 print.level = 1)

Arguments

formula

an object of class ``formula'' (or one that can be coerced to that class): a symbolic description of the model. The details of model specification are given under `Details'.

data

an optional data frame containing variables in the model. If not found in data, the variables are taken from environment (formula), typically the environment from which sf is called.

subset

an optional vector specifying a subset of observations for which technical or cost efficiencies are to be computed.

ll

scalar or one-sided formula for lower limit for left-truncation; e.g. ll = ~ 1 or ll = ~ z1.

ul

scalar or one-sided formula for upper limit for right-truncation; e.g. ul = ~ 800 or ul = ~ z1.

lmtol

numeric. Tolerance for the scaled gradient in ML optimization. Default is .Machine$double.eps.

maxiter

numeric. maximum number of iteration for maximization of the log likelihood function.

marg.eff

logical. If TRUE, unit-specific marginal effects of exogenous variables on the mean of distribution of inefficiency term are returned.

print.level

numeric. 0 - nothing is printed. 1 - optimization steps and print estimation results. 2 - detailed optimization steps and print estimation results. Default is 1.

Value

truncreg returns a list of class npsf containing the following elements:

call

call. 'truncreg.cs'.

model

character. Unevaluated call to function truncreg.

coef

numeric. Named vector of ML parameter estimates.

table

matrix. Table with results.

vcov

matrix. Estimated covariance matrix of ML estimator.

ll

numeric. Value of log-likelihood at ML estimates.

lmtol

numeric. Convergence criterion: tolerance for the scaled gradient.

LM

numeric. Value of the scaled gradient.

esttime

numeric. Estimation time.

marg.effects

data frame. Contains unit-specific marginal effects of exogenous variables.

sigma

numeric. estimate of sigma.

LL

numeric. The lower limit for left-truncation

UL

numeric. The upper limit for left-truncation

n

numeric. Number of observations (used in regression).

n.full

numeric. Number of observations (used and not used in regression).

nontruncsample

logical. Returns TRUE if the observation in user supplied data is in the estimation subsample and in non-truncated part of the sample, and FALSE otherwise.

esample

logical. Returns TRUE if the observation in user supplied data is in the estimation subsample and FALSE otherwise.

Details

truncreg performs a regression from a sample drawn from a restricted part of the population. Under the assumption that the error term of the whole population is normal, the error terms in the truncated regression model have a truncated normal distribution.

Both lower limit for left-truncation and upper limit for right-truncation can be specified simultaneously.

Models for truncreg are specified symbolically. A typical model has the form y ~ x1 + ..., where y represents the left hand side variable and {x1,...} right hand side variables.

If marg.eff = TRUE, the marginal effects are computed.

See Also

teradial, tenonradial, teradialbc, tenonradialbc, nptestrts, nptestind, sf

Examples

Run this code
# NOT RUN {
require( npsf )
 
# Female labor force participation dataset
 
data(mroz)
head(mroz)

t1 <- npsf::truncreg(hours ~ kidslt6 + kidsge6 + age*educ, 
 data = mroz, ll = 0, lmtol = 1e-16, print.level = 2)
 
# matrices also can be used
myY <- mroz$hours
myX <- cbind(mroz$kidslt6, mroz$kidsge6, mroz$age, mroz$educ, mroz$age*mroz$educ)

t1.m <- truncreg(myY ~ myX, ll = 0)

# gives identical result to `t1':
# compare summary(t1) and summary(t1.m)

# using variable for limits is admissible
# we obtain the same result as before

mroz$myll <- 0
t11 <- npsf::truncreg(hours ~ kidslt6 + kidsge6 + age*educ, 
 data = mroz, ll = ~ myll, lmtol = 1e-16, print.level = 0)
summary(t11)

# if you believe that the sample is additionally truncted from above at say 3500

t12 <- update(t1, ul = 3500, print.level = 1)

# for obtaining marginal effects

t13 <- update(t12, marg.eff = TRUE)

summary(t13$marg.effects)

# }

Run the code above in your browser using DataLab