Model type | Commands to convert dataset as formatted in Extract 2 to a format suitable for model fitting | Description of commands to convert dataset | Commands to fit models | Description of commands to fit models |
---|---|---|---|---|
Time to first event Cox | stset End, failure(Failure==1) id(ID) origin(time Clinic) enter(time Clinic) scale(365.25) time0(Start) | origin(time Clinic) and enter(time Clinic) specify that the individual first becomes at risk after the clinic date | stcox varlist | varlist represents a list of predictor variables in the model |
Andersen and Gill | stset End, failure(Failure==1) id(ID) origin(time Clinic) enter(time Clinic) scale(365.25) time0(Start) exit(time.) | scale(365.25) ensures that time is measured in years as opposed to days | stcox varlist, efron robust | efron specifies the use of the Efron method for analysing ties in the data |
Prentice, Williams and Peterson Total Time | stset End, failure(Failure==1) id(ID) origin(time Clinic) enter(time Clinic) scale(365.25) time0(Start) exit(time.) | time0(Start) specifies that 'Start' is the beginning of the time interval spanned by each record | stcox varlist, efron robust strata(Risk_set) | robust specifies that robust variance estimation is used to account for within-subject correlation of failure times |
exit(time.) ensures that an individual’s failures after the first are also recognised | strata(Risk_set) ensures that a stratified cox model is fitted with a different underlying risk for each ordered failure event |