Announcement

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

  • Margin effects from a log-linked gamma regression (using log transformation to the dependent variable).

    I am analyzing the relationships between public employees per 1000 populations and federal funding amounts awarded by a log-linked gamma regression (family: Gamma, Link: Log)

    I include a squared variable of the public employees per 1000. The equation could be...


    I applied a log transformation to the dependent variable because of severe skewness. (Is it common to apply the log transformation in the log-linked gamma regression? If so,)
    1. How can I interpret the results (employee variables including a squared variable)?




    2. Can I use the margin options in STATA? What option should I use?


    1) margins, eydx() atmean or 2) margins, eyex() atmean or 3) both incorrect, should find it with another way.




    I appreciate your answers.

  • #2
    If you are doing a gamma regression, you should not apply a log transformation to the outcome variable, you should use the log link in your command. In addition, in order to use -margins- properly, you cannot include a quadratic term with a squared variable: you have to use factor variable notation and let Stata create a "virtual" quadratic term.

    [code]
    glm DW_T_AM_NEW c.EMP_1000_POPS2##c.EMP_1000_POPS2 General /*and any other predictors*/, link(log) family(gamma)
    [code]
    NOTE: The variable DW_T_AM_NEW should not be log transformed. If it already is, then untransform it, or use the original untransformed variable if it's still hanging around.

    Now, the next thing to understand is that there is no such thing as the marginal effect of a quadratic term. And, in fact, in this model there is no such thing as the marginal effect of EMP_1000_POPS2: there are infinitely many marginal effects of EMP_1000_POPS2, one for each value of EMP_1000_POPS2. If you want an average marginal effect it would be
    Code:
    margins, dydx(EMP_1000_POPS2)
    If you want a marginal effect with all other variables constrained to their means it would be:
    Code:
    margins, dydx(EMP_1000_POPS2) atmeans
    If you want a marginal effect at the mean value of EMP_1000_POPS2 it would be
    Code:
    margins, dydx(EMP_1000_POPS2) at((mean) EMP_1000_POPS2)
    And if you want a marginal effect at the mean of EMP_1000_POPS2 with all other variables constrained to their means it would be
    Code:
    margins, dydx(EMP_1000_POPS2) at(mean EMP_1000_POPS2) atmeans
    And, of course, you could also look at marginal effects at other specific values of EMP_1000_POPS2 using a list of interesting values in the -at()- option.

    Comment

    Working...
    X