Ivm, I am running the following two procedures for random effects at customer level without autoregression. I was hoping to get similar results, but the two procedures give me very different results. Am I specifying something wrong in the procedures or are the two procedures doing something different? Thanks!
Data test;
Title 'sample_customer';
Input customer_id time_period dep_var1 dep_var2 ind_var1 ind_var2;
datalines;
1 1 1 12 10 .9
1 2 1 15 7 8.3
1 3 1 8.9 8 2.3
1 4 0 0 6 2
1 5 0 0 6 5
1 6 1 19 3 4
1 7 1 4 4 3
2 1 1 12 10 5
2 2 0 0 7 3
2 3 0 0 8 3
2 4 0 0 6 2
3 1 1 40 20 10
3 2 1 24 17 19
3 3 0 0 18 2.3
3 4 0 0 16 12
3 5 0 0 26 35
3 6 0 0 33 24
3 7 0 0 24 13
3 8 0 0 12 31
3 9 1 42 36 18;
PROC GLIMMIX DATA=test;
CLASS CUSTOMER_ID dep_var1;
MODEL dep_var2 = ind_VAR1 ind_VAR2 dep_var1
/LINK = IDENTITY DIST = NORMAL SOLUTION;
RANDOM INTERCEPT/ SUBJECT = CUSTOMER_ID TYPE= VC;
RUN;
PROC PANEL DATA=test;
CLASS dep_var1;
MODEL dep_var2 = ind_VAR1 ind_VAR2 dep_var1
/RANONE VCOMP = FB;
ID CUSTOMER_ID TIME_PERIOD;
RUN;
Actually, the two procedures are giving you the "same" results, with slight variations because of different estimation algorithms. The apparent difference is due to the way the two procedures parameterize the class variable. In GLIMMIX, the parameter for the last level of the class variable (1 here) is forced to be 0. In PANEL, the parameter for the first level of the class variable (0 here) is forced to be 0. This reverses sign for the class parameter, and changes the intercept.
Try running GLIMMIX by removing dep_var1 from the class statement.
CLASS CUSTOMER_ID time_period;
MODEL dep_var2 = ind_VAR1 ind_VAR2 dep_var1
/LINK = IDENTITY DIST = NORMAL SOLUTION;
RANDOM INTERCEPT/ SUBJECT = CUSTOMER_ID TYPE= VC;
You now get the same results as with PANEL. This can only be done when there are two levels to the class variable, coded as 0 and 1.
Note that the random effect variance is 0. That also is contributing to the equivalence of the two methods.
Thanks, Ivm! That makes more sense. I understand the RE implementation a little better now :). I appreciate your time and inputs.
BK
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.