Suppose that a model is fit to a set of independent groups using the same predictors and you want to compare the parameters of these models across groups. Comparison of group parameters can be done the same way regardless of the model type (ordinary regression, logistic regression, poisson regression, etc.) and involves specifying a single model that simultaneously estimates the intercepts and slopes for all groups. When a single model estimates all the parameters of interest, you can perform tests comparing them. This is also known as testing for the heterogeneity (or homogeneity) of slopes. For example, these statements estimate a model that contains separate intercepts for each group (the GROUP effect), a single common slope on X, and a set of parameters that represent the deviations of the groups' slopes from the common slope (the X*GROUP effect):
class group; model y = group x x*group; run;
For procedures such as LOGISTIC and GENMOD, which allow different coding methods for CLASS variables, it is important to use GLM parameterization (also called indicator or dummy coding) of the group variable. This is done with the PARAM=GLM option in the CLASS statement. Note that for ordinary regression models fit using PROC REG, which does not have a CLASS statement, the single multigroup model can be fit in PROC GLM, which does have a CLASS statement.
To simplify interpretation, you may want to include the NOINT option in the MODEL statement to suppress the overall intercept. Without an overall intercept, the GROUP parameters are the intercepts for each group. With an overall intercept, the GROUP parameters are deviations between the GROUP intercepts and the overall intercept.
If the test for the X*GROUP effect in the above model is significant, then this indicates that the deviations of the groups' slopes from the common slope are not all zero, meaning that some slopes are unequal. Then here is the final model with separate intercepts and slopes for the groups:
class group; model y = group x*group / noint; run;
If the X*GROUP effect is not significant and you accept that the groups have a common slope, then this is the parallel lines model (separate intercepts, common slope):
class group; model y = group x / noint; run;
This method can be applied to models that involve multiple predictors. For example, these statements test for equal slopes on both the X1 and X2 variables:
class group; model y = group x1 x1*group x2 x2*group; run;
See the "Parameter interpretation in an ANCOVA model" section of this note for an example comparing the slopes of different drugs on a normally distributed response.
The following statements create a data set in which the number of events (COUNT) is observed at each level of X. The amount of exposure at the levels of X are not equal, so the amount of exposure is also recorded at each level of X. The rate at each level of X is computed as the count divided by the exposure. The log of this rate is also computed.
Suppose that observations with X less than 7 are considered as one group (GROUP=1) while observations with X equal to 7 or greater are considered as a second group (GROUP=0). It is of interest to see if the rates from these groups exhibit the same slope on X.
Note that the log of the exposure is computed for use as an offset in a Poisson model. The handling of differing exposures through use of an offset is discussed and illustrated in this note.
data a; input x count exposure; group=(x<7); rate=count/exposure; lograte=log(rate); off = log(exposure); datalines; 1 40 51000 2 27 50000 3 19 48000 4 23 47500 5 14 46500 6 12 46000 7 19 50000 8 8 47500 9 12 49000 10 8 51000 11 7 53500 ;
These statements produce a plot of the observed rates across the levels of X with the groups identified.
proc sgplot; series y=rate x=x / group=group; run;
As discussed above, a single Poisson model allowing the groups to have separate intercepts and separate slopes is fit to the data using PROC GENMOD. The offset is included so that the rates can be modeled. Two EFFECTPLOT statements are included to plot the group models. The first EFFECTPLOT statement produces a plot on the log rate scale (LINK option). On this scale, the group models in the loglinked Poisson model are straight lines. The second EFFECTPLOT statement plots the models on the rate scale (ILINK option). The MOFF option allows plotting of rates or log rates rather than counts or log counts. The OBS option displays the observed rates or log rates as points on the plots. Note that the same statements below can be used for any number of groups.
proc genmod data=a; class group; model count = group x*group / dist=poisson noint offset=off; effectplot slicefit(x=x sliceby=group) / moff link obs; effectplot slicefit(x=x sliceby=group) / moff ilink obs; run;
The plot of the log rates shows that the slopes of the group lines are very similar suggesting that a simpler model with a single, common slope may be sufficient. That will be tested next.

These statements add the common slope X to the model. The X*GROUP effect contains the deviations of the group slopes from the common slope. If these are all zero, then there is only a single slope. So, a test of the X*GROUP effect is a test of the null hypothesis that all group slopes are the same.
proc genmod data=a; class group; model count = group x x*group / dist=poisson noint offset=off; run;
The nonsignificance of the X*GROUP test (p=0.7487) indicates no evidence for the group slopes differing from the common slope.

If you choose to accept the null hypothesis of a common slope, then these statements fit the common slope model by dropping the X*GROUP effect. The same EFFECTPLOT statements are used to plot the log rates and rates against X.
proc genmod data=a; class group; model count = group x / dist=poisson noint offset=off; effectplot slicefit(x=x sliceby=group) / moff link obs; effectplot slicefit(x=x sliceby=group) / moff ilink obs; run;
The group slopes are exactly parallel under this model and that can be seen in the plot of the log rates.

Product Family  Product  System  SAS Release  
Reported  Fixed*  
SAS System  SAS/STAT  All  n/a 
Type:  Usage Note 
Priority:  low 
Topic:  Analytics ==> Longitudinal Analysis SAS Reference ==> Procedures ==> GLM SAS Reference ==> Procedures ==> GENMOD SAS Reference ==> Procedures ==> LIFEREG SAS Reference ==> Procedures ==> MIXED SAS Reference ==> Procedures ==> LOGISTIC SAS Reference ==> Procedures ==> PROBIT Analytics ==> Regression SAS Reference ==> Procedures ==> ROBUSTREG Analytics ==> Multivariate Analysis SAS Reference ==> Procedures ==> REG SAS Reference ==> Procedures ==> SURVEYLOGISTIC SAS Reference ==> Procedures ==> SURVEYREG Analytics ==> Categorical Data Analysis Analytics ==> Survey Sampling and Analysis 
Date Modified:  20041117 09:22:16 
Date Created:  20041004 11:29:37 