Presentation is loading. Please wait.

Presentation is loading. Please wait.

SURVIVAL ANALYSIS WITH STATA. DATA INPUT 1) Using the STATA editor 2) Reading STATA (*.dta) files 3) Reading non-STATA format files (e.g. ASCII) - infile.

Similar presentations


Presentation on theme: "SURVIVAL ANALYSIS WITH STATA. DATA INPUT 1) Using the STATA editor 2) Reading STATA (*.dta) files 3) Reading non-STATA format files (e.g. ASCII) - infile."— Presentation transcript:

1 SURVIVAL ANALYSIS WITH STATA

2 DATA INPUT 1) Using the STATA editor 2) Reading STATA (*.dta) files 3) Reading non-STATA format files (e.g. ASCII) - infile varlist using “path_filename” - infile using “path_filename” (when the file includes the dictionary) - use “path_filename”, clear … If there are other data opened!

3 list values of the variables tabulate var 1 var 2 one-way two-way frequency table tab1 var 1 var 2 …. var n tab2 var 1 var 2 …. var n describe varlist Describe the variable features summarize varlist Descrive the variable features by simple summary statistics (mean, standard deviation, median, quartiles) DATA DESCRIPTION tab1 var 1 var 2 …. var n n one-way frequency tables n(n-1)/2 two-way frequency tables

4 Help! help(stata command) …

5 st Need to specify at least survival time (and a failure variable) before you can do any survival analysis: - stset … The st-setting will stay for all following analysis, until another stset is specified! SURVIVAL WITH STATA

6 stset timevar, failure(statusvar) idtimevarstatusvar 1101 2320 3471 failure event: statusvar != 0 & statusvar <. obs. time interval: (0, timevar] exit on or before: failure ------------------------------------------------------------------------ 3 total obs. 0 exclusions ------------------------------------------------------------------------ 3 obs. remaining, representing 2 failures in single record/single failure data 89 total analysis time at risk, at risk from t = 0 earliest observed entry t = 0 last observed exit t = 47 Default origin is 0…if want to change use option origin()

7 SURVIVAL WITH STATA stset timevar, failure(statusvar) idtimevarstatusvar 1101 2320 3471 idtimevarstatusvar_st_d_t_t0 110111 0 232010 0 347111 0

8 - right censoring - stset timevar, failure(statusvar) stset timevar, failure(statusvar) enter(etimevar) - left truncation (delayed entry) - FAILURE AND CENSORING (individual times) idvar timevar statusvar 1 10 1 2 32 0 3 47 1 idvar etimevar timevar statusvar 1 0 17 1 2 0 32 0 3 47 73 1    

9 - time-varying covariate - stset timevar, failure(statusvar) id(idvar) stset timevar, failure(statusvar) exit(time.) id(idvar) - recurrent events - Multiple Observations idvar timevar statusvar x1 x2 1 80 010 3 1100 115 3 2 30 0 7 2 2 70 0 7 3 2 85 0 7 2 idvar timevar statusvar 1 30 1 1 75 1 1136 0 2 46 1 2 65 0 3104 1 X1=10 X1=15 80  100 X2=2 8570 30 X2=3 X2=2 30  75  136 46 65  104 

10 stset timevar, failure(statusvar) enter(etimevar) id(idvar) - discontinuity of the observation - idvar etimevar timevar statusvar 1 0 55 0 230 45 0 3 60 73 1 188 120 0 5588120  30607345 Multiple Observations

11 MAIN COMMANDS FOR SURVIVAL ANALYSIS stset stdes stsum stsplit sts ltable strate stcompet stcox stphplot stcoxkm streg stcurve defines the survival data setting produces data description produces summary measures time is split into intervals of fixed length e.g. 18=[0,5)+[5, 10)+[10,15)+[15,18] plot and list Km and NA estimates of S e  plot and list estimates of S e  for grouped times estimates failure rates estimates the crude incidence of competing risks fits Cox model performs a graphical check of PH assumption contrasts model predicted curves and KM curves fits parametric models plot and list estimated S e 

12 sts sts list, [na] Produces the Kaplan-Meier (KM) estimate of S and Nelson-Aalen (NA) estimate of  sts test Performs a nonparametric tests for the comparison of survival curves sts graph, [na] Plot the estimates sts generate Enable to store results for future elaborations

13 sts list [if exp] [in range] [, by(varlist) na failure at(#|numlist) compare enter level(#)] compare at na failure enter List the estimates at given times NA estimate of the cumulative hazard Estimate of the cumulative incidence (1-S) contrast the estimates according to groups defined in the by statement show the subjects entering and exiting the risk set, useful for delayed entry e.g. at(5 30 100), at(5 10 to 100) sts list

14 lost gwood na cna sts graph [if exp] [in range] [, by(varlist) failure gwood na cna hazard enter atrisk lost censored(single|number|multiple) censored at risk failure hazard enter plots   (na) and confidence bounds (cna) plots (1-S) plots the hazard provide confidence bounds for S or 1-S shows number of censored subjects marks the censored times shows number of at risk shows the number of subjects entering the risk set sts graph

15 sts test varlist [if exp] [in range], {logrank | wilcoxon | tware | peto | fh(p q) } strata(varlist) detail TESTWEIGHTOPTION Log-rank1default Wilcoxon-Gehannini w Tarone-Waretw Peto-PetoP Fleming-Harringtonfh(p q) sts test

16 Year Interval Alive Dead Lost Censored 1946 0-1 9 4 1 0 1947 1-2 4 0 0 0 1948 2-3 4 0 0 4 timevar statusvar freqvar 0.5 1 4 0.5 0 1 2.5 0 4 FAILURE AND CENSORING (grouped times) Life Table

17 ltable timevar statusvar [if exp] [in range], [by(varlist) level(#) sur failure hazard intervals(w|numlist) graph noconf] - Individual times ltable timevar statusvar [freq=freqvar] ….. - Grouped times ltable strate strate [varlist] [if exp] [in range] [, per(#) level(#) graph nowhisker] Enable to calculate the hazard rate per(#) Define the measurement unit of time, e.g. if time is measured in months per(12) enable to interpret results in terms of person years. - Individual times

18 stphplot stphplot [if exp], { by(varname) strata(varname) } [adjust(varlist) nolntime nonegative zero graph_options] adjust for other covariates Plot of -ln(-ln(survival)) against ln(time), according to a discrete variable adjust(varlist) against timenolntime plot of ln(-ln(survival)) nonegative by(varname) variable to check Performs a graphical check of the PH assumption

19 stcox [varlist] [if exp] [in range] [, nohr strata(varnames) robust mgale(newvar) esr(newvars) schoenfeld(newvars) scaledsch(newvars) basehc(newvar) basechazard(newvar) basesurv(newvar) [breslow | efron | exactm | exactp] estimate noshow offset(varname) level(#) maximize_options] strata varlistregressors stcox Fit Cox Regression Models fit stratified Cox model stcoxkm stcoxkm [if exp], by(varname) [separate ties(breslow | efron | exactp | exactm) graph options ] Graphical comparison of model predicted and observed (KM) curves, according to a discrete covariate

20 streg [varlist] [if exp] [in range] ……, dist(distribution) e =Exponential streg Fit Parametric Regression Models stcurve, surv haz cum at (varname=value) … w = Weibull ll = Log-logistic Plot estimated curves at given level of covariates


Download ppt "SURVIVAL ANALYSIS WITH STATA. DATA INPUT 1) Using the STATA editor 2) Reading STATA (*.dta) files 3) Reading non-STATA format files (e.g. ASCII) - infile."

Similar presentations


Ads by Google