Programming the statistical procedures from SAS

Effect-coding in GLIMMIX

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 117
Accepted Solution

Effect-coding in GLIMMIX

Is there a way to switch the default dummy-coding of CLASS variables to effect-coding in PROC GLIMMIX?

 

My goal is to obtain tests for each level of a fixed class variable against sample average in PROC GLIMMIX.  In PROC LOGISTIC the CLASS statement has an option ‘PARAM=EFFECT’ to accomplish this.  There does not seem to be an equivalent for that in PROC GLIMMIX.  Am I missing something?

 

If I can't change the way a CLASS variable is parameterized by GLIMMIX, what would you recommend for me to achieve my goal? I know I could manually effect-code each level of my class variable in the source dataset and enter all of those effect-coded variables into the model.  I can also use a series of ESTIMATE statements to compute the desired targets by using dummy-code default.  Trouble is that my class variable has over 400 levels and both of the options above require a whole lot of coding. I have hard time believing that SAS took away PARAM=EFFECT option without an easy alternative.

 

Do you have any other suggestions?

 

Thanks,

Haris


Accepted Solutions
Solution
‎11-28-2016 04:28 PM
Frequent Contributor
Posts: 117

Re: Effect-coding in GLIMMIX

SAS Tech Support came through rapidly: DIFF=ANOM option in the LSMEANS statement in PROC GLIMMIX is exactly what I was looking for.

View solution in original post


All Replies
Solution
‎11-28-2016 04:28 PM
Frequent Contributor
Posts: 117

Re: Effect-coding in GLIMMIX

SAS Tech Support came through rapidly: DIFF=ANOM option in the LSMEANS statement in PROC GLIMMIX is exactly what I was looking for.
Senior User
Posts: 1

Re: Effect-coding in GLIMMIX

Haris, Since you figured it out, maybe you can help me? I added a "lsmeans var / diff=anom" line to my proc glimmix code and all that did was lines to my output populated with . (missing values) for the main effects. Interestingly, they are the inverse in direction, but the same in magnitude as the original output without the lsmeans var / diff=anom line. 

 

I have to conduct these follow up tests for two separate analyses. In one the two model variables are categorical with two levels each and their interaction. In a second, I have a two categorical variables with 2 levels each, a linear variable, the quadratic of that linear variable, and all the higher-order interactions. 

 

Any help would be much appreciated.

Contributor
Posts: 25

Re: Effect-coding in GLIMMIX

[ Edited ]

I would recommend manually coding your categorical variables if you want to use effect coding.

 

For example, if you have a categorical variable called hospital with values of "Hospital A", "Hospital B", and "Hospital C", rather than entering hospital into proc glimmix in the class statement, instead create two new variables, "Hospital_A" and "Hospital_B" (Hospital C is arbitrarily designated the reference group).

 

If hospital = "Hospital A",  then Hospital_A = 1, hospital = "Hospital B",  then Hospital_A = 0, and if hospital = "Hospital C", then Hospital_A = -1. Use the same logic for the Hospital_B variable.

 

Manual coding allows you to choose which category to use as a reference and directly find the effect code coefficients in the Solutions for Fixed Effects output (use the "solution" option in the model statement). I would also use manual coding when using weighted effect coding, when there are an unequal number of observations across categories.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 571 views
  • 2 likes
  • 3 in conversation