Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Richard Williams <richardwilliams.ndu@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: collecting interaction terms after estimation |

Date |
Sat, 05 Nov 2011 13:20:36 -0500 |

At 11:48 AM 11/5/2011, Maria Ana Vitorino wrote:

Dear statalist users, Suppose I have the following model in which I regress people's decision to buy or not to buy something on people's characteristics interacted with distance. (the Xs refer to interactions between distance to the store and other people's characteristics). logit choice dist dist2 ageXdist sexXdist incXdist

clonevar xdist = dist

Follow that up with replace xdist = 10 if !missing(xdist) predict p1, p Change the last line to predict p1, p if e(sample) if you only want to use the same cases that were used in the estimation. Then, drop xdist clonevar xdist = dist [repeat process with remaining models; call predictions p2, p3, or whatever)

And I would like to obtain predicted probabilities for each person when distance is set to 10. This would be easy enough if I only had this model specification. But I have several possible models (and may keep adding and changing the current ones). This is what I have so far: local chars "sex age inc" foreach varname in `chars'{ gen distX`varname' = dist*`varname' } gen dist2= dist*dist *model 1 logit choice dist dist2 ageXdist sexXdist incXdist *model 2 logit choice dist dist2 sexXdist incXdist *model 3 logit choice dist ageXdist incXdist My question is then: Is it possible to write code general enough that would calculate predicted probabilities for when distance is set to 10 for *any* of the above models? Any insights are appreciated. Thanks, Ana * * 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/

------------------------------------------- Richard Williams, Notre Dame Dept of Sociology OFFICE: (574)631-6668, (574)631-6463 HOME: (574)289-5227 EMAIL: Richard.A.Williams.5@ND.Edu WWW: http://www.nd.edu/~rwilliam * * 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/

**Follow-Ups**:**Re: st: collecting interaction terms after estimation***From:*Maria Ana Vitorino <vitorino@wharton.upenn.edu>

**References**:**st: collecting interaction terms after estimation***From:*Maria Ana Vitorino <vitorino@wharton.upenn.edu>

- Prev by Date:
**st: basic question on nl** - Next by Date:
**Re: st: collecting interaction terms after estimation** - Previous by thread:
**st: collecting interaction terms after estimation** - Next by thread:
**Re: st: collecting interaction terms after estimation** - Index(es):