Top Banner

Click here to load reader

Stata 4, Survival

Feb 09, 2016

ReportDownload

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

  • Stata 4, SurvivalHein StigumPresentation, data and programs at:http://folk.uio.no/heins/

    **H.S.

    H.S.

  • AgendaKaplan-Meier plotsCox regression

    ExampleAge at first intercourse**H.S.

    H.S.

  • Survival dataOutcome:Unajusted analysisKaplan-MeierRegression methodCox-regression

    **H.S.

    H.S.

    Ark1

    StatusTime

    No debut0ageCencored

    Debut1debut ageEvent

    StatusTime

    No debutCencored

    DebutEvent

    0age

    1debut age

    Ark2

    Ark3

    Ark1

    StatusTime

    No debut0ageCencored

    Debut1debut ageEvent

    StatusTime

    No debutCencored

    DebutEvent

    0age

    1debut age

    Ark2

    Ark3

    Ark1

    StatusTime

    No debut0ageCencored

    Debut1debut ageEvent

    StatusTime

    No debutCencored

    DebutEvent

    0age

    1debut age

    Ark2

    Ark3

    Ark1

    StatusTime

    No debut0ageCencored

    Debut1debut ageEvent

    StatusTime

    No debutCencored

    DebutEvent

    0age

    1debut age

    Ark2

    Ark3

  • Survival data setupStatus 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 datastdesDescribe

    **H.S.

    H.S.

  • Setting the timescaleTime = 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)**H.S.

    H.S.

  • Mathematical functionsStandard distribution functionsTime to eventTDensityf(t)Cumulative densityF(t)

    Survival functions**H.S.

    H.S.

  • Some relationships**H.S.

    H.S.

  • Kaplan-MeierSurvival function

    Syntaxsts graph, by(sex)KM survival plotsts test sexlog-rank teststci, p(50) by(sex)time to 50% failurests list, at(5 10 30)survival at time 5,**H.S.

    H.S.

  • Kaplan-Meier, allsts graph, fail gwood tmin(8) tmax(30) nooriginAge at 50% failure:stci, p(50)18.4 (18.1,18.8)**H.S.

    H.S.

  • Kaplan-Meier, by sexsts graph, fail by(gender) tmin(8) tmax(30) nooriginAge 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**H.S.

    H.S.

  • Hazardssts graph, hazard by(gender) width(2)**H.S.

    H.S.

  • Cox regressionModel

    Syntaxstcox x1 x2Proportional hazard teststcox x1 x2, schoenfeld(sc*) scaledsch(ssc*)estat phtest, detailestat phtest, plot(x1)**H.S.

    H.S.

  • Full modelstcox gender cohab partfrq**H.S.

    H.S.

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

    H.S.

  • Smoothed Schoenfeld residualsestat phtest, plot(cohab)**H.S.

    H.S.

  • Baseline hazardstcox gender cohab partfrq, basesurv(bsurv) basehc(bhaz) stcurve, hazard at(gender=1 cohab=1 partfrq=0) range(8 30) width(1)**H.S.

    H.S.

  • Predicted survivalstcurve, survival at1(gender=1 cohab=1 partfrq=0)at2(gender=2 cohab=1 partfrq=0)**H.S.

    H.S.

  • If proptional hazard failsStratified Cox regressionSeparate analysis on time intervalsTime dependent covariatsAdditive model**H.S.

    H.S.

  • Some Cox optionsstcox drug age, strata(sex)Stratifiedstcox drug age, shared(family)Frailtystcox drug age, tvc(varlist)Timevar cov

    **H.S.

    H.S.

    ***Stset for more complex data:

    *Dates are usefull in survival setup***If small, H(t)