window push version 10.0 window push set more on window push log using Framingham.age.log, replace window push * Framingham.age.log window push * window push * Plot Kaplan-Meier cumulative CHD morbidity curves as a function of age. window push * Patients from the Framingham Heart Study enter the analysis when they window push * reach the age of their baseline exam. window push * window push use C:\WDDtext\2.20.Framingham.dta, clear window push histogram age, bin(39) fraction ylabel(0(.01).04) xlabel(30(5)65) window push more window push generate time= followup/365.25 window push label variable time "Follow-up in Years" window push generate exitage = age+time window push stset exitage, enter(time age) failure(chdfate) window push sts graph, by(sex) failure ytitle(Cumulative CHD Morbidity) xtitle(Age) /// window push ylabel(0(.1).8, angle(0)) legend(ring(0) position(11) col(1)) /// window push plot1opts(color(blue) lwidth(medthick)) /// window push plot2opts(color(pink) lwidth(medthick)) xlabel(30(10)90) noorigin window push more window push * window push * Compare Kaplan-Meier curve with best fitting survival curves under the window push * proportional hazards model. window push * window push stcoxkm, by(sex) obs1opts(symbol(none) color(blue)) /// window push pred1opts(symbol(none) color(blue) lpattern(dash)) /// window push obs2opts( symbol(none) color(pink)) /// window push pred2opts(symbol(none) color(pink) lpattern(dash)) /// window push xtitle(Age) legend(ring(0) position(7) col(1)) window push more window push * window push * Draw log-log plots to assess the proportional hazards assumption. window push * window push stphplot, by(sex) nolntime plot1opts(symbol(none) color(blue)) /// window push plot2opts(symbol(none) color(pink)) /// window push xtitle(Age) legend(ring(0) position(2) col(1)) window push more window push log close