turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- test multiple effects in proc glm

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-04-2016 05:31 AM

In the case for 2-way manova, how can I test whether the two groups are significant or not?

i.e. I want to to something like this,

proc glm data=t;

class gp1 gp2;

model y1 y2 y3 = gp1 gp2;

manova h=gp1 gp2;

run;

It happens that SAS will give me two seperate tests, one for testing whether gp1 is significant, the other for testing whether gp2 is significant. But I want to test whether gp1 and gp2 are both significant (i.e. Ho(model 0): y1 y2 y3= , H1(model 1): y1 y2 y3= gp1 gp2).

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ltwedgar

03-04-2016 10:13 AM - edited 03-04-2016 10:40 AM

I agree that this test doesn't is not calculated by PROC GLM.

Here is my approach. Since the maksimum of the log-likelihood is just -n*log(determinant(E))/2+constant, where E is the error-matrix, it is just to let proc glm output the error matrix into a dataset. Do this for both model, and then calculate the likelihood ratio value manually. The pvalue is calculated by using that the 2 x difference in log-likelihood is chi-square distributed. I think there is a slightly better approach where it is used that some transformation of the ratio is exact F-distributed, but I cant find this in my notes from univerversity.

here is an example. It is neccessary to take determinant, so I therefor use the matrix-package here (Matrix-Package). Alternatively it can be done with PROC IML.

Of some reason this site will not show my code correct, so I therefore also attach it in a separate file

```
data simulation;
do gp1=1 to 4;
do gp2=1 to 4;
do i=1 to 5;
y1=rannor(-1);
y2=rannor(-1);
y3=rannor(-1);
output;
end;
end;
end;
run;
ods output errorsscp=sscp0;
proc glm data=simulation;
class gp1 gp2;
model y1 y2 y3 = gp1 gp2;
manova h=gp1 gp2/printe ;
run;
quit;
ods output errorsscp=sscp1;
proc glm data=simulation;
model y1 y2 y3 = ;
manova /printe;
run;
quit;
```

data _NULL_;

array sigma0{3,3} _temporary_ ;

array sigma1{3,3} _temporary ;

dsid0= open('sscp0');

dsid1= open('sscp1');

do i=1 to 3;

rc= fetchobs(dsid0,i);

rc= fetchobs(dsid1,i);

do j=1 to 3;

sigma0[i,j]=getvarn(dsid0,2+j);

sigma1[i,j]=getvarn(dsid1,2+j);

end;

end;

call show(sigma0);

put;

call show(sigma1);

d0=determinant(sigma1);

d1=determinant(sigma0);

likelihoodratio=80*(log(d0)-log(d1));/*n=80 in this example*/

put d0= d1= likelihoodratio=;

pvalue=sdf('chisquare',likelihoodratio,3*( ((4-1)+(4-1)+1)-1));/*third argument is the difference in parameters*/;

put pvalue= pvalue6.4;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ltwedgar

03-10-2016 12:14 PM

It is unfortunate that proc glm cannot solve this problem. Appreciate your effort of making use of likelihood ratio to approximate the F test. However, I think the most simplest way to solve this is to create dummy variables and use proc reg and mtest statement to conduct the F test.