## PROC GENMOD: I get non-estimable least squares means, but an estimable difference in least squares means.

Occasional Contributor
Posts: 14

# PROC GENMOD: I get non-estimable least squares means, but an estimable difference in least squares means.

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?

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

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;

SAS Super FREQ
Posts: 3,834

## Re: PROC GENMOD: I get non-estimable least squares means, but an estimable difference in least squares means.

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.

Valued Guide
Posts: 684

## Re: PROC GENMOD: I get non-estimable least squares means, but an estimable difference in least squares means.

This can easily happen with fixed-effect models.

Occasional Contributor
Posts: 14