Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Adjust command


From   [email protected]
To   [email protected]
Subject   Re: st: Adjust command
Date   Fri, 18 Apr 2003 13:02:33 -0500

Ricardo Ovaldia <[email protected]> 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    [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/



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