I saw a post using bootstrap to calculate the 95% CI for the difference of two medians and tried to run the command in the Do-File_Editor with the following information:
/* Define a program to return medians */
program define qq, rclass
centile TimeSedation if StudyArm==1
scalar m1 = r(c_1)
centile TimeSedation if StudyArm==2
scalar m2 = r(c_1)
centile TimeSedation if StudyArm==3
scalar m3 = r(c_1)
#delim;
bootstrap
m1 = r(m1)
m2 = r(m2)
m3 = r(m3)
d12 = (r(m1)-r(m2))
d32 = (r(m3)-r(m2))
DID = (r(m3)-2*r(m2)+r(m1)),
ties strata(StudyArm) rep(1000) nodots saving(bs01, replace): qq;
#delim cr
estat bootstrap
It works the first time but when I tried to re-run it again, it returned with the following message:
. /* Define a program to return medians */
. program define qq, rclass
1. centile TimeSedation if StudyArm==1
2. scalar m1 = r(c_1)
3. centile TimeSedation if StudyArm==2
4. scalar m2 = r(c_1)
5. centile TimeSedation if StudyArm==3
6. scalar m3 = r(c_1)
7. #delim;
delimiter now ;
. bootstrap
> m1 = r(m1)
> m2 = r(m2)
> m3 = r(m3)
> d12 = (r(m1)-r(m2))
> d32 = (r(m3)-r(m2))
> DID = (r(m3)-2*r(m2)+r(m1)),
> ties strata(StudyArm) rep(1000) nodots saving(bs01, replace): qq;
8. #delim cr
delimiter now cr
. estat bootstrap
9.
unexpected end of file
r(612);
end of do-file
r(612);
Any ideas how to fix it? Or any advice on getting the 95% CI?
Thanks!
/* Define a program to return medians */
program define qq, rclass
centile TimeSedation if StudyArm==1
scalar m1 = r(c_1)
centile TimeSedation if StudyArm==2
scalar m2 = r(c_1)
centile TimeSedation if StudyArm==3
scalar m3 = r(c_1)
#delim;
bootstrap
m1 = r(m1)
m2 = r(m2)
m3 = r(m3)
d12 = (r(m1)-r(m2))
d32 = (r(m3)-r(m2))
DID = (r(m3)-2*r(m2)+r(m1)),
ties strata(StudyArm) rep(1000) nodots saving(bs01, replace): qq;
#delim cr
estat bootstrap
It works the first time but when I tried to re-run it again, it returned with the following message:
. /* Define a program to return medians */
. program define qq, rclass
1. centile TimeSedation if StudyArm==1
2. scalar m1 = r(c_1)
3. centile TimeSedation if StudyArm==2
4. scalar m2 = r(c_1)
5. centile TimeSedation if StudyArm==3
6. scalar m3 = r(c_1)
7. #delim;
delimiter now ;
. bootstrap
> m1 = r(m1)
> m2 = r(m2)
> m3 = r(m3)
> d12 = (r(m1)-r(m2))
> d32 = (r(m3)-r(m2))
> DID = (r(m3)-2*r(m2)+r(m1)),
> ties strata(StudyArm) rep(1000) nodots saving(bs01, replace): qq;
8. #delim cr
delimiter now cr
. estat bootstrap
9.
unexpected end of file
r(612);
end of do-file
r(612);
Any ideas how to fix it? Or any advice on getting the 95% CI?
Thanks!
Comment