Presentation is loading. Please wait.

Presentation is loading. Please wait.

Stata 4, Survival Hein Stigum Presentation, data and programs at: Jun-151H.S.

Similar presentations


Presentation on theme: "Stata 4, Survival Hein Stigum Presentation, data and programs at: Jun-151H.S."— Presentation transcript:

1 Stata 4, Survival Hein Stigum Presentation, data and programs at: http://folk.uio.no/heins/ Jun-151H.S.

2 Agenda Kaplan-Meier plots Cox regression Example –Age at first intercourse Jun-152H.S.

3 Survival data Outcome: Unajusted analysis –Kaplan-Meier Regression method –Cox-regression Jun-153H.S.

4 Survival data setup Status and time generate status=!missing(DebutAge) generate time=DebutAge replace time=Age if status==0 generate time2=time+uniform()avoid ties Set and describe stset time, failure(status==1)Set data stdesDescribe Jun-154H.S.

5 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) Jun-155H.S.

6 Mathematical functions Standard distribution functions Time to eventT Densityf(t) Cumulative densityF(t) Survival functions Jun-156H.S.

7 Some relationships Jun-157H.S.

8 Kaplan-Meier Survival function Syntax sts graph, by(sex)KM survival plot sts test sexlog-rank test stci, p(50) by(sex)time to 50% failure sts list, at(5 10 30)survival at time 5,… Jun-158H.S.

9 Kaplan-Meier, all sts graph, fail gwood tmin(8) tmax(30) noorigin Age at 50% failure: stci, p(50) 18.4 (18.1,18.8) Jun-159H.S.

10 Kaplan-Meier, by sex 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 gender p-value=0.3 Jun-1510H.S.

11 Hazards sts graph, hazard by(gender) width(2) Jun-1511H.S.

12 Cox regression hazard baselineRR Model Syntax –stcox x1 x2 Proportional hazard test –stcox x1 x2, schoenfeld(sc*) scaledsch(ssc*) –estat phtest, detail –estat phtest, plot(x1) Jun-1512H.S.

13 Full model stcox gender cohab partfrq Jun-1513H.S.

14 Proportion hazard test Save residuals: stcox gender cohab partfrq, schoenfeld(sc*) scaledsch(ssc*) Test: estat phtest, detail Jun-1514H.S.

15 Smoothed Schoenfeld residuals estat phtest, plot(cohab) Jun-1515H.S.

16 Baseline hazard stcox gender cohab partfrq, basesurv(bsurv) basehc(bhaz) stcurve, hazard at(gender=1 cohab=1 partfrq=0) range(8 30) width(1) Jun-1516H.S.

17 Predicted survival stcurve, survival at1(gender=1 cohab=1 partfrq=0) at2(gender=2 cohab=1 partfrq=0) Jun-1517H.S.

18 If proptional hazard fails Stratified Cox regression Separate analysis on time intervals Time dependent covariats Additive model Jun-1518H.S.

19 Some Cox options stcox drug age, strata(sex)Stratified stcox drug age, shared(family)Frailty stcox drug age, tvc(varlist)Timevar cov Jun-1519H.S.


Download ppt "Stata 4, Survival Hein Stigum Presentation, data and programs at: Jun-151H.S."

Similar presentations


Ads by Google