Announcement

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

  • Estimating marginal effect for "triple hurdle" model

    Dear Statalist

    I am working on triple hurdle model as introduced by BURKE et al, (2015)-doi: 10.1093/ajae/aav009. Thanks to separability feature of the log likelihood function, I am able to estimate the betas of my equations with ease. However, I understand that the marginal effect of the explanatory variables on my outcome variables should take into account the parameters and explanatory variables from all three stages. Thus in order to compute the marginal effect I intend to use the expression option on the margins command. Since I do not have effective identification available in the data, I could not estimate the model simultaneous using say Roodman's "cmp" command (Roodman, D. 2011. Estimating fully observed recursive mixed-process models with cmp. Stata Journal 11(2): 159-206).

    The formula I need to code looks like this
    Click image for larger version

Name:	image002.png
Views:	1
Size:	13.3 KB
ID:	1337505


    and my code looks like this

    Code:
    global pd varlist1 // explanatory variables for the first hurdle equation
    global md varlist2 // explanatory variables for the first hurdle equation
    global ind varlist3 // explanatory variables for the outcome equation
    
    //individually estimating the models
    probit  srprod $pd  //the first hurdle model
    predict srp, xb
    oprobit nsrmposio $md  //the second hurdle model
    predict srmp_n, xb
    reg lnetsell $id //the outcome equations
    predict sell, xb
    predict sigma, stdp
    
    margins, expression (normal(srp)*normal(srmp_n - 0.1206016)*exp(sell +(sigma^2)/2))
    margins, expression (normal(srp)*normal(srmp_n - 0.1206016)*exp(sell +(sigma^2)/2)) dydx(*)
    When I run the above code I keep getting empty tables
    Code:
    . margins, expression (normal(srp)*normal(srmp_n - 0.1206016)*exp(sell +(sigma^2)/2))
    Warning: expression() does not contain predict() or xb().
    
    Predictive margins                              Number of obs     =      1,208
    Model VCE    : OLS
    
    Expression   : normal(srp)*normal(srmp_n - 0.1206016)*exp(sell +(sigma^2)/2)
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           _cons |   .9553197          .        .       .            .           .
    ------------------------------------------------------------------------------
    
    . margins, expression (normal(srp)*normal(srmp_n - 0.1206016)*exp(sell +(sigma^2)/2)) dydx(age15_64)
    Warning: expression() does not contain predict() or xb().
    
    Average marginal effects                        Number of obs     =      1,208
    Model VCE    : OLS
    
    Expression   : normal(srp)*normal(srmp_n - 0.1206016)*exp(sell +(sigma^2)/2)
    dy/dx w.r.t. : age15_64
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
        age15_64 |          0  (omitted)
    ------------------------------------------------------------------------------
    Any help would be appreciated

    Kind regards
    Kaleb

  • #2
    The warning message is informative. In your expression(), you have included variables you generated earlier using predict. I think you need to have the latter sort of prediction expressions within the margins, expression() statement. Look e.g. at "Example 12: Margins of a specified expression" (you can click through from the margins help file)

    Comment


    • #3
      Thanks Jenkins

      If I use the predict () or xb() expressions how can I refer to specific equations. So far predict (xb(srprod)) or xb(srprod) was not successful.
      for predict()
      Code:
       margins, expression (normal(predict(xb(srprod))*normal(predict(xb(nsrmposio)- 0.1206016))*exp(predict (xb(lnetsell)) +(((predict (se(lnetsell)))^2)/2))))
      option xb() incorrectly specified
      r(198);
      for xb()
      Code:
       margins, expression (normal(xb(srprod))*normal(xb(nsrmposio)- 0.1206016)*exp(xb(lnetsell) +((se(lnetsell))^2)/2))
      option equation() not allowed
      r(198);

      Comment


      • #4
        Having now read your initial post again, and more slowly, I think the reason you don't (and will not be able to) see SEs attached to your margins estimate is because, as you say,
        Since I do not have effective identification available in the data, I could not estimate the model simultaneous using say Roodman's "cmp" command
        Apologies, but in my quick initial scan of your post, I had assumed that you had fitted the model jointly, and hence probably also accounted for correlations in errors across equations. Whatever, if you fit each equation separately, how is margins supposed to understand where the various component inputs come from if requested to produce estimates that depend on estimates from all the equations? A related issue is whether the variable for which you are calculating the marginal effect appears in every equation or just one or two of them.

        I recommend that you go back to first principles and derive the expression for the marginal effect(s) of interest to you -- do the calculus for a particular predictor. That'll tell you what needs to be calculated using the fitted parameters and values of the predictors. I suggest you start with the expression for the estimated effect (the expression for the SE of that effect is more complicated). You can then calculate the effect manually, making use of the fact that the estimates for each equation are left behind in e(b) [and e(V)]. Looking at Stata's matrix operators, and perhaps also Mata's facilities, will likely help here.

        But more fundamentally, before doing this I'd go back and rethink what you're doing. If there are identification problems with your model, then it's probably a good idea to rethink your identification strategy altogether, and (related) model specification. I would think that this is more important than trying to calculate marginal effects from a potentially questionable model

        Apologies again for not reading your initial post closely enough. Good luck

        Comment


        • #5
          Thank you Jenkins for taking the time to respond to my requests.

          To answer to your question of
          if you fit each equation separately, how is margins supposed to understand where the various component inputs come from if requested to produce estimates that depend on estimates from all the equations?


          I thought margin, expression () handles such cases.

          In any case, to follow up on your suggestion, let assume that one of the dependent variables in my outcome equations is quantity of net sales (netsell).

          The expected value is given as




          Then the marginal effect of xk on the amount of net sale (netsell) is given by

          Click image for larger version

Name:	image024.png
Views:	1
Size:	29.5 KB
ID:	1338032

          So if I understand you correctly, this is the equation that I need to calculate manually in order to get the marginal effect of xk on netsell

          Comment

          Working...
          X