Hi
I need advice on how to compare multiple rates, what test do I need, and what's the sas code for it.
The quesiton to answer is:
Whether average rates of incidents (per 1000 days) are significantly different across different care types.
Background (I madeup to give you a context of this analysis):
in 19xx, number of children are placed into 6 different type of cares, the duration of each care for each child is random. There are number of incidents happened and recorded. So to compare in which type of care that children had less likely experience an incident. Data collected as below.
Care type | Num. of Chilren | Num. of cares | Number of days in care | Number of incidents in care | average rate of incidents (per 1000 days) |
Type1 | 900 | 1000 | 100000 | 543 | 5.43 |
Type2 | 550 | 600 | 50000 | 234 | 4.68 |
Type3 | 150 | 200 | 10000 | 76 | 7.6 |
Type4 | 160 | 200 | 5000 | 25 | 5 |
Type5 | 35 | 50 | 1000 | 11 | 11 |
Type6 | 15 | 20 | 500 | 6 | 12 |
Many thanks
The answer is already there. Type2 is the least likely, and Type6 the most likely to have an incident.
Although I'd say that the samples for Type5 and Type6 are too small for getting a statistically relevant result.
The trick for such data model the number of incidents by poisson regression. Then use log(days/1000) as offset to specify the time at risk and to scale the estimate to rate per 1000 days. From the following code you get confidence intervals, pairwise comparisons and a test of all dayscares has same rate.
data daycare;
input Care_type $ NumofChilren Numofcares Numberofdaysincare Numberofincidentsincare averagerate ;
offset=log(numberofdaysincare/1000);
cards;
Type1 900 1000 100000 543 5.43
Type2 550 600 50000 234 4.68
Type3 150 200 10000 76 7.6
Type4 160 200 5000 25 5
Type5 35 50 1000 11 11
Type6 15 20 500 6 12
;
run;
proc genmod data=daycare;
class care_type;
model numberofincidentsincare=care_type/dist=poisson link=log offset=offset noint type3;
lsmeans care_type/diff exp cl;
run;
I made a mistake: There should not be "noint" as option. Because only without noint the type3 test is testing the hypotheses that all types of daycare is the same. And with noint included it is testing if all daycare have a rate =1 - which is not a relevant test.
@Ksharp, can you explain why you put this link here? As I see it, the present problem is not binomial regression (or logistic regression). It is rate regression.
Actually, by conditioning on the sum of events it is possible to solve the problem with binomial regression. But that is to make it far more complicated than necessary and the link does not explain how that works.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.