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