Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Burgard, Sarah" <burgards@umich.edu> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: no difference between results obtained from -margins- and -margins, atmeans- |

Date |
Thu, 12 Apr 2012 19:55:18 +0000 |

Thank you very much, Dr. Nichols, I had found one other reference pointing out that we'd expect to get the same output regardless of using -margins- or -margins, atmeans- in the case of an OLS regression model with no quadratic terms, but it is helpful to have this verified. I had become concerned because I recently looked over a few worked examples using these commands that showed differences for the predictive margins depending on which command was used (-margins- alone or -margins, atmeans-). I somehow failed to note that all examples were used dichotomous outcomes - of course I understand your explanation. As for what I really want to get out of the margins command, that's actually a more substantive matter. What do predictive margins really allow me to say? ** What I want to say: We see significant gender differences in time for sleep when we use weighted but unadjusted means in men's and women's reported minutes of sleep. We ran this OLS regression to adjust for the fact that men and women do very different amounts of paid and unpaid work over the life course, and paid work is one of the biggest competitors for sleep time. You can see that from the coefficients. Now that we have accounted for these differential distributions of predictor variables for men and women, the predicted gender gap in time for sleep is X - and as you can see it's smaller than the unadjusted gap." But I guess after reading all the documentation on margins and a lot of statalist discussions, most of which about MEMs versus AMEs and don't apply here, I am still not sure if predictive margins give me what I want. I am obtaining the predictive margin for female and for male, at different age groups because both sleep and paid work time vary a lot over adulthood: margins female, over(agegroup) then subtracting the male value from the female value to get the gender gap. I can test the statistical significance of the difference between the predictive margin for male and for female, and am doing so. ** A final issue I'm still struggling with: what is the difference between specifying: margins female, at(agegroup=(1 (1) 6) versus margins female, over(agegroup) thanks so much Sarah ________________________________________ From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of Austin Nichols [austinnichols@gmail.com] Sent: Thursday, April 12, 2012 10:54 AM To: statalist@hsphsun2.harvard.edu Subject: Re: st: no difference between results obtained from -margins- and -margins, atmeans- Sarah <burgards@umich.edu>: The -atmeans- distinction arises because f(E(xb)) is not equal to E(f(xb)), in general. But for linear regressions, f(E(xb)) does equal E(f(xb)), so atmeans should have no impact. I am using "linear" in slightly nonstandard way, however: a linear model is linear in parameters, but may have x and x^2 used as predictors, in which case a prediction at E(x) is not nec. the same as the mean prediction across observed values of x. Do you mean to "take out" the contributions of covariates and show the gender diff at each age? Note that interacting gender with all covariates ensures they have different impacts on different genders--see also -oaxaca- on SSC and http://www.stata-journal.com/sjpdf.html?articlenum=st0151 showing how to say what part of an observed difference is due to differences in covariates and what part is due to differences in coefs. On Thu, Apr 12, 2012 at 10:39 AM, Burgard, Sarah <burgards@umich.edu> wrote: > Dear colleagues, > I have what is probably a simple question. I am exploring the implications of obtaining predictions using -margins- versus -margins, atmeans- for simple weighted OLS regressions. > > My substantive goal is to obtain the "adjusted" or predicted gender difference in minutes of sleep across age categories, adjusting for a large number of covariates that predict sleep and including interactions between female gender and covariates. I believe that what I want is obtained by specifying -margins female, over(agecat)- after running the regression model. > > However, Stata 12 is returning the same predicted values for both -margins female, over(agecat)- and -margins female, over(agecat) atmeans- > > This happens when using a simpler model with the "auto" data that we are all familiar with as well - please see below. Does anyone see what I am doing wrong (note that I have the same problem even if I restimate the same model and then request -margins, atmeans-) > thank you, > Sarah Burgard > > . sysuse auto > (1978 Automobile Data) > . regress mpg turn i.foreign > Source | SS df MS Number of obs = 74 > -------------+------------------------------ F( 2, 71) = 38.97 > Model | 1278.68109 2 639.340545 Prob > F = 0.0000 > Residual | 1164.77837 71 16.4053292 R-squared = 0.5233 > -------------+------------------------------ Adj R-squared = 0.5099 > Total | 2443.45946 73 33.4720474 Root MSE = 4.0503 > ------------------------------------------------------------------------------ > mpg | Coef. Std. Err. t P>|t| [95% Conf. Interval] > -------------+---------------------------------------------------------------- > turn | -1.029205 .138914 -7.41 0.000 -1.306192 -.7522186 > 1.foreign | -1.263614 1.328003 -0.95 0.345 -3.911577 1.384349 > _cons | 62.47956 5.784252 10.80 0.000 50.94609 74.01303 > ------------------------------------------------------------------------------ > . margins foreign > > Predictive margins Number of obs = 74 > Model VCE : OLS > Expression : Linear prediction, predict() > ------------------------------------------------------------------------------ > | Delta-method > | Margin Std. Err. z P>|z| [95% Conf. Interval] > -------------+---------------------------------------------------------------- > foreign | > 0 | 21.67297 .6144672 35.27 0.000 20.46863 22.8773 > 1 | 20.40935 1.045246 19.53 0.000 18.36071 22.458 > ------------------------------------------------------------------------------ > . margins foreign, atmeans > > Adjusted predictions Number of obs = 74 > Model VCE : OLS > Expression : Linear prediction, predict() > at : turn = 39.64865 (mean) > 0.foreign = .7027027 (mean) > 1.foreign = .2972973 (mean) > ------------------------------------------------------------------------------ > | Delta-method > | Margin Std. Err. z P>|z| [95% Conf. Interval] > -------------+---------------------------------------------------------------- > foreign | > 0 | 21.67297 .6144673 35.27 0.000 20.46863 22.8773 > 1 | 20.40935 1.045246 19.53 0.000 18.36071 22.458 > ------------------------------------------------------------------------------ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Sarah Burgard > Associate Professor > Sociology | Epidemiology | Population Studies Center > University of Michigan > http://sarahburgard.com/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: no difference between results obtained from -margins- and -margins, atmeans-***From:*"Burgard, Sarah" <burgards@umich.edu>

**Re: st: no difference between results obtained from -margins- and -margins, atmeans-***From:*Austin Nichols <austinnichols@gmail.com>

- Prev by Date:
**st: Suggestion - Citing references from Stata Journal** - Next by Date:
**st: order of arguments** - Previous by thread:
**Re: st: no difference between results obtained from -margins- and -margins, atmeans-** - Next by thread:
**st: collapse with multiple sets of weights** - Index(es):