BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BK2
Calcite | Level 5 BK2
Calcite | Level 5

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;

 

 

 

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

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.

BK2
Calcite | Level 5 BK2
Calcite | Level 5

Thanks, Ivm! That makes more sense. I understand the RE implementation a little better now :). I appreciate your time and inputs. 

 

BK

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 17 replies
  • 3470 views
  • 3 likes
  • 3 in conversation