I ran a PROC GENMOD code (see below). The output shows that the least squares means for a binary variable, "Q", are non-estimable, but there is an estimated difference in least squares means between "Q = 1" and "Q = 0".
How is this possible? I thought that the difference in least squares means is calculated by subtracting the 2 least squares means. If my least squares means are non-estimable, then shouldn't my difference in least squares means be non-estimable, too?
Thanks for your thoughts.
proc genmod
data = mydata;
class Q (ref = '0')
X (ref = '1')
W (ref = '1')
R;
model successes/trials
=
Q
X
W
X * W
Q * X
Q * W
/ dist = bin
link = logit;
repeated
subject = R;
lsmeans Q / exp diff cl e;
lsmeans X / exp diff cl e;
lsmeans W / exp diff cl e;
lsmeans X * W / exp diff cl e;
lsmeans Q * X / exp diff cl e;
lsmeans Q * W / exp diff cl e;
run;
Normally I don't try to answer these kinds of questions, but it is Saturday morning and I don't know if the experts will see this question until Monday. I am not an expert in this area, but I'll give it a shot.
In theory, it possible to estimate the difference of means without being able to estimate the means. Suppose I collect data for two variables, X and Y. I don't give you the original data, but instead decide to subtract off some reference value from both variables nd then give you the adjusted values. I might subtract 7 or 13 or 321...you don't know. As a consequence of my manipulation, there is no way that you can estimate the means of the variables. Howeer, you can easily estimate the mean of the difference X-Y, since my subtraction cancels out.
In your case, you have a binary variable Q. The level Q=0 is not estimable because it is getting lumped in with the intercept term. (I assume the level Q=1 has an estimate, right?) However, you can estimate the incremental effect of Q=1 as compared to Q=0, which means that you can estimate the difference.
This can easily happen with fixed-effect models.
Thanks for your reply on a Saturday morning, Rick!
No, actually - I do not get an estimate for Q = 1 in the least squares mean output. Both Q = 1 and Q = 0 are non-estimable in the least squares mean table.
As I understand, the difference in least squares means is calculated by subtracting the 2 least squares means - which makes my result very strange. If both the least squares means are non-estimable, then how can the difference in least squares means be estimable?
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.