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