Notes on Poisson Regression and Some Extensions
Notes on Poisson Regression and Some Extensions
Notes on Poisson Regression and Some Extensions
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
infile v1 intr v3 d ts tf v7 cid c9 n<strong>on</strong>intm12 m13 mmed mwrk14 adjinc msinc nsibs southurban fundpro cathol weekly profam selfest test using 6W1.dat;gen offs=log(tf-ts);gen a1 = intr==1;gen a2 = intr==2;gen a3 = intr==3;gen a4 = intr==4;gen a5 = intr==5;gen a6 = intr==6;egen id = fill(1 2);/* Fit baseline hazard <strong>and</strong> retrieve imputed frailties */xtpois d a1 a2 a3 a4 a5 a6, offset(offs) i(cid) noc<strong>on</strong>s;predict xbeta, xb;gen t = tf - ts;gen Ihaz=t*exp(xbeta - offs);gen a=1/e(alpha);collapse (mean) p = a (rawsum) H=Ihaz (rawsum) D=d, by(cid);gen w = (D+p)/(H+p);summarize w, detail;Here, I let w denote each family’s frailty. We use the collapse comm<strong>and</strong> to get the desiredquantities. Note that p corresp<strong>on</strong>ds to 1/φ, which is called alpha in Stata. Since it is c<strong>on</strong>stantover clusters, we just take the mean. Other quantities H <strong>and</strong> D corresp<strong>on</strong>d to the sum of acluster’s integrated hazards <strong>and</strong> a cluster’s total number of events. This results in a new data setc<strong>on</strong>taining cluster-specific frailties. You could also include observed characteristics of the cluster,in order to see how these would affect frailty in a regressi<strong>on</strong> model. Since frailty must be > 0, agood model might be a loglinear regressi<strong>on</strong> model such as:log v j = x j β + ε.Here, we asked <strong>on</strong>ly for the descriptive summary of frailty from a proporti<strong>on</strong>al hazards modelthat fits <strong>on</strong>ly the baseline hazard. The quantiles are probably most relevant.Log likelihood = -1248.9537 Prob > chi2 = 0.0000------------------------------------------------------------------------------d | Coef. Std. Err. z P>|z| [95% C<strong>on</strong>f. Interval]---------+--------------------------------------------------------------------a1 | -6.45445 .2405448 -26.833 0.000 -6.925909 -5.982991a2 | -4.282342 .1458461 -29.362 0.000 -4.568195 -3.996489a3 | -3.890296 .1553783 -25.038 0.000 -4.194832 -3.58576a4 | -3.995447 .1894533 -21.089 0.000 -4.366768 -3.624125a5 | -3.816231 .2659806 -14.348 0.000 -4.337543 -3.294918a6 | -3.749099 .3883572 -9.654 0.000 -4.510265 -2.987933offs | (offset)---------+--------------------------------------------------------------------/lnalpha | 1.41132 .3308904 .7627865 2.059853---------+--------------------------------------------------------------------alpha | 4.101364 1.357102 2.144243 7.844815------------------------------------------------------------------------------Likelihood ratio test of alpha=0: chi2(1) = 27.61 Prob > chi2 = 0.0000w21