Announcement

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

  • Marginal effects with a heteroskedastic tobit

    Dear all,

    I am struggling to compute the average marginal effects using a Tobit allowing for heteroskedasticity. Any suggestions on this will be highly appreciated.

    My dependent variable is a continuous variable that takes nonnegative values only when observations in my data violated some economic assumptions. Otherwise, it is zero (54% of the sample). This variable measures the amount of budget that can be extracted from an individual who violated those assumptions. Hence, I think a Tobit model would be suitable.

    I conducted a Likelihood-ratio test, which rejected the null of homoskedasticity.

    Therefore, I am running the following heteroskedastic Tobit:

    Code:
    capture program drop het_tob
    program define het_tob
       qui {
        args lnf XB WA
        replace `lnf' = -0.5*(ln(2*_pi)+ln(exp(`WA')^2)+(($ML_y1-`XB')^2/exp(`WA')^2)) if $ML_y1>0 & $ML_y1!=.
        replace `lnf' = ln(1-normprob(`XB'/exp(`WA'))) if $ML_y1<=0
        }
        end
    
    ml model lf het_tob (Tobit: MPImax = crtstd age_years age2) (Tobhet: crtstd age_years age2), title(Tobit with Heteroscedasticity)
    
    ml maximize,  difficult nolog
    
    Tobit with Heteroscedasticity                   Number of obs     =        205
                                                    Wald chi2(3)      =      11.79
    Log likelihood = -64.449366                     Prob > chi2       =     0.0081
    
    ------------------------------------------------------------------------------
          MPImax |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    Tobit        |
          crtstd |  -.0448083    .021168    -2.12   0.034    -.0862968   -.0033199
       age_years |  -.0160767   .0066348    -2.42   0.015    -.0290807   -.0030726
            age2 |   .0002018   .0000952     2.12   0.034     .0000153    .0003883
           _cons |   .2392886   .1001342     2.39   0.017     .0430292    .4355481
    -------------+----------------------------------------------------------------
    Tobhet       |
          crtstd |   .1956093   .0843663     2.32   0.020     .0302543    .3609642
       age_years |   .0084042    .025229     0.33   0.739    -.0410436    .0578521
            age2 |    .000042   .0003784     0.11   0.912    -.0006997    .0007838
           _cons |  -1.757924   .3580635    -4.91   0.000    -2.459716   -1.056133
    ------------------------------------------------------------------------------
    I would like to compute the average marginal effects of the variable "crtstd" and its significance. I think I am missing some relevant option while using the margins command since once I ran it I obtained the estimated coefficient of "crtstd":

    Code:
    margins, dydx(crtstd)
    
    Average marginal effects                        Number of obs     =        205
    Model VCE    : OIM
    
    Expression   : Linear prediction, predict()
    dy/dx w.r.t. : crtstd
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          crtstd |  -.0448083    .021168    -2.12   0.034    -.0862968   -.0033199
    ------------------------------------------------------------------------------

    I appreciate any advice on this.

    Thanks!
    Gastón





  • #2
    Hi Gaston,
    The problem that you are facing is that, by default, margins will only calculate marginal effects with respect to the linear combination of the first equation in your model.
    That is why it only gives you the same results as the coefficient output.
    In order to get the correct marginal effects, which will depend on what you are trying to analyze, you need to create a program that defines your outcome of interest.
    see https://blog.stata.com/2016/03/17/pr...-predict-work/ for an example of how to program that subprogram.
    Fernando

    Comment


    • #3
      Thanks for your advice and information, FernandoRios. I'll give a try creating such a program.

      Gastón

      Comment


      • #4
        Eventually this could be useful for others.

        I solved my inquiry using the intreg command as follows:
        Code:
        gen yup = MPImax
        gen ylow = MPImax
        replace ylow = . if MPImax <= 0
        
        intreg ylow yup crtstd age_years age2, het(crtstd age_years age2) nolog
        
        Interval regression                             Number of obs     =        205
                                                           Uncensored     =         95
                                                           Left-censored  =        110
                                                           Right-censored =          0
                                                           Interval-cens. =          0
        
                                                        Wald chi2(3)      =      11.79
        Log likelihood = -64.449367                     Prob > chi2       =     0.0081
        
        ------------------------------------------------------------------------------
                     |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
        model        |
              crtstd |  -.0448083    .021168    -2.12   0.034    -.0862968   -.0033199
           age_years |  -.0160767   .0066348    -2.42   0.015    -.0290807   -.0030726
                age2 |   .0002018   .0000952     2.12   0.034     .0000153    .0003883
               _cons |   .2392887   .1001342     2.39   0.017     .0430293    .4355481
        -------------+----------------------------------------------------------------
        lnsigma      |
              crtstd |   .1956093   .0843663     2.32   0.020     .0302544    .3609642
           age_years |   .0084043    .025229     0.33   0.739    -.0410436    .0578521
                age2 |    .000042   .0003784     0.11   0.912    -.0006997    .0007838
               _cons |  -1.757925   .3580634    -4.91   0.000    -2.459716   -1.056133
        ------------------------------------------------------------------------------
        
        margins, dydx(crtstd) predict(pr(0,.)) over(age)
        
        Average marginal effects                        Number of obs     =        205
        Model VCE    : OIM
        
        Expression   : Pr(y>0), predict(pr(0,.))
        dy/dx w.r.t. : crtstd
        over         : age
        
        ----------------------------------------------------------------------------------
                         |            Delta-method
                         |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -----------------+----------------------------------------------------------------
        crtstd           |
                     age |
         8-14 years old  |  -.1017403   .0327172    -3.11   0.002    -.1658648   -.0376158
        15-21 years old  |  -.0842222   .0330351    -2.55   0.011    -.1489699   -.0194745
        22-32 years old  |  -.0644649   .0338565    -1.90   0.057    -.1308225    .0018926
        33-43 years old  |  -.0541335   .0348211    -1.55   0.120    -.1223816    .0141146
          44+ years old  |  -.0576073   .0337056    -1.71   0.087    -.1236691    .0084544
        ----------------------------------------------------------------------------------

        Comment

        Working...
        X