Hello,

I would appreciate your help with estimation of -margins- following a -mixed- command.

A sample of my data are listed at the end of this post. I am estimating a -mixed- command to determine the change in surgical rates for two racial groups over time. I am including Hospital Referral Region (HRR)-level random effects.
Code:
mixed rate i.race_dum##i.year || hrrnum:, cove(exchangeable)
Following this, I would like to comment on for how many HRRs the rate for one racial group was significantly higher or lower than the other race in 2017. I am using the following margins command, but it gives me an identical contrast for each HRR. Is there a way I can get the differences in rates between races and the p-value for the difference for each HRR?
Code:
margins r.race_dum if year==2017, over(hrrnum)
I would appreciate your help on my question.

Thank you,
Caroline
************************************************** ******************************
Data setup:
Code:
clear
input int hrrnum double rate byte race_dum int year
1 3.61 1 2016
1 2.52 2 2016
1 3.67 1 2017
1 1.89 2 2017
2 3.47 1 2016
2 1.75 2 2016
2 3.68 1 2017
2 2.61 2 2017
5 4.3 1 2016
5 3.49 2 2016
5 4.23 1 2017
5 3.38 2 2017
6 4.09 1 2016
6 2.78 2 2016
6 4.1 1 2017
6 2.09 2 2017
7 3.56 1 2016
7 2.57 2 2016
7 4.39 1 2017
7 1.65 2 2017
9 3.65 1 2016
9 2.79 2 2016
9 2.97 1 2017
9 2.1 2 2017
10 5.5 1 2016
10 4 2 2016
10 6.16 1 2017
10 3.78 2 2017
11 5.39 1 2016
11 5.58 2 2016
11 4.96 1 2017
11 2.31 2 2017
12 5.04 1 2016
12 3.97 2 2016
12 5.45 1 2017
12 3.2 2 2017
14 6.08 1 2016
14 6.59 2 2016
14 6.26 1 2017
14 7.34 2 2017
15 4.98 1 2016
15 2.31 2 2016
15 5.12 1 2017
15 3.23 2 2017
16 3.63 1 2016
16 4.45 2 2016
16 3.16 1 2017
16 2.48 2 2017
18 3.17 1 2016
18 2.52 2 2016
18 3.45 1 2017
18 0 2 2017
19 3.32 1 2016
19 3.03 2 2016
19 3.56 1 2017
19 2.46 2 2017
end
Thank you,
Caroline