Ricardo Ovaldia <[email protected]> asks:
> 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?
Yes.
> 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?
Well, you are starting with two different regression models. In
the first one you include foreign in your regression model. So
that you get
price = 11905.42 - 294.1955 * mpg + 1767.292 * foreign
as the estimated regression equation. Now the -adjust- command
. adjust , by( foreign) se
says to produce a table with two rows. The first row has foreign
set to 0 and the second row has foreign set to 1. Since mpg was
not mentioned in the -adjust-, it is set to the mean of mpg (the
mean being computed over the observations where foreign is 0 or 1
respectively -- which is 19.82692 and 24.77273 for the auto
data). So the two predicted values shown by adjust are:
predicted price when foreign is 0
= 11905.42 - 294.1955 * 19.82692 + 1767.292 * 0
= 6072.4294
predicted price when foreign is 1 =
= 11905.42 - 294.1955 * 24.77273 + 1767.292 * 1
= 6384.6863
In the second case your regression model is
price = 11253.06 - 238.8943 * mpg
and the -adjust- command is giving you
predicted price when foreign is 0
= 11253.06 - 238.8943 * 19.82692
= 6516.5218
predicted price when foreign is 1
= 11253.06 - 238.8943 * 24.77273
= 5334.996
In this second case, foreign is not in your regression model, but
it is used in the -by()- option of -adjust- which restricts the
sample over which the mean of mpg is computed (so that for
foreign == 0 has a mean of 19.82692 compared to a mean of
24.77273 when foreign was 1).
Many people would prefer to use your first regression model
regress price mpg foreign
and then follow that with
adjust mpg , by(foreign) se
So that mpg is set to the grand mean (21.297297). That makes the
two rows produced by -adjust- more directly comparable. Or maybe
instead of letting mpg be set to the grand mean, you pick a particular
value you would like to compare them with.
adjust mpg = 25 , by(foreign) se
Does this explanation help?
Ken Higbee [email protected]
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/