As you can see on page 5 of my `extended answer' available on my
website (http://home.fsw.vu.nl/m.buis), adjust will give the predicted
probability of someone with average values on the predictor within its
group, if you have only one group (i.e. don't specify the by option)
than that will be the overall mean.
hope this helps,
Maarten
--- Tim Wade <[email protected]> wrote:
> Fred, I haven't thought through this completely (and Michael and
> Marteen have already provided great explanations), but as I was
> thinking about your example I calculated the adjusted probabilities
> holding each variable constant at its mean and it seems to produces
> the same marginal results as the adjust command. I never have used
> adjust without specifying any variables, so I'm not sure about this
> exactly. Tim
>
> . xi: logistic low age lwt i.race smoke,nolog
> i.race _Irace_1-3 (naturally coded; _Irace_1
> omitted)
>
> Logistic regression Number of obs =
> 189
> LR chi2(5) =
> 20.08
> Prob > chi2 =
> 0.0012
> Log likelihood = -107.29639 Pseudo R2 =
> 0.0856
>
>
------------------------------------------------------------------------------
> low | Odds Ratio Std. Err. z P>|z| [95% Conf.
> Interval]
>
-------------+----------------------------------------------------------------
> age | .9777443 .0334083 -0.66 0.510 .9144097
> 1.045466
> lwt | .9875761 .006305 -1.96 0.050 .9752956
> 1.000011
> _Irace_2 | 3.425372 1.771281 2.38 0.017 1.243215
> 9.437768
> _Irace_3 | 2.5692 1.069301 2.27 0.023 1.136391
> 5.808555
> smoke | 2.870346 1.09067 2.77 0.006 1.363
> 6.044672
>
------------------------------------------------------------------------------
>
> . predict p
> (option p assumed; Pr(low))
>
> . adjust,pr
>
>
--------------------------------------------------------------------------------------------------------
> Dependent variable: low Command: logistic
> Variables left as is: age, lwt, smoke, _Irace_2, _Irace_3
>
--------------------------------------------------------------------------------------------------------
>
> ----------------------
> All | pr
> ----------+-----------
> | .289227
> ----------------------
> Key: pr = Probability
>
> . /*generate linear predictor, holding predictors constant at mean*/
> .
> .
> . foreach var of varlist low age lwt _Irace* smoke {
> 2. qui sum `var'
> 3. local mean`var'=r(mean)
> 4. }
>
> . gen
>
x1=_b[_cons]+(`meanage'*_b[age])+(`mean_Irace_2'*_b[_Irace_2])+(`mean_Irace_3'*_b[_Irace_3])+(`mea
> > nlwt'*_b[lwt])+(`meansmoke'*_b[smoke])
>
> .
> . /*generate odds*/
> .
> . gen odds3=exp(x1)
>
> . /*generate probability*/
> .
> . gen p3=odds3/(odds3+1)
>
> . list p3 in 1
>
> +----------+
> | p3 |
> |----------|
> 1. | .2892265 |
> +----------+
>
> . sum p3
>
> Variable | Obs Mean Std. Dev. Min
> Max
>
-------------+--------------------------------------------------------
> p3 | 189 .2892265 0 .2892265
> .2892265
>
>
>
>
>
>
>
> On 12/23/06, Fred Wolfe <[email protected]> wrote:
> > I know this has come up on the Stata list before, but in somewhat
> > different form. I wonder if someone could explain the following to
> me.
> >
> > The manual and the FAQ state that the results after predict and
> > adjust are the same for the following circumstances, and they site
> > this analysis that I have rerun.
> >
> > . sysuse auto, clear
> > (1978 Automobile Data)
> >
> > . regress mpg weight length foreign
> >
> > Source | SS df MS Number of
> obs = 74
> > -------------+------------------------------ F( 3,
> 70) = 48.10
> > Model | 1645.2889 3 548.429632 Prob > F
> = 0.0000
> > Residual | 798.170563 70 11.4024366 R-squared
> = 0.6733
> > -------------+------------------------------ Adj
> R-squared = 0.6593
> > Total | 2443.45946 73 33.4720474 Root MSE
> = 3.3767
> >
> >
>
------------------------------------------------------------------------------
> > mpg | Coef. Std. Err. t P>|t| [95%
> Conf. Interval]
> >
>
-------------+----------------------------------------------------------------
> > weight | -.0043656 .0016014 -2.73 0.008 -.0075595
> -.0011718
> > length | -.0827432 .0547942 -1.51 0.136 -.1920267
> .0265403
> > foreign | -1.707904 1.06711 -1.60 0.114 -3.836188
> .4203806
> > _cons | 50.53701 6.245835 8.09 0.000 38.08009
> 62.99394
> >
>
------------------------------------------------------------------------------
> >
> > . predict p, xb
> >
> > . su p
> >
> > Variable | Obs Mean Std. Dev. Min
> Max
> >
>
-------------+--------------------------------------------------------
> > p | 74 21.2973 4.747442 10.12822
> 30.51564
> >
> > . su mpg
> >
> > Variable | Obs Mean Std. Dev. Min
> Max
> >
>
-------------+--------------------------------------------------------
> > mpg | 74 21.2973 5.785503 12
> 41
> >
> > . adjust
> >
> >
>
---------------------------------------------------------------------------
> > Dependent variable: mpg Command: regress
> > Variables left as is: weight, length, foreign
> >
>
---------------------------------------------------------------------------
> >
> > ----------------------
> > All | xb
> > ----------+-----------
> > | 21.2973
> > ----------------------
> > Key: xb = Linear Prediction
> >
> >
> > The above shows that adjust and predict produce the same results.
> >
> > However, when I use the logistic regression example from page 20
> > (Reference A-J) for the adjust command, predict and adjust give
> > different results, as shown below. Can someone help me to
> understand
> > why this is so and what I might do to obtain the same results using
> adjust.
> >
> > Thanks,
> >
> > Fred
> >
> >
> >
> > . use http://www.stata-press.com/data/r9/lbw,clear
> > (Hosmer & Lemeshow data)
> >
> > . xi: logistic low age lwt i.race smoke,nolog
> > i.race _Irace_1-3 (naturally coded; _Irace_1
> omitted)
> >
> > Logistic regression Number of obs =
>
=== message truncated ===
-----------------------------------------
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/
-----------------------------------------
Send instant messages to your online friends http://uk.messenger.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/