Suggested answer to exercise: Readmission to hospital for asthmatic children using Stata 9, 2

Question 2: Draw a survival curve for time to readmission to hospital.

Suggested answer

We have time to event data and so we use the st commands. The time variable is "Follow-up time (days)" and the Status variable is "Readmitted". We must first set up the survival time (st) functions usy=ing stset:

. stset time, failure(readmit)

     failure event:  readmit != 0 & readmit < .
obs. time interval:  (0, time]
 exit on or before:  failure

------------------------------------------------------------------------------
     1034  total obs.
        3  event time missing (time>=.)                         PROBABLE ERROR
------------------------------------------------------------------------------
     1031  obs. remaining, representing
      540  failures in single record/single failure data
   526790  total analysis time at risk, at risk from t =         0
                             earliest observed entry t =         0
                                  last observed exit t =       990

We want a survival curve, so we use sts graph. This gives us:

This would be OK for information while doing the analysis, but for publications we would improve it. I would like to give a different title to the time axis, change the vertical axis labels, make the labels horizontal, remove the grid lines, give the vertical axis a title, remove the "Kaplan-Meier survival esimate" title, and scale up all the text:

. sts graph, xtitle("Time from discharge (days)") ylabel(0 (.2) 1, angle(horiz) nogrid)
   ytitle(Proportion not yet readmitted) title("") scale(1.5)


Back to Exercise: Readmission to hospital for asthmatic children.

To Biostatistics in Research Practice index.

To Martin Bland's M.Sc. index.

To Martin Bland's home page.

This page maintained by Martin Bland.
Last updated: 6 February, 2008.

Back to top.