[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Ricardo Ovaldia <ovaldia@yahoo.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Adjust command |

Date |
Fri, 18 Apr 2003 14:13:19 -0700 (PDT) |

Thank you Ken. So let me see if I understand, when I type -adjust mpg,by( foreign)- , mpg is set to the overall mean for mpg, and if I type -adjust,by(foreign)-, (without specifying mpg) then mpg is set to the mean of mpg within each foreign level. Correct? Regarding my first question, I understand that it depends on the question that I want answered, what I don't understand is what question is being answered by each of the two approaches. Specifically if I type: . regress price mpg foreign . adjust , by( foreign) se or . regress price mpg . adjust, by( foreign) se What are these two adjusts telling me? I am sorry if this is to trivial, but I am confused about the interpretation of the second approach. Best, Ricardo. the adjusted --- khigbee@stata.com wrote: > Ricardo Ovaldia <ovaldia@yahoo.com> asks: > > > I have two questions about -adjust- after > -regress-. > > First, under what circumstances should the -by()- > > variable be included or not included in the > regression > > model. ( I get different adjust outputs), > > The answer depends on what question you are trying > to ask of your > data and regression model. The adjust output will > vary depending > on what you do, as it should. > > The way I would approach it is to first think of the > appropriate > regression model and run it. Then think about what > kinds of > summaries you wish to obtain from that model (i.e., > what question > are you trying to answer). This is what guides how > -adjust- > should be used. > > > > Second, according to the help file, the -se- > option is > > "equivalent to the stdp option of predict". > Therefore, > > I should be able to get what -adjust- reports > using > > -predict-, but I can't. Using the auto data and > these > > commands: > > > > qui regress price mpg foreign > > predict yhat > > predict se, stdp > > adjust , by( foreign) se > > by foreign, sort:sum yhat se > > > > I get that mean(yhat)= adjusted(mean) as expected, > but > > I can't get the adjusted(se). What am I missing? > > > Try the following experiment to understand what > Stata's -adjust- > command is presenting in it's table. > > Using the auto dataset as the example, > > . sysuse auto > . regress price mpg foreign > > Now add two observations to the bottom of the > dataset > > . set obs 76 > > And set foreign to 0 and 1 in the last two obs. > > . replace foreign = 0 in 75 > . replace foreign = 1 in 76 > > And set mpg to the mean of mpg in the last two obs > when foreign > is 0 or 1 respectively. > > . summarize mpg if foreign==0 in 1/74 > . replace mpg = r(mean) in 75 > . summarize mpg if foreign==1 in 1/74 > . replace mpg = r(mean) in 76 > > Now run your predicts > > . predict xb > . predict se, stdp > > And look at what it produced in the last two obs. > > . list foreign mpg xb se in 75/76 > > > +------------------------------------------+ > | foreign mpg yhat se > | > > |------------------------------------------| > 75. | Domestic 19.8269 6072.423 350.979 > | > 76. | Foreign 24.7727 6384.682 539.5994 > | > > +------------------------------------------+ > > And then compare that with what -adjust- produced. > > . adjust in 1/74 , by(foreign) se > > > ---------------------------------------------------------- > Dependent variable: price Command: > regress > Variable left as is: mpg > > ---------------------------------------------------------- > > ---------------------------------- > Car type | xb stdp > ----------+----------------------- > Domestic | 6072.42 (350.979) > Foreign | 6384.68 (539.599) > ---------------------------------- > Key: xb = Linear Prediction > stdp = Standard Error > > > The reason why what you did was not equivalent for > the stdp, was > that the mean of the stdp is not necessarily the > same as the stdp > evaluated at the mean. > > > Ken Higbee khigbee@stata.com > StataCorp 1-800-STATAPC > > * > * For searches and help try: > * > http://www.stata.com/support/faqs/res/findit.html > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: Adjust command***From:*khigbee@stata.com

- Prev by Date:
**Re: st: Merge two data sets** - Next by Date:
**st: Re: Re: Stata8: review and variable windows** - Previous by thread:
**Re: st: Adjust command** - Next by thread:
**Re: Re: st: Adjust command** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |