He' - huji.ac.ilpluto.mscc.huji.ac.il/~mszucker/BIOSTAT/targil3solution.pdf* Program to run the...

Post on 10-Nov-2020

2 views 0 download

Transcript of He' - huji.ac.ilpluto.mscc.huji.ac.il/~mszucker/BIOSTAT/targil3solution.pdf* Program to run the...

r--~~~-'~:_= ~~' :=~~--~=-- ~-==~~~~===~~L~~-'~:'~--::::':~l:~-~~.~~-~~~~~t:~:2~:~i=~-j_:~~_:~~:~!-:~=.,:~',-:,~, "C" 'I'" 'I \I,. ~~~"f ,"" '1.-e

' ;-"'--_":"'_+---'-- --+-.' 't' ,'-' '1' l-rr"t---+--i-- - a"oM- -t-1-~-+-"";-'-- ' -; - ,I, I ! b1\It, , -'lC>U!i ,\,' "'11'

===:=~-=:~-t--~=--t~::. ===:~~~ ~-~,.__::-:~;~!~:[_~L~=-',~~j = ~: -:-=:: '~: --:=~==.:_:~:,----, I, J:,

!". If" I ,I " 1-

~- -i--~-tt!'<6~a~ '~ '---;rr'-- ---'-'cP---i ' '1\)":-i~ ~T"~-~~ijTr--- --, ---~ .,i i, '!i-'--~-T--i-'---i-'T-!--'~o-i-T 111f~- !~: T1r~--i~--------

"---!i--:'~q--r-=-C~'1M-Frm---T-T-.storcrt-'T--, r;.~t, i ! rr-j--i--t1-:---i-T-;---~--~-i-b:L il-~~ r-Tv~--iT--'--- "t ~Vto-; ~'----"""~bl- t'iL l-~r"':----------------

-:_=; '~' ,.:iin'i==;::===]I-=:-,~~~=-.=:t~~ ,,~,.~1 ~~=~~J=-=~:=--:, 1'1' [} "

--_:'-_:'~===-::::.:-.':~ii':~.? .:~J'::= :~:::_:.:_= j 'I.~:~~~=: :::,-:= '-1:~r-== ~:~:---~=:~_:=:~~,-; :-=-,-,:~-

---'--'--"'--~~: :---"(

,

f,,~~_t~E=J~'~-" <---"'b-t;~o--~' :.~:

t.

,

.~1~~F~:~~--::- ~'Uj'ClO,-J-iT\;r"-"- T--- ~

He' \ i () -=- I ,sf (flQ"I:"~1jr-- "C:' t:

H'o 1(j'~.51r'-_d~' ~'o'd"~hl'- - O' s;

olSi)O'--~'~~1 -< - r 'h

qQS~<)'-~'E1rL_"-' r [<f1<J,$oo' - --'--'.

~','

,,

81r-- ')" tI~.s;<l<:).'~'6br-"-- r fI

I ~r

Cl)~( ~. v kz

. (fC'W 'hl'j Y- - "

:.

'/'-- ,-, Vrl",Ail; ,...

c,'\t'?lrl 1:-. ~J - cY:.. ~) C!li-

""-~2 } ;. s :;.-::x: c.

r "-"v--1 £'\~\.o-I

O-f ~11' C) ~,I

T ~"'- ,v~ 0:-VI) (~

~,: . ~--({tw, pt) <::'

liICJf~t'-::- t ~

q t~ 'tl o-:-.Ii\d'-!_,::J :(r~11~--htr -B

- +.- ... , ----

V"-v"f~~!t9.-.~,:-(S~"Z5(\ o...'o.r:; ,t1~=J~{ >n~Ft'

-". 1<-~~~~-~..~~~- : ..~_~.:?:-~l~~':_~_S~..1'~J .,

'-"'..- - ,'~~:,:_~:~-~-,.~-,::~::-~=~'.~':~:_",,-"=:',-:.-::-:~.~1j:~~~,-_:?_!.!..~~~~-~:=~:_~--:_-g-.~+~~_n~::=_~=:~~:'=::-:-::=-:,. --,.------.......

--, " ,,, .t._- "-o,7Vfv-;,--'" -;-X (1;J.IC~cr-'-+--g'-.~I1?t ~---~~fj"Tr;---f 7.'11-5"t'&'-, ::; ----

~~~~;;~~;;~~fl-~~',:1~1-~~~=~~I~ .'"Hl~~~~'~~~='.'"'?jrJ'S""~'~O1~FWiY~rtrl1T'T;~i~-¥rtTR-'--

,.,

-

,

'

,

.Vi.T«':;',

r--:,

,~], '

,' R" i

"

i

,

~,

-+-

,

.

,

' I' j "-,

' ~

,,

~,

-r ~,

: ---T--i,! :

i ;1,; , i 1," -tt1i' >".::11111 +1::1'---r--~- : I--j -~-t--~

i-J : 1 : i ~,

I'i I ~-Lh-l.r"rn,

..1",

')

i I i ~e-~ ~r-n~t ~n}( t'- ~~f' i+~-~1lf1rJ.Tl---'---, ,--+-- , '

~" ,-+---

: i . 'I j: I i 1 I ! I " I' ,j, ", " I

"j1~'T1 ! ! i j '~i!' i > 0 'I 14o]1'T, 1+1I '\ , !,

/ -~- .--- -;--,----1 1 1

-- --~--- u _-,--.L---,--- --' , -,

:1 ,I, ,, ,- n_--

.- '"

-- --u'- -_u ---- --- .- -----

- -----. ,- -- ----

i---, --T ' ' u_--p--

-----------

- --- u_-

'-0.,I

u-----

_u __n- -- ---------

"

~- b'6--- --- -~,. nQh-- -- QT'i"_-

\ ~-- -~.t;r

---");~- r.~ I-C'O\j~. O-- --- - 71- p- --L'

5- r

...;;J Dh - d__::_-;- ( ft',..,- - - ~:?- -- u- n I

1r-t"LI'~--- "- , -u h):lS'_- --- "1; ~I1:I-

~~2j::.====- ='2 ~!f'O;- -:=~:==-~-- . ~:=-~E ::--.;;-~: ----- c -~---I-, i-tJ:- FI-:;tJ:"-~iT3' "':'__" ! ~I -,---;-- &'~- n," ri-- -

!~~~~!~+~~H~~b~+~~~~f~ytf-Trt,I_-.

' !,! I:! i ~, ! ""I,-r;:~

- I T-T-1- i 1, ~:=hJj4~

,

- .LHjJ

'" J -l

'

'

I'

I ~,

: ',' 1 ',I-

,

-

.J~- _,'R- 1 , 1 " 111 ,-1111' 1 1

:I - I ,,- ~

-"--rrl;'~ l-""';'--+- _!,,' I !' ,

,-:u=r-" -+---~ J_-, , ~-- u-

-- I '; I' Iil.~ c;. I ~ I I I :,': I I I j~ '!I

' I

- ---"--~ ,, 1 ;;' ' I" I I ,-

,I I T' i -' '" 'I ' ,- c "

i' ,I I' . i ",,' i Im-: ';"-J--:-;-- , ~- ' J I ' I i ~ 5) i i i --:-+-

I"

i,

i I I I I'

"

'7

,

I -,

'

,

1~W+,

WI-t,~J- VlJ I-j n-r i tr' l 1- I-!-i ,--'f"nl--~ .

'--~---,

:-'--------

, -' , \: ,.> '1' i\ -r'I~J I:'" 18' ' , ! --L-.L.-: ' i

Lf+h'

1

I i,

'

I"

,

, - '~!; J'III: ,

",

!~"

',

,,-,~~_--,

- I " I I I I : ~ ---I ' ! ' , i.;1 -v, , I'" I I i--:

,,

'

-LLU'~~

I

I 1---4-.-1I I i ' I !-ri-L,

---t-h 1' i :i

,

: '-rrt-+-,

...L -j

,

--"'~

,

'-,J._.;.., ---

-~, ':I-il",4'1 1,I'-~ -r J,.",,+-J'I!~'!!'i'

I '

U ' ~---, , " , ,---,-~ L" I"" '---1 15", ;--' ~-+--j,-" ---"- '; ! : :=jJ~~-~~~F~==;=~~~~r~~_~-~+~-~=~-- ..J~ ' "-- ' , , I - N, - """J: r"1---r-c1'---@'-,/\~;:~i-L;' 1 1 I ! I i : i , c-:--ri--:--i'--i i" ~+--+--'~',----~"",--_,--"'~--"-' ""'-+-I~_1~~-r-", j ,,~ ,,- I '" ,--~~"-~ ~ ' , '- ' I ~~-I I---+---j j :---l---: i

-- - .,__- - _,__,-

_,-

__nu , ,

- -,-'-

J-- ------ - - - - -

------

---------

~iV~~---f1 Cl .I

Co, o!)J( (~o!. ~\~Ll,v

-, ).-~ ~Ci -I)(-i -I)C~ -\)( t.;-1) (~ -I) )l

"1.1. -,'~: o"~'i ~-';, [~1J tJ'~1 fI~-. . ~.:

( ~~~~ - I)(~~ - n (ri' - I) '"

5'1/ 0'11 ~'b J't ~'?

--------------.

I

I

. !i

I

I

()~o

pt' ~ tr~ :) c-W~- n :. ("~) .\( ~): -- I )

,

:. i

~ i.~Lt~

1

I

I+I

hI

-~-- - -' --------

(~-J)(->.!;! -I)~~ -l)(~~-\)('~ -I)(.~ -1)\°7-1)..s', .f5 ('S ,,'t. .5'1: t', "0

r~

~t. '- ,

~

~A'::";;f't~

.'1-I -

[ b hb<fO (~50 t. 'e) J

rlC;c:. fI/?lj'V ,f(./)o c.c'?/ J,.t'/( (hAl)S~

C?; }-f~1;>00'() (3 ~s 't GO.O J[~akk':b-d ( b o~1"5 -'0 J

'i<! 1V'~f jCoO c.!.c'?/ct.J- '< :

Cs IS b-f::'h- ( f,C)~b'3 - J01 f,S'o :J..-5 b~'5 -

LJt1~ J '- tlVtV C' L,e" y(J Ni ( le:( ..

[ <i hCO{'0 (515~'0 Jr (-t~y,IQa"J..hj,tJ- ~ «(~q-'ttQO-)(h11IJ-'d ]Coo:n

<i~ 15°0 ":.

(h95).,OO'O)(hhD- -0~ (hhlJ 5v

C~~~-baO(lO (-t~9.,100 .OJ

(~--t2:/00110)(~b -0 -:j:. j,~.sh 00 6r?

~ (~) )~ ~ 9b -I ~ ~GuO r- '( :

~-<31 )l h~J,g -I -=- (. ( ~J.)/ * ~ -=- (~) )V)~

t?9ShQO.O = 4-'1:/.({ '-'; '<. '\J

0 Ih~ ~ I ~1 +- ~1:-1 T ~9] +.. .. +;'5 +~) + 9 + (f -=-..'1..

c' (NtJe/c' c..?).("I9-,C1j 11:. StJ

co,,,

"'1

~ C;,,]

~

~-~ ---

\ Q/le djtr lJ)() ( tJ Jf\)( '<) b.1 :+; \" 'lI v I Vt'YGC !Le. c'::/ i.!. :

"re 7J( y:ri veil Q 9f IG', f- Y !f On L C,}0 r-

* Program to run the parametric models *;

options ls=80;

data indat;

infile 'd:\survival\mrfit.dat';

input age 1-2 dbp 3-5 sbp 6-8 race 9 diab 10 chol 11-13 Gigs

exyr 16-17 exmo 18-19 exday 20-21 fyrs 22-23 icd9 24-27

dyr 28-29 dmo 30-31 dday 32-33 died 34;

exdate = mdy(exmo,exday,exyr);

ddate = mdy(dmo,dday,dyr);

fdate = mdy(12,31,90);

time = min(fdate,ddate) - exdate;

time = time / 365.25;

14-15

~~~tJ A'tI'tJ 11i"d

proc lifereg;

model time*died(O) = / dist=exponential;

proc lifereg;

model time*died(O) = / dist = weibull;

proc lifereg;

model time*died(O) = / dist = lognormal;

run;

-~- ~-

,-

The SAS System

The LIFEREG Procedure

Model Information

Data Set

Dependent Variable

Censoring Variable

Censoring Value(s)Number of Observations

Noncensored Values

Right Censored ValuesLeft Censored Values

Interval Censored Values

Name of Distribution

Log Likelihood

Algorithm converged.

Variable EstimateDF

InterceptScale

10

3.592021 .00000

WORK.INDAT

Log(time)died

0

5440

1989

3451

0

0

EXPONENT

-5285.705847

Analysis of Parameter Estimates

Standard

Error Chi-Square Pr > ChiSq Label

0.02242 25663.2812

0

<.0001 Intercept

Extreme value scale

Lagrange Multiplier StatisticsVariable Chi-Square Pr > ChiSq

Scale 280.8776 <.0001

~.

~~-----

The SAS System

The LIFEREG Procedure

Model Information

Data Set

Dependent Variable

Censoring Variable

Censoring Value(s)

Number of Observations

Noncensored Values

Right Censored Values

Left Censored Values

Interval Censored Values

Name of Distribution

Log Likelihood

Algorithm converged.

Variable EstimateOF

Intercept

Scale

11

3.361310.74919

WORK.INDAT

Log(time)

died0

544019893451

00

WEIBULL-5202.499725

Analysis of Parameter Estimates

Standard

Error Chi-Square Pr > ChiSq Label

0.02214 23043.9817

0.01595<.0001 Intercept

Extreme value scale

~---

The SAS System

The LIFEREG Procedure

Model Information

Data Set

Dependent Variable

Censoring Variable

Censoring Value(s)Number of Observations

Noncensored Values

Right Censored ValuesLeft Censored Values

Interval Censored Values

Name of Distribution

Log Likelihood

Algorithm converged.

r-

WORK.INDAT

Log(time)died

0

5440

1989

3451

0

0

LNORMAL

-5296.048383

Analysis of Parameter Estimates

Variable EstimateDF

InterceptScale

11

3.27958

1.35152

Standard

Error Chi-Square Pr > ChiSq Label

0.02746 14265.7131

0.02417<.0001 Intercept

Normal scale

* Program to take the results of the parametricanalysis and plot the parametric survival curvesvs. the KMsurvival curve. The relevant parametervalues are copied off of the printout from theparametric model analyses. *;

options ls=80;

filename gsasfile 'd:\survival\scurv.ps';goptions

device=psgsfname=gsasfilegsfmode=replacegsflen=80colors=(black);

symbo11 i=j line=1;symbo12 i=j line=2;axis1 length=5.5in label=('Kaplan-Meier');axis2 length=5.5in label=('Parametric Model');

data indat;infile 'd:\survival\mrfit.dat';input age 1-2 dbp 3-5 sbp 6-8 race 9 diab 10 chol 11-13 Gigs

exyr 16-17 exmo 18-19 exday 20-21 fyrs 22-23 icd9 24-27dyr 28-29 dmo 30-31 dday 32-33 died 34;

exdate = mdy(exmo,exday,exyr);ddate = mdy(dmo,dday,dyr);fdate = mdy(12,31,90);time = min(fdate,ddate) - exdate;time = time /365.25;

proc lifetest noprint notable outsurv=new method=km;time time*died(O);

data new2; set new;if _censor_=1 then delete;if time=O then delete;exppar = 3.59202;exp_lam = exp(-exppar);weipar1 = 3.36131;weipar2 = 0.74919;wei_lam = exp(-weipar1);wei_p = 1/weipar2;exp_fail = 1 - exp(-exp_lam*time);wei_fail = 1 - exp(-(wei_lam*time)**wei_p);km_fail = 1 - survival;Inmu = 3.27958;Insig = 1.35152;In_fail = probnorm((log(time)-lnmu)/lnsig);

keep time exp_fail wei_fail In_fail km_fail;

proc plot;

14-15

~- -------

plot exp_fail*km_fail='*';

plot wei_fail*km_fail='*';

plot In_fail*km_fail='*';

data pdat;

set;

model = 'Exponential';

legend= 'Graph';par_fail = exp_fail;

output;

legend = 'Reference';

par_fail = km_fail;

output;

model = 'Weibull';

legend= 'Graph';par_fail = wei_fail;

output;legend = 'Reference';

par_fail = km_fail;

output;

model = 'Lognormal';

legend= 'Graph';par_fail = In_fail;

output;legend = 'Reference';

par_fail = km_fail;

output;

proc sort; by model time;

proc gplot; by model;

plot par_fail*km_fail=legend / haxis=axis1 vaxis=axis2 frame;

run;

~5~M

" /'.

5E/lfo ) ~ LN"-

? ~)')T SWt;/oJ!-e

>J( ~11,v ~.,.

-J;")U ~\£j'

1)(;>

Wfl~\J11

I /I J~ J ~")a ?

,~ ?/r.Jj rS

SlltV i)

,;.[",/ ~/.)'~JJ~ Jrl (

/I .Y' '( fV ;'\

-N A,Go '.:) ,.o'I"'J ))\aJd~

"-

.S ~M -J

Jr \(;. j)J!J'J~

-flJ £lJfV' A J le.

lltN

S J IN ? ,

The SAS System

exp_fail0.4

0.3

0.2

0.1

0.0

0.0000

**

~

Plot of exp_fail*km_fail. Symbol u~ed i$ '*',

*****

*****

****

***

****

****

****

****

***

***

****

***

**

**

0.0647 O. 1294 0 . 1941

km fail

NOTE: 1606 obs hidden.

*****

*****

****

****

0.2588

*****

0.3235

*****

****

*****

0.3882

7'

The SAS System

Plot of wei fail*km fail. Symbol used is '*'

wei fail0.4

*******

********

****

0.3 ********

****

****

***

****

0.2 ****

****

****

***

****

***

0.1 *****

*******

********

***0.0 ***

0.0000 0.0647 O. 1294 0 . 1941 0.2588 0.3235 0.3882

km fail

NOTE: 1605 obs hidden.

-~ --

The SAS System

Plot of In fail*km fail.- - Symbol used 1S '*'

In fail0.4

********

***********

0.3 **********

*********

*********

0.2 ********

*******

*******

0.1 ******

*******

*******

0.0 ***

0.0000 0.0551 0.1103 O.1654 0.2206 0.2757 0.3309 0.3860

km fail

NOTE: 1603 obs hidden.

-- -- -- --- ----

Parametric

model=Exponential

Model0.390.380.370.360.350.340.330.320.310.300.290.280.270.260.250.240.230.220.210.200.190.180.170.160.150.140.130.120.110.100.090.080.070.060.050.040.030.020.010.00

I .

0.00

....,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

",

0.20 0 .25 0.300 .05 0.10 0.15

Kaplan-Meier

legend Graph nn_n. Reference

",,,,,,,,,,,.'.'

0.35 0.40

Parametric Model0.390.380.370.360.350.340.330.320.310.300.290.280 . 270.260 .250.240.230.220.210.200.190.180.170.160.150.140.130.120.110.100.090.080.070.060.050 . 040.030.020.010 .00

I .0.00

model=Weibull

0.05

legend

0.10 0.40

Graph

0.15 0.20 0.25 0.30

Kaplan-Meier

nnn_. Reference

0.35

Parametric Model0.390.380.370 . 360.350.340.330.320.310.300.290.280.270.260.250.240.230.220.210.200.190.180.170.160.150.140 . 130.120.110.100.090.080.070.060.050.040.030.020.010.00

I .0.00

legend

model=Lognormal

.,-,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"",

"~

0.05 0.10 0.15 0.20 0.25 0.30

Kaplan-Meier

Graph Reference

,-,,,,,,,,,,,, .'.

0 . 35 0.40