****************************************************** ************************ALL MEN*********************** ****************************************************** ******************Descriptive tabeller****************** use "E:\workdata\706364\Terese\Data\Nyt\alle_DCD_var.dta", clear tab c_age if c_age <19 mean c_age tab demens_samlet, m *crosstab tab IQ10cat demens_samlet, m row tab edu4cat demens_samlet, m row tab cohort demens_samlet, m row tab c_district_ny demens_samlet, m row summarize(c_height) sort IQ10cat tab IQ10cat, summarize(c_height) sort edu4cat tab edu4cat, summarize(c_height) sort cohort tab cohort, summarize(c_height) sort c_district_ny tab c_district_ny, summarize(c_height) gen entry_age = (entry - bdate)/365.25 mean entry_age *********COX ANALYSER********* stset exit, failure(demens_samlet) id(pnr) origin(bdate) entry(entry) scale(365.25) stsum *Model 1 stcox height_SD y c_age i.c_district_ny, strata(y) cluster(v_mor_pnr) *Model 2a stcox height_SD i.edu4cat y c_age i.c_district_ny, strata(y) cluster(v_mor_pnr) *Model 2b stcox height_SD i.IQ10cat y c_age i.c_district_ny, strata(y) cluster(v_mor_pnr) *Model 3 stcox height_SD i.IQ10cat i.edu4cat y c_age i.c_district_ny, strata(y) cluster(v_mor_pnr) ********************** ***Test of assumptions ********************** stcox height_SD, schoenfeld(sch*) scaledsch(sca*) stphtest, plot(height_SD) msym(oh) stcox c_age, schoenfeld(sch*) scaledsch(sca*) stphtest, plot(c_age) msym(oh) stphplot, by(IQ10cat) stphplot, by(edu4cat) *************************** ***Over and below 60 years *************************** stsplit nyalder2, at(60) tab demens_samlet if nyalder2 == 0 tab demens_samlet if nyalder2 == 60 replace demens_samlet = 0 if demens_samlet == . *Model 3 stcox height_SD i.IQ10cat i.edu4cat c_age i.c_district_ny if nyalder2 == 0, strata(y) cluster(v_mor_pnr) *Model 3 stcox height_SD i.IQ10cat i.edu4cat c_age i.c_district_ny if nyalder2 == 60, strata(y) cluster(v_mor_pnr) ********** *Splines ********** use "E:\workdata\706364\Terese\Data\Nyt\alle_DCD_var.dta", clear stset exit, failure(demens_samlet) id(pnr) origin(bdate) entry(entry) scale(365.25) stsum rc_spline height_SD, nknots(4) stcox _Sheight_SD1 _Sheight_SD2 _Sheight_SD3 i.IQ10cat i.edu4cat c_age i.c_district_ny, strata(y) splinecenter , firstvar(height_SD) firstcovs(3) ref(0.0) alpha(0.975) exp(1) twoway (rarea lo hi height_SD, color(gs13)) (line bv height_SD, lcolor(black) lpattern(solid) xlabel(-2 -1 0 1 2,tposition(inside)) yscale(log) yline(1) graphregion(color(white)) ytitle(HR)) if height_SD >-2 & height_SD<2 ****************************************************** ************************BROTHERS********************** ****************************************************** use "E:\workdata\706364\Terese\Data\Nyt\brothers_DCD.dta", clear ******************Descriptive tabeller****************** sort IQ10cat tab IQ10cat, summarize(c_height) sort edu4cat tab edu4cat, summarize(c_height) sort cohort tab cohort, summarize(c_height) sort c_district_ny tab c_district_ny, summarize(c_height) ***********************COX ANALYSER****************** stset exit, failure(demens_samlet) id(pnr) origin(bdate) entry(entry) *Model 3 stcox height_SD i.IQ10cat i.edu4cat y c_age i.c_district_ny, cluster(v_mor_pnr) *Model 3 stcox height_SD i.IQ10cat i.edu4cat y c_age i.c_district_ny, strata(v_mor_pnr) **Test of assumptions stcox height_SD, schoenfeld(sch*) scaledsch(sca*) stphtest, plot(height_SD) msym(oh) stcox c_age, schoenfeld(sch*) scaledsch(sca*) stphtest, plot(c_age) msym(oh) stphplot, by(IQ10cat) stphplot, by(edu4cat) ************************************************ *********************TWINS********************** ************************************************ use "E:\workdata\706364\Terese\Data\Nyt\twins_DCD.dta", clear ******************Descriptive tabeller****************** tab IQ10cat demens_samlet, m row tab edu4cat demens_samlet, m row tab cohort demens_samlet, m row summarize(c_height) sort IQ10cat tab IQ10cat, summarize(c_height) sort edu4cat tab edu4cat, summarize(c_height) sort cohort tab cohort, summarize(c_height) sort c_district_ny tab c_district_ny, summarize(c_height) tab demens_samlet ***********************COX ANALYSER****************** stset exit, failure(demens_samlet) id(pnr) origin(bdate) entry(entry) stcox height_SD i.IQ10cat i.edu4cat y c_age i.c_district_ny, cluster(twinpairno) stcox height_SD i.IQ10cat i.edu4cat y c_age i.c_district_ny, strata(twinpairno) **Test of assumptions stcox height_SD, schoenfeld(sch*) scaledsch(sca*) stphtest, plot(height_SD) msym(oh) stcox c_age, schoenfeld(sch*) scaledsch(sca*) stphtest, plot(c_age) msym(oh) stphplot, by(IQ10cat) stphplot, by(edu4cat)