Built using Zelig version r packageVersion("Zelig")

knitr::opts_knit$set(
    stop_on_error = 2L
)
knitr::opts_chunk$set(
    fig.height = 11,
    fig.width = 7
)

options(cite = FALSE)

Linear Regression for a Left-Censored Dependent Variable with tobit.

Tobit regression estimates a linear regression model for a left-censored dependent variable, where the dependent variable is censored from below. While the classical tobit model has values censored at 0, you may select another censoring point. For other linear regression models with fully observed dependent variables, see Bayesian regression, maximum likelihood normal regression, and least squares.

Syntax

z.out <- zelig(Y ~ X1 + X2, below = 0, above = Inf, model = "tobit", weights = w, data = mydata)
x.out <- setx(z.out)
s.out <- sim(z.out, x = x.out)

Inputs

zelig() accepts the following arguments to specify how the dependent variable is censored.

z.out <- zelig(y ~ x1 + x2, robust = TRUE, cluster = "x3",
                        model = "tobit", data = mydata)

means that the observations can be correlated within the strata defined by the variable x3, and that robust standard errors should be calculated according to those clusters. If robust = TRUE but cluster is not specified, zelig() assumes that each observation falls into its own cluster.

Zelig users may wish to refer to help(survreg) for more information.

Examples

rm(list=ls(pattern="\\.out"))
suppressWarnings(suppressMessages(library(Zelig)))
set.seed(1234)

Basic Example

Attaching the sample dataset:

data(tobin)

Estimating linear regression using tobit:

z.out <- zelig(durable ~ age + quant, model = "tobit", data = tobin)

Summarize estimated paramters:

summary(z.out)

Setting values for the explanatory variables to their sample averages:

x.out <- setx(z.out)

Simulating quantities of interest from the posterior distribution given x.out.

s.out1 <- sim(z.out, x = x.out)
summary(s.out1)

Simulating First Differences

Set explanatory variables to their default(mean/mode) values, with high (80th percentile) and low (20th percentile) liquidity ratio (quant):

x.high <- setx(z.out, quant = quantile(tobin$quant, prob = 0.8))
x.low <- setx(z.out, quant = quantile(tobin$quant, prob = 0.2))

Estimating the first difference for the effect of high versus low liquidity ratio on duration(\ durable):

s.out2 <- sim(z.out, x = x.high, x1 = x.low)
summary(s.out2)
plot(s.out1)

Model

$$ \begin{aligned} Y_i^* & \sim & \textrm{Normal}(\mu_i, \sigma^2) \\end{aligned} $$

where $\mu_i$ is a vector means and $\sigma^2$ is a scalar variance parameter. $Y_i^*$ is not directly observed, however. Rather we observed $Y_i$ which is defined as:

$$ Y_i = \left{ \begin{array}{lcl} Y_i^ &\textrm{if} & c <Y_i^ \ c &\textrm{if} & c \ge Y_i^* \end{array}\right. $$

where $c$ is the lower bound below which $Y_i^*$ is censored.

$$ \begin{aligned} \mu_{i} &=& x_{i} \beta,\end{aligned} $$

where $x_{i}$ is the vector of $k$ explanatory variables for observation $i$ and $\beta$ is the vector of coefficients.

Quantities of Interest

$$ E(Y^* | X) = \mu_{i} = x_{i} \beta $$

$$ \begin{aligned} \text{FD}=E(Y^ \mid x_{1}) - E(Y^ \mid x).\end{aligned} $$

$$ \begin{aligned} \frac{1}{\sum t_{i}}\sum_{i:t_{i}=1}[E[Y^{i}(t{i}=1)]-E[Y^{i}(t{i}=0)]],\end{aligned} $$

where $t_{i}$ is a binary explanatory variable defining the treatment ($t_{i}=1$) and control ($t_{i}=0$) groups.

Output Values

The Zelig object stores fields containing everything needed to rerun the Zelig output, and all the results and simulations as they are generated. In addition to the summary commands demonstrated above, some simply utility functions (known as getters) provide easy access to the raw fields most commonly of use for further investigation.

In the example above z.out$get_coef() returns the estimated coefficients, z.out$get_vcov() returns the estimated covariance matrix, and z.out$get_predict() provides predicted values for all observations in the dataset from the analysis.

See also

The tobit function is part of the survival package by Terry Therneau, ported to R by Thomas Lumley. Advanced users may wish to refer to help(tobit) in the AER package.

z5 <- ztobit$new()
z5$references()


IQSS/Zelig documentation built on Dec. 11, 2023, 1:51 a.m.