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]

st: bootstrapping 95%CIs through a loop!


From   Hagen von Hermanni <[email protected]>
To   [email protected]
Subject   st: bootstrapping 95%CIs through a loop!
Date   Mon, 01 Aug 2011 12:40:27 +0200

I try to bootstrap a loop to get 95% confidence intervals of a curve, that is made up of the difference of point wise estimated logit predictors. ic1a gives a number between 0 and 4 and is the dependent var
b12 is the independent var (goes from 1 to 4)
split divides in control (==1) and treatment (==2) group, which in turn produces to separate curves. The difference of the two is what I'm looking for! I read everything I could find about bootstrapping in Stata and already consulted everyone I could think of! So far nothing I tried helped and every time I wrote my own program I received an "invalid syntax" error.
Please help me!

foreach nvar in ic1a {
foreach mvar in b12 {

*gen indicator variables
gen tc4=1 if split==2 & `nvar'>=4
replace tc4=0 if split==2 & `nvar'<4

gen tc3=1 if split==2 & `nvar'>=3
replace tc3=0 if split==2 & `nvar'<3

gen tc2=1 if split==2 & `nvar'>=2
replace tc2=0 if split==2 & `nvar'<2

gen tc1=1 if split==2 & `nvar'>=1
replace tc1=0 if split==2 & `nvar'<1

gen bc3=1 if split==1 & `nvar'>=3
replace bc3=0 if split==1 & `nvar'<3

gen bc2=1 if split==1 & `nvar'>=2
replace bc2=0 if split==1 & `nvar'<2

gen bc1=1 if split==1 & `nvar'>=1
replace bc1=0 if split==1 & `nvar'<1

logit tc4 `mvar'
predict pt4
gen p4=pt4

logit tc3 `mvar'
predict pt3
logit bc3 `mvar'
predict bt3
gen p3=pt3-bt3

logit tc2 `mvar'
predict pt2
logit bc2 `mvar'
predict bt2
gen p2=pt2-bt2

logit tc1 `mvar'
predict pt1
logit bc1 `mvar'
predict bt1
gen p1=pt1-bt1

egen `nvar'`mvar'= rowtotal(p1 p2 p3 p4)
drop  tc4 -  p1
}
}

Many Thanks and kind regards
Hagen

*
*   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