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

From |
Steven Samuels <[email protected]> |

To |
[email protected] |

Subject |
Re: st: Predicted probabilities in graph |

Date |
Wed, 3 Sep 2008 23:26:36 -0400 |

Richard,

Try this.

-Steve

/***************************************************************/

sysuse auto,clear

svyset _n

tab foreign

local rhvar "mpg weight"

svy: logit foreign `rhvar'

predict phat

adjust `rhvar', gen(xb se) se

/*Compare Prediction at Mean to Actual Proportion */

gen p2=exp(xb)/(1+exp(xb))

sum phat p2

foreach v of varlist `rhvar' {

egen m`v' = mean(`v')

gen xb_`v' = xb + _b[`v']*(`v' - m`v')

gen pred_`v'=exp(xb_`v')/(1+exp(xb_`v'))

label var pred_`v' "Est Prob"

}

foreach v of varlist `rhvar' {

twoway scatter pred_`v' `v', title("Plot of Prediction against `v'" "Other Predictors at their Mean") saving(graph_v', replace)

}

/*********************************************************************/

On Aug 28, 2008, at 8:07 AM, Richard Ohrvall wrote:

Hi! I am trying to illustrate predicted probabilities for a successful outcome in a logistic regression, e.g. when one independent variable goes from min to max when all other variables are kept at their mean. This can be done by using the user-written program -prgen- by J. Scott Long and J. Freese and the way that they explain in their book Regression Models for Categorical Depedent Variables Using Stata (2006), Stata Press. However, according to the book, the program can not be used when data comes from a complex sample, i.e. when prefix svy is used. Since I mainly use survey data with complex sample design, this is a problem for me if I want to present the confidence intervals in the graph. Therefore, I wonder if there is some other program or some other way to make predicted probabilities for such graphs when taking the sampling design into account when estimating the confidence interval? Any help would be appreciated. Richard * * 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/

- Prev by Date:
**Re: st: Dependent var is a proportion, with large spike in .95+** - Next by Date:
**Re: st: RE: testing -duplicates tag-** - Previous by thread:
**st: Dependent var is a proportion, with large spike in .95+** - Next by thread:
**Re: st: Predicted probabilities in graph** - Index(es):

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