Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: collecting interaction terms after estimation
From
Maria Ana Vitorino <[email protected]>
To
<[email protected]>
Subject
st: collecting interaction terms after estimation
Date
Sat, 5 Nov 2011 12:48:47 -0400
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
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/