Statalist


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

Re: st: CI for adjusted mean


From   Rachele Capocchi <rachele.capocchi@arsanita.toscana.it>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: CI for adjusted mean
Date   Thu, 25 Oct 2007 10:57:45 +0200

Hi Ken,

sorry but maybe I don't understand what you explain in your mail.

I tried tried:

. adjust wei, by(rep) se ci

and I obtained the adjusted means of the groups, but I don't know how I can obtain the overall mean.
Is there a command to do this ?

Thanks a lot,
Rachele

Rachele Capocchi
Agenzia Regionale Sanità Toscana
"U.O. Centro Statistico Elaborazione Dati"
Sede Operativa - viale Milton,7
50134 Firenze
Tel. 055-4624354
Fax. 055-4624345


khigbee@stata.com ha scritto:

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/
*
*   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