A rate can be modelled in PROC GENMOD using a log-linked poisson model with an offset as discussed and illustrated in this usage note. Since the log of the rate is the response function, such a model allows you to estimate the log rate for a setting of the predictors. By exponentiating, you can estimate the rate. Similarly, the difference between two predictor settings results in an estimated difference in log rates which is equivalent to a log rate ratio. By exponentiating, you can estimate the rate ratio comparing the settings. So, specifying a linear combination of model parameters in the ESTIMATE statement of PROC GENMOD can provide estimates of rates and rate ratios when the EXP option is included. However, the difference in rates cannot be obtained in this way. To estimate the difference in rates, you need to estimate a nonlinear function of the poisson model's parameters.
An analogous problem for a logistic model is to compute differences of probabilities rather than the more typical odds ratios.
You can use PROC NLMIXED to fit the poisson model with offset and then use the ESTIMATE statement to estimate the difference in rates. Using a subset of the car insurance data that appears in the "Getting Started" section of the GENMOD documentation, the following statements begin by computing estimates of the rates for the two ages and the rate ratio as presented in this usage note.
data insure;
input n c age;
ln = log(n);
datalines;
500 42 1
400 101 2
;
proc genmod data=insure;
class age;
model c=age / d=p offset=ln;
estimate 'ratio' age 1 -1;
output out=genout xbeta=xb stdxbeta=std;
run;
data predrates;
set genout;
obsrate=c/n; /* observed rate */
lograte=xb-ln;
prate=exp(lograte);
lcl=exp(lograte-probit(.975)*std);
ucl=exp(lograte+probit(.975)*std);
run;
proc print data=predrates noobs;
run;
Since the model is saturated in this example, the predicted rates (PRATE) are identical to the observed rates (OBSRATE) — 0.0840 for age 1 and 0.2525 for age 2. The ESTIMATE statement provides the rate ratio estimate, 0.3327, comparing the two ages. Confidence intervals for the rates and the rate ratio are given.
| |
1 |
-1.3763 |
0.0995 |
-1.5714 |
-1.1813 |
191.33 |
<.0001 |
| 1 |
1 |
-1.1006 |
0.1836 |
-1.4605 |
-0.7407 |
35.93 |
<.0001 |
| 2 |
0 |
0.0000 |
0.0000 |
0.0000 |
0.0000 |
. |
. |
| |
0 |
1.0000 |
0.0000 |
1.0000 |
1.0000 |
|
|
| 0.3327 |
0.2321 |
0.4768 |
-1.1006 |
0.1836 |
0.05 |
-1.4605 |
-0.7407 |
35.93 |
<.0001 |
| 500 |
42 |
1 |
6.21461 |
3.73767 |
0.15430 |
0.0840 |
-2.47694 |
0.0840 |
0.06208 |
0.11366 |
| 400 |
101 |
2 |
5.99146 |
4.61512 |
0.09950 |
0.2525 |
-1.37634 |
0.2525 |
0.20776 |
0.30687 |
|
To estimate the rate difference, fit the poisson model using PROC NLMIXED as follows. The two statements following the PROC NLMIXED statement create a dummy-coded variable for age identical to the internal created by the CLASS statement in PROC GENMOD. The next statement expresses the poisson mean parameter, l, as a function of age, the offset, and the model parameters. The MODEL statement indicates that the response count, c, is to be modeled as a poisson variable with mean l. The ESTIMATE statement is used to estimate the rate difference. Note that the log rate for age 1 is b0+b1*age1 and the log rate for age 2 is just b0. For details on using PROC NLMIXED, see the NLMIXED documentation.
proc nlmixed data=insure;
age1=0;
if age=1 then age1=1;
l=exp(b0+b1*age1+ln);
model c ~ poisson(l);
estimate "Rate Difference" exp(b0+b1)-exp(b0);
run;
PROC NLMIXED replicates the poisson model fit previously by GENMOD, producing the same likelihood value, parameter estimates, and standard errors. The p-values for the parameters differ only because NLMIXED uses a t statistic based on 2 degrees of freedom while GENMOD uses a Wald chi-square statistic which is the square of a standard normal (z) statistic.
Note that the estimated rate difference, -0.1685, is exactly the difference between the rates shown in the PREDRATES data set: 0.0840 - 0.2525. This difference is significant (p=0.0270). A confidence interval for the rate difference, (-0.2901,-0.0469), is also given.
| -1.3763 |
0.09950 |
2 |
-13.83 |
0.0052 |
0.05 |
-1.8045 |
-0.9482 |
-1.54E-6 |
| -1.1006 |
0.1836 |
2 |
-5.99 |
0.0267 |
0.05 |
-1.8906 |
-0.3106 |
1.013E-7 |
| Rate Difference |
-0.1685 |
0.02827 |
2 |
-5.96 |
0.0270 |
0.05 |
-0.2901 |
-0.04686 |
|
Operating System and Release Information
| SAS System | SAS/STAT | z/OS | | |
| OpenVMS VAX | | |
| Microsoft® Windows® for 64-Bit Itanium-based Systems | | |
| Microsoft Windows Server 2003 Datacenter 64-bit Edition | | |
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | | |
| Microsoft Windows XP 64-bit Edition | | |
| Microsoft® Windows® for x64 | | |
| OS/2 | | |
| Microsoft Windows 7 | | |
| Microsoft Windows 95/98 | | |
| Microsoft Windows 2000 Advanced Server | | |
| Microsoft Windows 2000 Datacenter Server | | |
| Microsoft Windows 2000 Server | | |
| Microsoft Windows 2000 Professional | | |
| Microsoft Windows NT Workstation | | |
| Microsoft Windows Server 2003 Datacenter Edition | | |
| Microsoft Windows Server 2003 Enterprise Edition | | |
| Microsoft Windows Server 2003 Standard Edition | | |
| Microsoft Windows Server 2008 | | |
| Microsoft Windows XP Professional | | |
| Windows Millennium Edition (Me) | | |
| Windows Vista | | |
| 64-bit Enabled AIX | | |
| 64-bit Enabled HP-UX | | |
| 64-bit Enabled Solaris | | |
| ABI+ for Intel Architecture | | |
| AIX | | |
| HP-UX | | |
| HP-UX IPF | | |
| IRIX | | |
| Linux | | |
| Linux for x64 | | |
| Linux on Itanium | | |
| OpenVMS Alpha | | |
| OpenVMS on HP Integrity | | |
| Solaris | | |
| Solaris for x64 | | |
| Tru64 UNIX | | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.