Top Banner
Stata 4, Survival Hein Stigum Presentation, data and programs at: http://folk.uio.no/heins/ 06/16/22 1 H.S.
19

Stata 4, Survival

Feb 09, 2016

Download

Documents

stamos

Stata 4, Survival. Hein Stigum Presentation, data and programs at: http://folk.uio.no/heins/. Agenda. Kaplan-Meier plots Cox regression Example Age at first intercourse. Survival data. Outcome:. Unajusted analysis Kaplan-Meier Regression method Cox-regression. Survival data setup. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Stata 4, Survival

Stata 4, Survival

Hein Stigum

Presentation, data and programs at:

http://folk.uio.no/heins/

04/22/23 1H.S.

Page 2: Stata 4, Survival

Agenda

• Kaplan-Meier plots

• Cox regression

• Example– Age at first intercourse

04/22/23 2H.S.

Page 3: Stata 4, Survival

Survival data

Status TimeNo debut CencoredDebut Event

01 debut age

age

Outcome:

• Unajusted analysis– Kaplan-Meier

• Regression method– Cox-regression

04/22/23 3H.S.

Page 4: Stata 4, Survival

Survival data setup

• Status and timegenerate status=!missing(DebutAge)generate time=DebutAgereplace time=Age if status==0generate time2=time+uniform() avoid ties

• Set and describestset time, failure(status==1) Set datastdes Describe

04/22/23 4H.S.

Page 5: Stata 4, Survival

Setting the timescale

Time = time since diagnosis in years: stset dateexit, failure(dead==1) origin(datediag) scale(365.25)

Time = age in years: stset dateexit, failure(dead==1) origin(datebth) enter(datediag) scale(365.25)

04/22/23 5H.S.

Page 6: Stata 4, Survival

Mathematical functions

• Standard distribution functionsTime to event TDensity f(t)Cumulative density F(t)

• Survival functions

)()(1:Failure

)()(:hazard Cum.

)|()(:Hazard)()(:Survival

0

1

tFtS

dsshtH

tTtTdttPthtTPtS

tdt

04/22/23 6H.S.

Page 7: Stata 4, Survival

Some relationships

))(ln()(

h(t)f(t)

small if )(1)(

)(

)(

)(

)(

tSdtdth

e

tHetF

etS

tH

tH

tH

04/22/23 7H.S.

Page 8: Stata 4, Survival

Kaplan-Meier

• Survival function

• Syntaxsts graph, by(sex) KM survival plotsts test sex log-rank teststci, p(50) by(sex) time to 50% failurests list, at(5 10 30) survival at time 5,…

riskatrfailuresftS jjtt

rf

j

j

j

,),1()(

04/22/23 8H.S.

Page 9: Stata 4, Survival

Kaplan-Meier, all0

.25

.5.7

51

10 15 20 25 30analysis time

Kaplan-Meier failure estimate

sts graph, fail gwood tmin(8) tmax(30) noorigin

Age at 50% failure:stci, p(50)

18.4 (18.1,18.8)

04/22/23 9H.S.

Page 10: Stata 4, Survival

Kaplan-Meier, by sex0.

000.

250.

500.

751.

00

10 15 20 25 30Age

MalesFemales

Kaplan-Meier failure estimates, by gender

sts graph, fail by(gender) tmin(8) tmax(30) noorigin

Age at 50% failure: :stci, p(50) by (gender)Males: 18.6 (18.3,19.0)

Females: 18.1(17.8,18.9)

Log-rank test:sts test genderp-value=0.3

04/22/23 10H.S.

Page 11: Stata 4, Survival

Hazards

0.1

.2.3

.4

10 15 20 25 30analysis time

Smoothed hazard estimates, by gender

sts graph, hazard by(gender) width(2)

04/22/23 11H.S.

Page 12: Stata 4, Survival

Cox regression

...)exp()()( 22110 xbxbththx

hazard baseline RR

• Model

• Syntax– stcox x1 x2

• Proportional hazard test– stcox x1 x2, schoenfeld(sc*) scaledsch(ssc*)– estat phtest, detail– estat phtest, plot(x1)

04/22/23 12H.S.

Page 13: Stata 4, Survival

Full model

stcox gender cohab partfrq

04/22/23 13H.S.

Page 14: Stata 4, Survival

Proportion hazard testSave residuals:stcox gender cohab partfrq, schoenfeld(sc*) scaledsch(ssc*)Test:estat phtest, detail

04/22/23 14H.S.

Page 15: Stata 4, Survival

Smoothed Schoenfeld residualsestat phtest, plot(cohab)

-50

5sc

aled

Sch

oenf

eld

- coh

ab

0 10 20 30 40Time

bandwidth = .8

Test of PH Assumption

04/22/23 15H.S.

Page 16: Stata 4, Survival

Baseline hazard

0.1

.2.3

Sm

ooth

ed h

azar

d fu

nctio

n

10 15 20 25 30analysis time

Cox proportional hazards regression

stcox gender cohab partfrq, basesurv(bsurv) basehc(bhaz) stcurve, hazard at(gender=1 cohab=1 partfrq=0) range(8 30) width(1)

04/22/23 16H.S.

Page 17: Stata 4, Survival

Predicted survivalstcurve, survival at1(gender=1 cohab=1 partfrq=0)

at2(gender=2 cohab=1 partfrq=0)

0.2

.4.6

.81

Sur

viva

l

10 15 20 25 30analysis time

Cox proportional hazards regression

04/22/23 17H.S.

Page 18: Stata 4, Survival

If proptional hazard fails

• Stratified Cox regression

• Separate analysis on time intervals

• Time dependent covariats

• Additive model

04/22/23 18H.S.

Page 19: Stata 4, Survival

Some Cox options

stcox drug age, strata(sex) Stratified

stcox drug age, shared(family) Frailty

stcox drug age, tvc(varlist) Timevar cov

04/22/23 19H.S.