Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generalised residuals from tobit model left-censored at 1

    Based on Wooldridge (2014, p.231) I calculate the generalised residuals for a tobit model as follows in Stata:

    gen GR = -sigma * (y == 0) * normalden(-fitted)/normal(-fitted) + (y > 0) * (y - fitted)
    (with 'y' the truncated variable and 'fitted' the predictions derived from postestimation)

    My question is: if the model is left-censored at 1 instead of 0, do we need to replace the y == 0 and y > 0 in the formula with y == 1 and y > 1? Or does the formula for the generalised residuals remain the same, irrespective of the censoring?

    Paper to which I refer:
    Wooldridge, J. M. (2014). Quasi-maximum likelihood estimation and testing for nonlinear models with endogenous explanatory variables. Journal of Econometrics, 182(1), 226-234. https://doi.org/https://doi.org/10.1...om.2014.04.020

  • #2
    Just let Stata generate the generalized residuals for you.

    Code:
    tobit ...
    predict gres1 gres1se, scores
    In any case, you have \(\text{-fitted}\) because you assume that the lower censoring limit is at 0. Otherwise, it should be \(\text{lower limit - fitted}\).

    Code:
    webuse mroz87, clear
    tobit whrs75 nwinc wedyrs wexper c.wexper#c.wexper wifeage kl6 k618, ll(0)
    *STATA'S COMPUTATION
    predict double gres1 gres1sc, scores
    
    *BY HAND
    predict fitted, xb
    gen lambda= normalden((0-fitted)/_b[/var(e.whrs75)])/normal((0-fitted)/_b[/var(e.whrs75)])
    gen double gres2= cond(whrs75>0, (whrs75-fitted)/_b[/var(e.whrs75)], -lambda)
    Res.:

    Code:
    . l gres1 gres2 in 1/10, sep(0)
    
         +-------------------------+
         |      gres1        gres2 |
         |-------------------------|
      1. |  .00073997    .00073997 |
      2. |  .00075318    .00075318 |
      3. |  .00114851    .00114851 |
      4. | -.00019141   -.00019141 |
      5. |  .00113925    .00113925 |
      6. |  .00064512    .00064512 |
      7. |  .00007054    .00007054 |
      8. | -.00015908   -.00015908 |
      9. |   .0001887     .0001887 |
     10. | -4.491e-06   -4.491e-06 |
         +-------------------------+
    Last edited by Andrew Musau; 24 Oct 2023, 07:53.

    Comment


    • #3
      This makes a lot of sense. Thank you!

      Comment


      • #4
        Dear Statalists,
        Could you please confirm whether the Stata steps below implement the control-function approach (CFA) correctly? I am applying a control-function approach (CFA) in my study. My outcome is a continuous variable Y (farm-level sustainability indicator (ISAP) with range score −15 to +30), and my endogenous regressor is a bounded index D with a lower bound (left-censoring) at 1. I therefore estimate a Tobit first stage with left-censoring at 1. Following Wooldridge (2014, 2015), I obtain the generalized residual and include it in the second stage.

        1st stage (Tobit, ll(1)):
        tobit D IV Xvars, ll(1)
        predict gres1 gres1se, scores

        2nd stage
        gen D_GR = D*gres1
        reg Y D Xvars gres1 D_GR, vce(robust)

        Any guidance would be greatly appreciated. Many thanks. BR, M

        Comment


        • #5
          Marlen Tynaliev, please post your question in a new thread - specifically asking about control-function approach for Tobit. #2 was posted in 2023. Looking at it now, I notice that the scores calculated by hand for censored observations are not correct because I neglected to divide the inverse Mills ratio by the standard deviation. For a Tobit model with lower limit \(0\), the score contributions for observation \(i\) are:

          \[
          s_i =
          \begin{cases}
          \dfrac{y_i - x_i \beta}{\sigma^2} \, x_i, & y_i > 0 \quad \text{(uncensored)} \\[2mm]
          - \dfrac{\phi\Big(\frac{0 - x_i \beta}{\sigma}\Big)}{\Phi\Big(\frac{0 - x_i \beta}{\sigma}\Big)} \cdot \dfrac{1}{\sigma} \, x_i, & y_i = 0 \quad \text{(censored)}
          \end{cases}
          \]

          where:
          • \(\phi(\cdot)\) is the standard normal density,
          • \(\Phi(\cdot)\) is the standard normal cumulative distribution, and
          • \(\sigma = \sqrt{\text{Var}(\varepsilon_i)}\) is the standard deviation of the latent error term.
          The scores for the first 10 observations shown in #2 correspond to uncensored observations, and these are correct. Here is a corrected version for anyone interested in this thread (changes are highlighted).


          Code:
          webuse mroz87, clear
          tobit whrs75 nwinc wedyrs wexper c.wexper#c.wexper wifeage kl6 k618, ll(0)
          
          *STATA'S COMPUTATION
          predict double gres1 gres1sc, scores
          
          *BY HAND
          predict fitted, xb
          gen double sigma = sqrt(_b[/var(e.whrs75)])
          gen double lambda = normalden((0 - fitted)/sigma) / normal((0 - fitted)/sigma)
          gen double gres2 = cond(whrs75>0, (whrs75 - fitted)/(_b[/var(e.whrs75)]), -lambda/sigma)
          
          *COMPARE
          sum gres1 gres2
          Res.:

          Code:
          . *COMPARE
          
          . 
          . sum gres1 gres2
          
              Variable |        Obs        Mean    Std. dev.       Min        Max
          -------------+---------------------------------------------------------
                 gres1 |        753   -4.06e-10    .0008066  -.0016572   .0031005
                 gres2 |        753   -4.06e-10    .0008066  -.0016572   .0031005
          
          .

          Comment


          • #6
            Perfect. Thank you for your prompt and detailed response!

            Comment

            Working...
            X