Solved
Contributor
Posts: 26

Sum of squares is equal to zero while using proc glm, mixed

Hi,

while running scores data in proc glm, i got zero value for the sum of squares (variable - site, levels L and R ).

is it obvious? i've tried searching internet and found nothing.

i think here there is no problem with the code i've used.

proc glm data=one(where=(hour ne 0));
class subject hour Site;
model score = subject site hour/ ss3;
lsmeans hour /stderr pdiff;
run;

any statistical explanations?

Accepted Solutions
Solution
‎12-14-2016 07:01 AM
SAS Super FREQ
Posts: 3,841

Re: Sum of squares is equal to zero while using proc glm, mixed

The most likely explanation is that the subjects are nested within sites, so that there are no degrees of freedom for the Site variable. For example look at this simulated data and results:

``````data one;
do subject = 1 to 54;
if subject < 5 then Site=1;
else Site=2;
do hour=1 to 2;
score = site + hour + rand("normal");
output;
end;
end;
run;

ods select ModelANOVA;
proc glm data=one;
class subject hour Site;
model score = subject site hour/ ss3;
lsmeans hour /stderr pdiff;
run;
quit;``````

All Replies
Posts: 1,123

Re: Sum of squares is equal to zero while using proc glm, mixed

Presumable SITE is constant in your subsample.  Consider the same results for SEX below:

proc glm data=sashelp.class (where=(sex='F'));

class age sex;

model height=age sex /ss3;

run;

Contributor
Posts: 26

Re: Sum of squares is equal to zero while using proc glm, mixed

here in your code, you are using only one level in variable SEX ie 'F'. so, there is no way for the calculation of SS but in my code i'm using two levels for the variable SITE. in DF column it should have show me 1 instead of zero that you can see in the above attached .jpg file.
Posts: 2,655

Re: Sum of squares is equal to zero while using proc glm, mixed

Consider what @mkeintz said, and run a crosstab on site and hour.  I would suggest that one of the sites has all of the hour variables coded in such a way that the where= clause is excluding everything.

Although the results are probably uninteresting for your research problem, what happens when you run the following?

``````proc glm data=one;
class subject hour Site;
model score = subject site hour/ ss3;
lsmeans hour /stderr pdiff;
run;``````

Steve Denham

Solution
‎12-14-2016 07:01 AM
SAS Super FREQ
Posts: 3,841

Re: Sum of squares is equal to zero while using proc glm, mixed

The most likely explanation is that the subjects are nested within sites, so that there are no degrees of freedom for the Site variable. For example look at this simulated data and results:

``````data one;
do subject = 1 to 54;
if subject < 5 then Site=1;
else Site=2;
do hour=1 to 2;
score = site + hour + rand("normal");
output;
end;
end;
run;

ods select ModelANOVA;
proc glm data=one;
class subject hour Site;
model score = subject site hour/ ss3;
lsmeans hour /stderr pdiff;
run;
quit;``````
Posts: 2,655

Re: Sum of squares is equal to zero while using proc glm, mixed

[ Edited ]

/Homer Simpson voice on

D'oh!

/Homer off

Good point, @Rick_SAS.  Much more likely than my guess.

Steve Denham

Contributor
Posts: 26

Re: Sum of squares is equal to zero while using proc glm, mixed

Thanks for the replies. like Rick_SAS said subjects are nested within the sites in my data.
☑ This topic is solved.