Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: stcox output: p-value and CI don't agree


From   Michael McCulloch <[email protected]>
To   [email protected]
Subject   Re: st: stcox output: p-value and CI don't agree
Date   Tue, 7 Aug 2007 22:51:47 -0700

One other problem with your earlier approach: the z test is a test of the hypothesis that the coefficient = 0. Instead (since the coefficient is a hazard ratio) it ought to be testing the hypothesis that the coefficient = 1.
Hmmm... That suggests there's a way to alter my code so that could be done! It's only out of my own inexperience (and not out of laziness) that I ask whether anybody might see how to change this bootstrap program to test the hypothesis that the coefficient = 1?
Michael

*--------------- begin code in question -----------------------

*************
* plain cox
*************
* load data and define as survival data
sysuse cancer, clear
stset studytim, failure(died)
* run cox
stcox drug

*************
* bootstrap cox
*************
* load data and define as survival data
sysuse cancer, clear
stset studytim, failure(died)

* define program
capture program drop boot_hr
program define boot_hr, rclass

* cox
stcox drug
indeplist, local
foreach var of varlist `X' {
return scalar `var' = exp(_b[`var'])
}

end

* set seed for reproducibility, since bootstrap is a random sampling
set seed 12358

* run program
bootstrap drug=r(drug), reps(100): boot_hr
*--------------- end code in question -----------------------

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index