Announcement

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

  • GMM for a Poisson fixed effects model with an endogenous variable

    Hello,

    I'm looking to estimate a Poisson fixed effects model with an endogenous variable. I think the correct approach using GMM is specified in Example 12 of the STATA Manual entry for GMM (Page 32 in http://www.stata.com/manuals13/rgmm.pdf). Here is the entry and the code in the example:

    "Here we refit the model, treating x3 as endogenous and x1 and x2 as strictly exogenous. Our moment-evaluator program is

    program gmm_poiend
    version 13
    syntax varlist if, at(name)
    quietly {
    tempvar mu
    matrix score double ‘mu’ = ‘at’ ‘if’, eq(#1)
    replace ‘mu’ = exp(‘mu’)
    local mylhs : coleq ‘at’
    local mylhs : word 1 of ‘mylhs’
    replace ‘varlist’ = ‘mylhs’/‘mu’ - L.‘mylhs’/L.‘mu’ ‘if’
    }
    end

    Now we call gmm using x1, x2, and L2.x3 as instruments:"

    The example invokes the program with the following commands:

    use http://www.stata-press.com/data/r13/poisson2
    gmm gmm_poiend, nequations(1) vce(cluster id) onestep parameters(y:x1 y:x2 y:x3) instruments(x1 x2 L2.x3, noconstant)

    However, when I follow these steps to reproduce the example, I get an error message. My output is below:

    . use http://www.stata-press.com/data/r13/poisson2

    . program gmm_poiend
    1.
    . version 13
    2.
    . syntax varlist if, at(name)
    3.
    . quietly {
    4.
    . tempvar mu
    5.
    . matrix score double ‘mu’ = ‘at’ ‘if’, eq(#1)
    6.
    . replace ‘mu’ = exp(‘mu’)
    7.
    . local mylhs : coleq ‘at’
    8.
    . local mylhs : word 1 of ‘mylhs’
    9.
    . replace ‘varlist’ = ‘mylhs’/‘mu’ - L.‘mylhs’/L.‘mu’ ‘if’
    10.
    . }
    11.
    . end

    . gmm gmm_poiend, nequations(1) vce(cluster id) onestep parameters(y:x1 y:x2 y:x3) instruments(x1 x2 L2.x3, noconstant)
    error calling gmm_poiend at initial values
    ‘mu’ invalid name
    r(198);

    I'm new to GMM and so please advice what I should do to make the example run smooth. Are there alternative approaches to estimate a fixed effects count model with an endogenous variable?

    Best wishes,

    Venkat

  • #2
    Dear Venkat, I am facing the same issue, did you solve it ?

    Thanks!

    Comment


    • #3
      Dear all, i found this solution on another thread. I link it here in case you might need it.

      Kind regards,

      http://www.statalist.org/forums/foru...h-stata-manual

      Comment

      Working...
      X