Announcement

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

  • Marginal Effects after running -glm- estimator

    I want to calculate the marginal effects of my control variables after regressing my dependent variable Y, which is bounded between 0 and 1. The following is my regression:
    - glm Y a b c d e f i.country, fa(b) link(logit) vce(robust) -, where a and b are dummy variables and c and d are interaction terms between the dummy variables and the variable e.

    I am not sure if I should use:
    - margins a b c d e f, - or - margins a b c d e f, dydx -

    Can somebody please help me with this query?

  • #2
    Both are wrong. You need to use factor variables for categorical variables and for interactions. Without that Stata does not know what the relationship between the variables is, and will give you wrong answers.

    Here are various ways of using margins after such a model. All of them (and more) are correct, but give you a different view on the same problem. So it is worthwhile to look at all of them. Once you see how they are related you will really start to understand your model.

    Code:
    use http://fmwww.bc.edu/repec/bocode/c/citybudget.dta, clear
    gen polit = minoritylef + 2*noleft
    label define polit 0 "majority left" ///
                       1 "minority left" ///
                       2 "no left"
    label value polit polit
    label variable polit "political orientation city government"    
                   
    glm governing i.polit##c.houseval popdens, ///
        link(logit) family(binomial) vce(robust)
    
    // look at a graph of predicted proportions    
    margins, at(houseval=(.75(.25)3.5) polit=(0/2) popdens=.5)
    marginsplot
    
    // marginal effects
    margins, dydx(*)
    
    // different marginal effects for different values of polit
    margins, dydx(houseval) over(polit)
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment

    Working...
    X