Announcement

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

  • On Stata's "margins" command

    Hello Statalist users,

    I would like to use Stata’s “margins” command to estimate the expected value of my dependent variable at the minimum, mean, and maximum of two continuous predictors, and to compare these effects across two groups of countries: high rent states and non-high rent states. When I estimate these predicted outcomes, I need to do so at the mean of all other control variables.

    I have cross-national panel data in Stata 13. This is the main model I’m trying to estimate marginal effects with:
    xtreg PTS democ1 gdppcppp gini weapons population highrentstates interactedhighrents if fullsample==1, fe vce (cluster country)
    “Democ1” is significant, and so is “interactedhighrents,” although less so. The latter is an interaction term made by interacting the continuous variable “reosurcerents” with “highrentstates.” Highrentstates is a dummy where a value of 1 means a country is a high rent state.

    I want to compare marginal effects of the min, mean, and max of “resourcerents” and “democ1” across countries who are high rent states and those who are not. Again, the objective is to learn how significant “resourcerents” is compared to “democ1” in both kinds of countries.

    In order to obtain this output and render it graphically, I have searched in numerous places (help margins, UCLA Stats, Professor Williams' 2012 article on the margins command, youtube, etc.) I’ve tried using syntax as well as the menu bar.

    So as to tell Stata what my moderator is, I've also used this version of syntax:

    xtreg PTS democ1 gdppcppp gini weapons population i.highrentstates c.resourcerents#i.highrentstates if fullsample==1, fe vce (cluster country)

    Instead of providing any coefficients from my margin commands, the output consistently reads “not estimable.”

    Other examples of postestimation syntax I’ve tried:

    margins highrentstates, dydx(democ1) at((min) democ1 (mean) democ1 (max) democ1)

    margins highrentstates, dydx(resourcerents) continuous at((min) democ1 (mean) democ1 (max) democ1)

    margins highrentstates, at (democ=(0, 1.65, 2.3979))

    Is this something I can execute in one command, or does it require a number of separate steps?

    This is my first query to the listserv and I do appreciate hearing peoples’ answers.

    Sincerely,
    Alessandro Morosin
    UC Riverside

  • #2
    Is highrentstates time invariant, I.e. A country is always high rent or is always not high rent? If so see Jeff Pittblado's advice at http://www.statalist.org/forums/foru...fe-and-margins
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    Stata Version: 17.0 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Yes, highrentstates is time-invariant. Thank you, Professor Allison! Based on Jeff's advice to a user who was trying to do something similar, it seems that omitting the time invariant term from the equation now allows the margin commands to go through.

      Comment


      • #4
        You also seemed to be leaving out the main effect of your continuous variable. I think it should be

        Code:
        xtreg PTS democ1 gdppcppp gini weapons population resourcerents c.resourcerents#i.highrentstates if fullsample==1, fe vce (cluster country)
        As I said in the other thread, it is counter-intuitive to me to leave out a main effect when specifying an interaction term, but that is apparently what you should do in a fe model with a time-invariant variable that is part of an interaction term.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        Stata Version: 17.0 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment

        Working...
        X