Here is a crude little program to do this. (There is
an old package we sometimes use called Epilog that
provides point-wise KM curve comparisons). Hence the
name of the program epiwald because this is a standard
test of the form of an estimate divided by a standard
error. This is the way that I have seen this done.
Informally, it is like saying that two population
standard errors are known. H0 mu1 = mu2 vs mu1 ~= mu2.
-Allen Buxton
capture program drop epiwald
program define epiwald
version 7.0
args m1 s1 m2 s2
local d = abs(`m2' - `m1')
local s = sqrt(`s1'^2 + `s2'^2)
local z = `d'/`s'
local p = 2*(1-norm(`z'))
local p1 = 1*(1-norm(`z'))
foreach Number in m1 s1 m2 s2 s z p p1 {
local txt = `"``Number''"'
local `Number'=(round(`txt'*10000)/10000)
}
di `"mu1=`m1', mu2=`m2', std1=`s1', std2=`s2'"'
di `"difference=`d', std=`s'"'
di `"z-value=`z'"'
di `"p-value=`p'"'
di `"p-1side=`p1'"'
di `""'
end
Example:
. sts list , by(contx_g0) at(6,12,48)
failure _d: event_i == 1 2
analysis time _t: event_d/30.4375
Beg. Survivor
Std.
Time Total Fail Function
Error [95% Conf. Int.]
-------------------------------------------------------------------------------
bmt
6 12 5 0.6875
0.1159 0.4046 0.8563
12 10 2 0.5625
0.1240 0.2954 0.7622
48 4 1 0.4922
0.1269 0.2355 0.7064
chm
6 6 1 0.8333
0.1521 0.2731 0.9747
12 4 2 0.5000
0.2041 0.1109 0.8037
48 2 1 0.3333
0.1925 0.0461 0.6756
-------------------------------------------------------------------------------
Note: Survivor function is calculated over full data
and evaluated at
indicated times; it is not calculated from
aggregates shown at left.
. epiwald .6875 .1159 .8333 .1521
mu1=.6875, mu2=.8333, std1=.1159, std2=.1521
difference=.1458, std=.1912
z-value=.7625
p-value=.4458
p-1side=.2229
. epiwald .5625 .1240 .5000 .2041
mu1=.5625, mu2=.5, std1=.124, std2=.2041
difference=.0625, std=.2388
z-value=.2617
p-value=.7935
p-1side=.3968
--- "Wagner, Joseph" <[email protected]> wrote:
>
> I have been asked to test the difference between two
> lines on a KM graph
> at 5, 10, and 15 year points. I had originally
> intended to use -sts
> test- but there isn't the option -at(5 10 15)- like
> there is with -sts
> list- (but the option -test- isn't allowed when the
> -at- option is used)
> and I prefer to not create new variables for 5, 10,
> 15 year endpoints.
> I am at a loss how to do this. Ideally, I want a
> single graph with the
> test coefficient at each 5 year point. (I am using
> version 8)
>
> Here are my -stset- and -stcox- statements:
>
> stset datelr, id(patkey) failure(death_yn)
> origin(dxdate) scale(365.25)
> stcox type agedxfr race sex, nolog
> sts list, by(type) adjustfor(agedxfr race sex)
> compare at(5 10 15)
>
>
> I have considered using different -exit- options
> with -stset- but I
> don't think you can specify an exit of 5 years
> post-entrance. Correct
> me if I am wrong.
>
>
>
>
>
> *
> * 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/
>
*
* 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/