Statalist


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

Re: Re: st: CI for adjusted mean


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: Re: st: CI for adjusted mean
Date   Wed, 24 Oct 2007 16:07:34 +0100 (BST)

Thanks Ken,

I understand my mistake now.

-- Maarten

--- khigbee@stata.com wrote:

> Maarten buis <maartenbuis@yahoo.co.uk> asks:
> 
> > ... I expected that this code:
> > 
> > sysuse auto, clear
> > recode rep78 1/2 = 3
> > anova mpg rep78 wei, continuous(wei)
> > adjust wei, se ci
> > 
> > would give me a mean of mpg adjusted for wei (with standard error
> and
> > confidence interval), but instead it gives me an empty table. Does
> > anyone have any thoughts on this one?
> 
> The description paragraph for -adjust- (manual or help file) says:
> 
>     ...  If by() is not specified, adjust produces results as if
>     by() defined one group.  Variables used in the estimation
>     command but not included in either the by() variable list or
>     the adjust variable list are left at their current values,
>     observation by observation.  Here adjust displays the average
>     estimated prediction (or the corresponding probability or
>     exponentiated prediction), substituting the mean of these
>     unspecified variables within each group defined by the
>     variables in the by() option.
> 
> Since -by()- was not specified, we are dealing with one group
> (the whole estimation sample) and since rep78 was not specified
> in the -adjust- command, the mean of rep78 over the whole
> estimation sample is used in the prediction (see the last part of
> the description "... substituting the mean ...").
> 
> With your example the mean of rep78 over the estimation sample is
> 3.57971.  After an -anova- where rep78 is in the model as a
> categorical variable, -predict- (and hence -adjust- which uses
> -predict-) returns a missing value when asked for the prediction
> of the model where the categorical variable is set to a value
> that was not one of the levels of that categorical variable.
> That is why you end up with an empty table--the -predict- command
> returned a missing value for the prediction.
> 
> You could instead do things like
> 
>     . adjust wei rep=3, se ci
>     . adjust wei rep=4, se ci
>     . adjust wei rep=5, se ci
> 
> or more easily
> 
>     . adjust wei, by(rep) se ci
> 
> With these cases, the rep78 variable is treated as a categorical
> variable (like it should be in this -anova- example).
> 
> 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/
> 


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________ 
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index