--- "Daniel Schneider" <daniel.schneider@s...> wrote:
> My problem is that I would like to just do a -predict-
> command, generate some simple graphs that show the different
> behavior of the predicted probability depending on the manipulation
> of the two variables (e.g., if X2 is a binary dummy, I would get two
> lines running from left to right, when the yaxis is my predicted
> probability and the xaxis is every value that X1 can take).
One way to do just that is to do it manually like in the code below.
The predicted probability whithin a logistic regression is
exp(xb)/(1+exp(xb)) In the example xb is _b[_cons]+_b[price] if
drep==0 and _b[_cons]+_b[price]+_b[drep]+_b[drepXprice]*x if drep==1.
clear
sysuse auto
gen drep = rep78>=4
gen drepXprice = drep*price
logit foreign price drep drepXprice
sum price
twoway function y = exp(_b[_cons]+_b[price]*x)/ /*
*/ (1+exp(_b[_cons]+_b[price]*x)), range(3290 16000) || /*
*/ function y = exp(_b[_cons]+_b[price]*x + _b[drep] + /*
*/ _b[drepXprice]*x) / /*
*/ (1+exp(_b[_cons]+_b[price]*x + _b[drep] + /*
*/_b[drepXprice]*x)), range(3290 16000) /*
*/ ytitle("Pr(foreign)") xtitle("price in $") /*
*/legend(label(1 "drep=0") label(2 "drep=1"))
Hope this helps,
Maarten
*
* 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/