The easiest way to obtain an estimated rate for each CID is to simply average the predicted rates within each CID. Using the SCORE statement in PROC PLM to obtain the predicted rates as described in this note, the following produces a data set of the average predicted rates for the CIDs:
PROC GENMOD data=sample_data;
CLASS x1 cid;
MODEL y=x1-x4 /d=poisson link=log offset=log_offset;
REPEATED subject=cid/ type=exch;
store out=mod;
run;
proc plm source=mod;
score data=sample_data out=pred pred stderr lclm uclm / nooffset ilink;
run;
proc means data=pred; class cid; var predicted; run;
This is essentially a predictive margin, which is an average predicted value, but averaged only over the predicted values in a CID. It might be slightly better to get the sum of the predicted counts, not rates, in a CID and then divide it by the sum of the offset values in the CID. You can use the P= option in the OUTPUT statement to get the predicted counts.
But the above only provides point estimates, not standard errors. To obtain predictive margin point estimates and standard errors and confidence intervals, you could use the Margins macro including the WITHIN= option to identify a specify CID. For example:
%margins(data=sample_data, class=x1 cid, response=y,
model=x1 x2 x3 x4, dist=poisson, offset=log_offset,
geesubject=cid, geecorr=exch, within=cid='AC-1010',
options=cl rate )
By itself, the macro only allows you to do this for one CID at a time, so you would need to run the macro for each CID. Or you could do them all in one shot by using the Margins macro with the RunBY macro as described in the Margins macro documentation and shown in the last two examples in the Results tab there.
... View more