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

  • 1
    $\begingroup$ You might want to take a look at the heckit() and selection() functions from the sampleSelection package. See link $\endgroup$
    – Harrison Jones
    Commented Aug 8, 2013 at 14:58
  • $\begingroup$ 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. $\endgroup$
    – RoyalTS
    Commented Aug 9, 2013 at 9:49
  • $\begingroup$ 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. $\endgroup$
    – user25658
    Commented Sep 9, 2013 at 18:07

1 Answer 1


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:


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)

reduced.form <- lm(x~z)

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

# 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))

boot.results <- boot(data=my.data,statistic=tobit_2siv_coef,R=100)
  • 1
    $\begingroup$ 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. $\endgroup$ Commented Feb 6, 2014 at 21:46
  • 2
    $\begingroup$ @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." $\endgroup$
    – Bill
    Commented Feb 7, 2014 at 17:50
  • 2
    $\begingroup$ 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. $\endgroup$
    – Bill
    Commented Feb 7, 2014 at 17:50
  • $\begingroup$ @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? $\endgroup$
    – Tom
    Commented Jan 12, 2021 at 17:01
  • 1
    $\begingroup$ @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. $\endgroup$
    – Bill
    Commented Apr 11, 2021 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.