BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
mgx
Obsidian | Level 7 mgx
Obsidian | Level 7

Certainly!


Dear SAS Community,

 

I have a question about testing the simultaneous effect of two covariates in PROC MIXED, specifically under the null hypothesis: H0: B1=B2=0. Is there a method to perform this test in SAS? It appears that neither the estimate statement nor the contrast statement provides a straightforward solution for this scenario. It's worth noting that these covariates are distinct variables, not different levels of the same categorical variable.

 

Additionally, I'm curious if it's feasible to aggregate the results of this hypothesis test across multiple imputed datasets using PROC MIANALYZE.

1 ACCEPTED SOLUTION

Accepted Solutions
StatsMan
SAS Super FREQ

Use the STORE statement to output your model results to a SAS Item Store. Then read those results into PROC PLM and use the JOINT option on the ESTIMATE statement to produce a joint F test on the hypothesis you are looking for. The code below shows how to do this for 2 covariates. The output from the ESTIMATE statement in PLM will give you the single df test of both estimates (matching the results from the two individual single df ESTIMATE statements) and give you a joint 2 df test that X1=0 and X2=0.

 

data test;
   call streaminit(264737);
   do a=1 to 3;
      do rep=1 to 10;
         x1=rand("normal");
         x2=rand("normal");
         y=3 + a + .5*x1 + .1*x2 + rand("normal");
		 output;
   end; end;
run;

proc mixed data=test;
   class a; 
   model y=a x1 x2;
   store out=mymodel;
run;

proc plm restore=mymodel;
   estimate 'x1' x1 1;
   estimate 'x2' x2 1;
   estimate 'x1 and x2' x1 1, x2 1 / joint;
run;

View solution in original post

6 REPLIES 6
svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10

The test of their effects would be in the "Type III Tests of Fixed Effects" that is part of the standard output of the MIXED procedure. The test of each covariate is after all of the other predictors are included in the model. That is where you'd find your test of B1=B2=0.

mgx
Obsidian | Level 7 mgx
Obsidian | Level 7

This would indeed be the case if it were  different levels of the same categorical variable, but the my mean structure is E(Y_{ij})=a+bx+cx^2, and I want to test whether b=c=0. 

svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10
The Type III tests of fixed effects do, in fact, test the association
of *different
*variables with the dependent variable. If you wanted to test differences
between the levels of the *same* categorical variable, you would use a
CONTRAST or ESTIMATE statement.
mgx
Obsidian | Level 7 mgx
Obsidian | Level 7

I think I have to disagree here. SAS only tests whether there is no effect of the independent variables on the dependent variables separately. Note that for a continuous variable, the p-value equals the p-value of the solution of the fixed effects, while for a categorical variable the p-value differs, since it tests whether there is no effect of the categorical variable as a whole. 

 

For clarity, you can find the Type III test table for my analysis below. 

 

mgx_0-1709539640040.png

 

 

svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10
So then maybe MIXED will not supply what is needed as I think the Type I,
II, and III tests are not able to accommodate tests of "simultaneous"
effects of two or more variables.
StatsMan
SAS Super FREQ

Use the STORE statement to output your model results to a SAS Item Store. Then read those results into PROC PLM and use the JOINT option on the ESTIMATE statement to produce a joint F test on the hypothesis you are looking for. The code below shows how to do this for 2 covariates. The output from the ESTIMATE statement in PLM will give you the single df test of both estimates (matching the results from the two individual single df ESTIMATE statements) and give you a joint 2 df test that X1=0 and X2=0.

 

data test;
   call streaminit(264737);
   do a=1 to 3;
      do rep=1 to 10;
         x1=rand("normal");
         x2=rand("normal");
         y=3 + a + .5*x1 + .1*x2 + rand("normal");
		 output;
   end; end;
run;

proc mixed data=test;
   class a; 
   model y=a x1 x2;
   store out=mymodel;
run;

proc plm restore=mymodel;
   estimate 'x1' x1 1;
   estimate 'x2' x2 1;
   estimate 'x1 and x2' x1 1, x2 1 / joint;
run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

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.

Discussion stats
  • 6 replies
  • 1124 views
  • 5 likes
  • 3 in conversation