****Lab14_2004**POisson regression model for no of seizures in Prograbide Study*** * Read in seizure data and create stata data set set memory 40m infile id seiz time tx base age using "C:\Documents and Settings\Yijie\My Documents\ldata\lab14\seize.data.txt" label var id "subject ID" label var seiz "number of seizures" label var time "two week post-tx interval" label var base "no. of seizures in 8 wks. before tx" label var tx "tx (1=progabide,0=pbo)" label var age "age (yrs)" compress order id time age tx base seiz des list in 1/12 save "C:\Documents and Settings\Yijie\My Documents\ldata\lab14\seize.dta" * Now make long data set * Observation for baseline drop seiz drop if (time > 1) replace time = 0 ren base seiz gen length = 8 compress des save "C:\Documents and Settings\Yijie\My Documents\ldata\lab14\baseseize.dta", replace clear * Long data set for follow-up use "C:\Documents and Settings\Yijie\My Documents\ldata\lab14\seize.dta", clear drop base gen length = 2 append using "C:\Documents and Settings\Yijie\My Documents\ldata\lab14\baseseize.dta" sort id time compress label var id "subject ID" label var seiz "number of seizures" label var time "time interval" label var tx "tx (1=progabide,0=pbo)" label var age "age (yrs)" label var length "time interval length (wks)" label def time 0 "Baseline" label val time time des tsset id time save "C:\Documents and Settings\Yijie\My Documents\ldata\lab14\seizefinal.dta", replace ***GEE w/ Exchangeable correlation gen post=1*(time>=1) gen txtime=tx*post xtgee seiz tx post txtime, f(poisson) robust corr(exch) exposure(length) eform scale(x2) xtcorr, compact ***The scale parameter 19.7 indicates that the variance is 20 times larger than the mean *** nuber of seizures ***The estmated within corr. is .78, that is how correlated are two obs on teh same subject *** Interpretation of the mean parameters: **exp(Bpost)=1.12: in the placebo group, the no. of seizures post trt is 12% higher than pre-treatment **exo(Btxtime)=.9; the post vs. pre-trt ratio in the prograbide group is 90% of that in teh placebo gr. *** could try other correlation structure *** xtgee seiz tx post txtime, f(poisson) robust corr(ar1) exposure(length) eform scale(x2) xtcorr xtgee seiz tx post txtime, f(poisson) robust corr(uns) exposure(length) eform scale(x2) xtcorr ***RE model***gamma distributed, with variance alpha xtpois seiz tx post txtime, i(id) irr re nolog exposure(length) *** Instead of using option "eform", use "irr" also get the exponetiated coefficients ***** ***RE model***normal distributed, with variance sigma_u xtpois seiz tx post txtime, i(id) eform re normal nolog exposure(length)