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

From |
"Daniel Schneider" <daniel.schneider@stanford.edu> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: Interaction terms in a logit model |

Date |
Sat, 19 Mar 2005 09:36:40 -0800 |

Thanks Maarten, But, is that really different from doing When drep==0 prgen price, x(drep=0 drepXprice=0) f(3290) t(16000) And a loop for all values of price using prvalue, x(drep=1 price=$value drepXprice=$value) When drep==1 And then using both results to generate the graph (sorry, my stata programming skills are pretty non-existent, the previous lines is meant as a a general statement not Stata code)? Or, more specifically: is this enough to take into consideration the issues raised by Norton, Wang, Ai? Daniel > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of maartenbuis > Sent: Saturday, March 19, 2005 1:40 AM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: Interaction terms in a logit model > > > --- "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/ > * * 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/

**References**:**Re: st: Interaction terms in a logit model***From:*"maartenbuis" <maartenbuis@yahoo.co.uk>

- Prev by Date:
**RE: st: compare zip and nbreg model** - Next by Date:
**Re: st: Interaction terms in a logit model** - Previous by thread:
**Re: st: Interaction terms in a logit model** - Next by thread:
**Re: st: Interaction terms in a logit model** - Index(es):

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