11-28-2016 03:05 PM
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?
12-02-2017 10:01 AM
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.
04-13-2018 01:53 PM - edited 04-13-2018 02:05 PM
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.
Need further help from the community? Please ask a new question.