Bookmark and Share

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]

Re: st: Query about finding predicted change in probability after logit for changing two variables


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Query about finding predicted change in probability after logit for changing two variables
Date   Thu, 9 Jun 2011 15:20:19 -0400

Urmi Bhattacharya <[email protected]> wrote:
"now i want to find what is the predicted change in the
probability of foreign for those cars with cqual_high=1 with
turn_high=1 from those with cqual_medium=1 and turn_low=1"

The meaning of the above is totally unclear to me,
and I cannot understand you cqual_ coding is supposed to be,
but perhaps you mean to:
compare (1) medium==1 and turnhi==0
     to (2) high==1   and turnhi==1
like so:

clear all
u if rep78<. using `c(sysdir_base)'a/auto
g byte medium=inlist(rep78,3,4)
g byte high=inlist(rep78,5)
g byte turnhi=(turn>35)
logit foreign high medium turnhi headroom mpg trunk
replace medium=1
replace high=0
replace turnhi=0
predict p1
replace medium=0
replace high=1
replace turnhi=1
predict p2
g dp=p2-p1 if e(sample)
su dp, mean
mat dp=r(mean)
loc n=r(N)
prog drop _all
prog mymarg, rclass
u if rep78<. using `c(sysdir_base)'a/auto, clear
bsample
g byte medium=inlist(rep78,3)
g byte high=inlist(rep78,45)
g byte turnhi=(turn>35)
logit foreign high medium turnhi headroom mpg trunk
replace medium=1
replace high=0
replace turnhi=0
predict p1
replace medium=0
replace high=1
replace turnhi=1
predict p2
g dp=p2-p1 if e(sample)
su dp, mean
ret scalar dp=r(mean)
eret clear
end
simulate, reps(141) seed(123): mymarg
bstat, stat(dp) n(`n')

*But I want to reiterate that you should look at each duration's risk
set separately:
http://www.stata.com/statalist/archive/2011-06/msg00465.html
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index