window push *!!!!!!!!!!!!! Program broken as of Nov 2009 window push version 11 window push set more on window push log using Framingham.Spline2.log, replace window push * Framingham.Spline2.log window push * window push * Proportional hazards regression analysis of the effect of gender and window push * baseline diastolic blood pressure (DBP) on coronary heart disease (CHD) window push * adjusted for age, body mass index (BMI) and serum cholesterol (SCL). window push * Use restricted cubic splines to model the effect of DBP on CHD risk window push * Delete patients with DBP > 110. window push * window push set more on window push set memory 2000 window push use C:\WDDtext\2.20.Framingham.dta, clear window push drop if dbp > 110 window push * window push * Lets use a DBP of 60 as a reference blood pressure observed for window push * both men and women. window push * window push * Univariate analysis of the effect of DBP on CHD window push * window push generate time= followup/365.25 window push label variable time "Follow-up in Years" window push stset time, failure(chdfate) window push sort dbp window push generate dbp60 = dbp - 60 window push rc_spline dbp60 window push stcox _S* window push predict relhaz, hr window push line relhaz dbp window push more window push predict loghaz, xb window push predict se, stdp window push generate logcil = loghaz - 1.96*se window push generate logciu = loghaz +1.96*se window push graph twoway rarea logcil logciu dbp60 || line loghaz dbp60 window push more window push generate cil = exp(logcil) window push generate ciu = exp(logciu) window push graph twoway rarea cil ciu dbp || line relhaz dbp window push more window push * window push * truncate upper error band window push * window push egen maxhaz = max(loghaz) window push drop ciu window push generate ciuchop = exp(min(logciu,maxhaz)) window push graph twoway rarea cil ciuchop dbp, color(gs14) /// window push || line relhaz dbp /// window push , legend(ring(0) position(11)) window push more window push drop relhaz loghaz se logcil logciu cil ciu maxhaz ciuchop window push generate male = sex==1 window push gen _Sdbp601male = _Sdbp601*male window push gen _Sdbp602male = _Sdbp602*male window push gen _Sdbp603male = _Sdbp603*male window push gen _Sdbp604male = _Sdbp604*male window push stcox _S* male age bmi scl window push replace age=0 window push replace bmi = 0 window push replace scl = 0 window push predict relhaz, hr window push gen relhazmen = relhaz if male window push gen relhazwomen = relhaz if ~male window push line relhazmen dbp, color(blue) || line relhazwomen dbp, color(red) window push more window push predict loghaz, xb window push gen loghazmen = loghaz if male window push gen loghazwomen = loghaz if ~male window push predict se, stdp window push gen semen = se if male window push gen sewomen = se if ~male window push generate logcimenl = loghazmen - 1.96*semen window push generate logcimenu = loghazmen + 1.96*semen window push generate logciwomenl = loghazwomen - 1.96*sewomen window push generate logciwomenu = loghazwomen +1.96*sewomen window push graph twoway rarea logcimenl logcimenu dbp60 /// window push || rarea logciwomenl logciwomenu dbp60 /// window push || line loghazmen dbp60 /// window push || line loghazwomen dbp60 window push more window push *!!!!! The following three lines have been commented out because logcil is undefined window push *generate cil = exp(logcil) window push *generate ciu = exp(logciu) window push *graph twoway rarea cil ciu dbp || line relhaz dbp window push more window push * window push * truncate upper error band window push * window push egen maxhaz = max(loghaz) window push drop ciu window push generate ciuchop = exp(min(logciu,maxhaz)) window push graph twoway rarea cil ciuchop dbp, color(gs14) /// window push || line relhaz dbp /// window push , legend(ring(0) position(11)) window push window push window push stop window push * window push * Univariate analysis of the effect of gender on CHD window push * window push sts graph, by(sex) clpattern(solid dash) clcolor(blue pink) /// window push clwidth(medthick medthick) ytitle(Cumulative CHD Morbidity) /// window push xtitle("Years of Follow-up") xlabel(0(5)30) failure /// window push ylabel(0(.1).5, angle(0)) legend(ring(0) position(11) col(1)) window push more window push sts test sex window push codebook sex window push generate male = sex==1 window push tabulate male sex window push stcox male window push * window push * To simplify the analyses let us use fewer DBP groups window push * window push generate dbpg2 = recode(dbp,60,90,110,111) window push tabulate dbpg2 window push stcox i.dbpg2 window push * window push * How do gender and baseline DBP affect CHD? window push * window push sort sex window push by sex: tabulate dbpg2 chdfate ,row window push * window push * Fit multiplicative model of DBP and gender on risk of CHD window push * window push stcox i.dbpg2 male window push display 2*(11740.729 -11672.032) window push display chi2tail(1,137.394) window push window push lincom 90.dbpg2 + male , hr window push lincom 110.dbpg2 + male , hr window push lincom 111.dbpg2 + male , hr window push window push * window push * Fit model of DBP and gender on risk of CHD using interaction terms window push * window push stcox dbpg2##male window push display 2*( 11672.032 -11667.275) window push display chi2tail(3, 9.514) window push lincom 90.dbpg2 + 1.male + 90.dbpg2#1.male, hr window push lincom 110.dbpg2 + 1.male + 110.dbpg2#1.male, hr window push lincom 111.dbpg2 + 1.male + 111.dbpg2#1.male, hr window push * window push * Adjust model for age, BMI and SCL window push * window push stcox dbpg2##male age window push display 2*(11667.275 -11528.829) window push display chi2tail(1,276.892) window push stcox dbpg2##male age bmi window push display 2*(11528.829 -11500.155 ) window push display chi2tail(1,57.348) window push stcox dbpg2##male age bmi scl, mgale(mg) window push display 2*(11500.155 -11390.412) window push display chi2tail(1,219.486) window push lincom 90.dbpg2 + 1.male + 90.dbpg2#1.male, hr window push lincom 110.dbpg2 + 1.male + 110.dbpg2#1.male, hr window push lincom 111.dbpg2 + 1.male + 111.dbpg2#1.male, hr window push * window push * Perform Cox-Snell generalized residual analysis window push * window push predict cs, csnell window push stset cs, failure(chdfate) window push sts generate km=s window push generate es = exp(-cs) window push label variable cs "Cox-Snell Generalized Residual" window push * window push * Plot km and es as a function of cs window push * window push sort cs window push line km cs, clwidth(medthick) clcolor(red) /// window push || line es cs, clwidth(medthick) clcolor(blue) /// window push ||, ylabel(0(.2)1) ytick(0(.1)1) xlabel(0(.5)2.5) xtick(.25(.5)3) /// window push legend(ring(0) position(1) col(1)) ytitle("Proportion without CHD") window push log close