# Instrumental variable Tobit in R

I have a data generating process of the form:

res1 <- rnorm(N);
res2 <- res1*0.5 + rnorm(N)
x    <-  z[,1]*2 + res1;
ys   <- x*b + res2;
d    <- (ys>0); #dummy variable
y    <- d*ys;


(blatantly stolen from an old RHelp thread, where the question remained unanswered back in 2006)

That is, my independent variable x is endogenous but there's an exogenous instrument z, and my dependent variable y is censored below at zero.

Are there any ways I can consistently estimate this model in R? What I'm looking for is essentially an instrumental variable Tobit (as implemented in Stata's ivtobit command).

• You might want to take a look at the heckit() and selection() functions from the sampleSelection package. See link
– Harrison Jones
Aug 8, 2013 at 14:58
• Thanks. But unless I'm missing something the sampleSelection package will only let me estimate Tobit-2 and Tobit-5 models whereas what I want is a Tobit-1. Aug 9, 2013 at 9:49
• I came across this: ats.ucla.edu/stat/r/dae/tobit.htm It appears that the R package VGAM should allow you to do it.
– user25658
Sep 9, 2013 at 18:07

You ask for two things in the question. First you ask for a way to consistently estimate this model in R. Second, you ask for the particular ways implemented in Stata's ivtobit (these ways are full-information maximum likelihood and the Newey, 1987 two-step estimator). Doing the second would be a nice service for the R community which I don't have time to do. It seems strange that nobody has done it, though. However, I can help you with the first.

There are several ways to get a consistent estimator for the model. Here is an easy and intuitive way, based on the estimator of Rivers and Vuong (J of Econometrics, 1988). The steps in the estimator are:

1. Estimate the reduced form for the endogenous variable (i.e. regress x on z in your notation)
2. Collect the predicted values and the residuals from that regression
3. Use Tobit to estimate the equation of interest, substituting predicted endogenous variables for endogenous variables and including the residuals collected in 2 (i.e. regress y on x-predicted and residuals using Tobit)

The coefficient on the predicted x is the estimator of the coefficient of interest.

The usual standard errors are wrong --- that is, the standard errors Tobit spits out in step 3 are not the right standard errors. This is because the Tobit routine does not "know" that the variables you are handing it are fitted variables instead of exact variables. You could react to this by "doing it right:" looking up the formula for the variance matrix and then implementing it (booooring). Or you could just bootstrap. I favor the latter. It is easier, and if you are really going to "do it right," then you would not use this estimator anyway, since it is not efficient. Rather, you would actually implement the Newey (1987) estimator or maximum likelihood.

If you have additional right-hand-side variables which are exogenous, just include them along the way in all the commands (both in the tobit and in the reduced form regression). If you have additional right-hand-side variables which are endogenous, then you treat them like the first endogenous RHS variable. Run reduced form regressions for each of the endogenous variables. Include predicted values and residuals in the tobit at the end for each endogenous variable. As with any proper correction for endogeneity, you have to have as many excluded exogenous variables as you have included endogenous variables for this all to work.

The code below implements both the estimator and the bootstrapped standard errors for the simple example you gave. I also fixed up the example so that it should work turn-key:

require(censReg)
require(boot)

a    <- 2    # structural parameter of interest
b    <- 1    # strength of instrument
rho  <- 0.5  # degree of endogeneity

N    <- 1000
z    <- rnorm(N)
res1 <- rnorm(N)
res2 <- res1*rho + sqrt(1-rho*rho)*rnorm(N)
x    <- z*b + res1
ys   <- x*a + res2
d    <- (ys>0) #dummy variable
y    <- d*ys

inconsistent.tobit <- censReg(y~x)
summary(inconsistent.tobit)

reduced.form <- lm(x~z)
summary(reduced.form)

consistent.tobit <- censReg(y~fitted(reduced.form)+residuals(reduced.form))
summary(consistent.tobit)

# I'd like bootstrapped standard errors, please!
my.data <- data.frame(y,x,z)
tobit_2siv_coef <- function(data,indices){
d <- data[indices,]
reduced.form <- lm(x~z,data=d)
consistent.tobit <- censReg(d[,"y"]~fitted(reduced.form)+residuals(reduced.form))
return(summary(consistent.tobit)\$estimate["fitted(reduced.form)",1])
}

boot.results <- boot(data=my.data,statistic=tobit_2siv_coef,R=100)
boot.results

• Do you have an intuition on why to include the first stage residuals in the second stage? I thought these residuals include the endogenous portion of x, which correlates with the second stage residual. Thanks. Feb 6, 2014 at 21:46
• @RichardHerron Yes, this is called a control function approach. The residual is there to "control for" the endogeneity in the error term. The assumption that makes it work is that the conditional expectation of the error term in the Tobit (conditional on z and first equation error) is linear in first equation error. That's true in the setup of this problem, and it is often true in the way problems like this are set up. So the error term once we include the residual from the first equation is a different error term---it has had the endogeneity "sucked out."
– Bill
Feb 7, 2014 at 17:50
• Also interesting is that it does not matter whether we use fitted x or actual x in the Tobit equation. We get exactly identical results either way.
– Bill
Feb 7, 2014 at 17:50
• @Bill Hello Bill, I know this is a very old answer. But in case you read this anyway: I have been trying to adapt your answer to one where I can bootstrap using the model with the variables written out and also tried (and failed) to do this: "If you have additional right-hand-side variables which are exogenous, just include them along the way in all the commands (both in the tobit and in the reduced form regression). If you have additional right-hand-side variables which are endogenous, then you treat them like the first endogenous RHS variable." Any chance you would want to write that out?
– Tom
Jan 12, 2021 at 17:01
• @Tom Hi, it does not make a difference whether you use fitted or actual values. In the above code, if you add a line like "consistent.tobit2 <- censReg(y~x+residuals(reduced.form))" and an associated summary() for it, you will see that you get literally the same answer. I think this always (almost always?) happens in control function approaches, though I have not had my head fully inside this in a little while. Best, Bill.
– Bill
Apr 11, 2021 at 19:14