|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Questions related to -predict-, -adjust-, and predictive margins
From |
Steven Samuels <[email protected]> |
To |
[email protected] |
Subject |
Re: st: Questions related to -predict-, -adjust-, and predictive margins |
Date |
Thu, 25 Sep 2008 19:30:20 -0400 |
Michael would like a standard error for the weighted average of
P(foreign|himpg =0, Z) - P(foreign | high mpg=1, Z)
with other covariates at their original values Z. In SUDAAN parlance,
the weighted average of the individual estimated probabilities is a
"predicted marginal" and the difference is a contrast in the
predicted marginals. (SUDAAN 8.0 Manual, p. 266).
SUDAAN cam compute standard errors for the predicted marginals and
their contrasts. Stata can compute the predicted marginals and
contrasts, but not their standard errors.
To compute the predicted marginals and their contrasts in Stata, run -
svy: logit- . Then compute the individual predicted values: -adjust-
will do it easily with the -pr- and -gen- options. Once individual
predictions are at hand, -generate- the difference between any two. A
call to -svy: mean- will compute the average of the predicted values
(i.e. the "predicted marginals" and of the differences. However the
standard error produced by -svy: mean- will not account for
uncertainty in the estimated coefficients, and so will be too small.
Despite this, it may be useful, and perhaps something is to be
learned graphing the distribution of the differences for various
groups, with -dotplot-.
Michael can also get an idea of the magnitude of error in individual
predictions by computing confidence intervals for them; he can do
this by running -predict- after his -svy: logit-. If he generates the
linear predictor -xb- and its standard error -stdp-, he can compute a
CI for the linear predictor, then endpoints for the predicted
probability itself. He could then plot a histogram of the length of
these intervals. -predictnl- run after -svy: logit- can also directly
compute the difference in probabilities and will also produce a
standard error for these differences.
-Steve
On Sep 24, 2008, at 3:53 PM, Michael I. Lichter wrote:
Question 1: How do you calculate SEs for predicted probabilities
for data that require weights or are from a complex sample design?
I've seen the FAQ about how to do this in general, but I suspect
that the FAQ's advice is not correct for weighted data/data from
complex samples.
Question 2: -adjust, pr ci- produces confidence intervals for
proportions. Is it not the case that SE = (UB - LB)/(2 * 1.96)
given a 95% confidence interval (assuming that weights/design are
not a problem)?
Question 3: I want to calculate predictive margins (predictions
where every element is treated as if it belonged to a given group,
but otherwise the elements' own values are used in the prediction),
AND I want to be able to test for equality of predicted
proportions. From what I glean from an recent article in NEJM,
SUDAAN can do this, but I don't know how.
Here is an example that goes partway there:
. sysuse auto
. gen himpg = mpg > 25
. logit foreign himpg weight
----------------------------------------------------------------------
--------
foreign | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------
+----------------------------------------------------------------
himpg | -2.079449 .998357 -2.08 0.037 -4.036193
-.1227054
weight | -.0037159 .0009375 -3.96 0.000 -.0055534
-.0018785
_cons | 9.795139 2.632037 3.72 0.000
4.636442 14.95384
----------------------------------------------------------------------
--------
. adjust himpg=0, pr ci
----------------------------------------------------------------------
----------
Dependent variable: foreign Command: logit
Variable left as is: weight
Covariate set to value: himpg = 0
----------------------------------------------------------------------
----------
----------------------------------------------
All | pr lb ub
----------+-----------------------------------
| .193884 [.085888 .381067]
----------------------------------------------
Key: pr = Probability
[lb , ub] = [95% Confidence Interval]
. adjust himpg=1, pr ci
----------------------------------------------------------------------
----------
Dependent variable: foreign Command: logit
Variable left as is: weight
Covariate set to value: himpg = 1
----------------------------------------------------------------------
----------
----------------------------------------------
All | pr lb ub
----------+-----------------------------------
| .029187 [.003519 .203809]
----------------------------------------------
Key: pr = Probability
[lb , ub] = [95% Confidence Interval]
What can I say about the relationship between the predictions
(aside from the obvious facts that they seem to be very different
but their CIs are wide and overlap)?
All | pr lb ub
----------+-----------------------------------
| .193884 [.085888 .381067]
| .029187 [.003519 .203809]
----------------------------------------------
Key: pr = Probability
[lb , ub] = [95% Confidence Interval]
Thanks.
Michael
--
Michael I. Lichter, Ph.D.
Research Assistant Professor & NRSA Fellow
UB Department of Family Medicine / Primary Care Research Institute
UB Clinical Center, 462 Grider Street, Buffalo, NY 14215
Office: CC 125 / Phone: 716-898-4751 / E-Mail: [email protected]
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/