Announcement

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

  • Tobit model in cmp -- marginal effect on probability of positive outcome

    Hi all,

    I am trying to estimate the marginal effect of the regressors on the probability of an uncensored outcome in a tobit model using the cmp module. When using the regular tobit command in Stata this can be accomplished by:

    Code:
    sysuse auto.dta
    tobit mpg trunk weight, ll(17) 
    margins, dydx(trunk weight) predict(pr(17,.)) atmeans
    I had guessed that the analogous code in cmp would be:

    Code:
    sysuse auto.dta
    cmp (mpg=trunk weight), ind("cond(mpg>17, $cmp_cont, $cmp_left)" )
    margins, dydx(trunk weight) predict(pr(17 .)) atmeans
    However, these give very different results for the marginal effects. I am fairly certain that in cmp the option "pr" assumes the variance of the error term is 1, as it is in a probit model (the cmp help documentation only refers to probit in its discussion of the pr option, but I had hoped it could be used for a tobit as well).

    I'm wondering if there was some other way of getting these marginal effects?

    Cheers,

    Peter

  • #2
    Interesting question. Yeah, pr() is for probit and oprobit models, where the error variance is 1. But it seems like a good idea for me to generalize it.

    FYI, I know that this is not a serious example, but note that to do that tobit regression correctly with cmp, you need to censor the data. cmp assumes the data are censored. So if a "censored" observation has the value 3, it will assume it was censored to 3 not 17.

    The solution for now is to take over the computation, which you can do with the -expression()- option of -margins-. I get a match with this:

    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . replace mpg=17 if mpg<17
    (14 real changes made)
    
    . cmp (mpg=trunk weight), ind("cond(mpg>17, $cmp_cont, $cmp_left)" ) qui nolr
    
    Fitting individual models as starting point for full model fit.
    
    Fitting full model.
    
    Mixed-process regression                        Number of obs     =         74
                                                    Wald chi2(2)      =      97.78
    Log likelihood = -163.74787                     Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
             mpg |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    mpg          |
           trunk |  -.1487205   .1477236    -1.01   0.314    -.4382534    .1408124
          weight |  -.0063328    .000871    -7.27   0.000    -.0080399   -.0046257
           _cons |   41.90602   2.094739    20.01   0.000     37.80041    46.01163
    -------------+----------------------------------------------------------------
        /lnsig_1 |   1.340901   .0951684    14.09   0.000     1.154375    1.527428
    -------------+----------------------------------------------------------------
           sig_1 |   3.822487     .36378                      3.172039    4.606314
    ------------------------------------------------------------------------------
    
    . margins, dydx(trunk weight) expression(normal((predict(xb)-17)/exp([/lnsig_1]))) atmeans
    
    Conditional marginal effects                    Number of obs     =         74
    Model VCE    : OIM
    
    Expression   : normal((predict(xb)-17)/exp([/lnsig_1]))
    dy/dx w.r.t. : trunk weight
    at           : trunk           =    13.75676 (mean)
                   weight          =    3019.459 (mean)
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           trunk |  -.0096211   .0096732    -0.99   0.320    -.0285801     .009338
          weight |  -.0004097   .0000822    -4.99   0.000    -.0005708   -.0002486
    ------------------------------------------------------------------------------

    Comment


    • #3
      Alrighty! I have added that feature. The new version is available via
      Code:
      net install cmp, replace from(https://raw.github.com/droodman/cmp/v8.5.0)
      After installing it, this should work:
      Code:
      sysuse auto, clear
      replace mpg=17 if mpg<17
      cmp (mpg=trunk weight), ind("cond(mpg>17, $cmp_cont, $cmp_left)" ) qui nolr
      margins, dydx(*) predict(pr(17 .)) atmeans
      I'll have this posted on SSC as well.

      Comment


      • #4
        It is posted on SSC.

        Comment

        Working...
        X