BookmarkSubscribeRSS Feed
sabataged
Obsidian | Level 7

Hi everyone, 

 

Please bear with me.  I understand how to interpret proc logistic outputs, but I am new to proc glimmix. I have some questions about interpreting my output.  

 

These are my two models:

 

The first model has only one predictor variable, 'impaird'. 

The second model has two predictor variables as well as an interaction term between the two variables: 

proc glimmix data=FINALANALYSISFILE;
class  school Sex (ref="Male") impaird (ref="No sub.");
model DHelpSeekParent (descending)   =  impaird / dist=binomial link=logit solution or;
     random intercept / subject = school;  
run;

proc glimmix data=FINALANALYSISFILE;
class  school Sex (ref="Male") impaird (ref="No sub.");
model DHelpSeekParent (descending)   =  impaird sex  impaird*sex/ dist=binomial link=logit solution or;
     random intercept / subject = school;  
run;

I've read a couple of articles online and some Q&A on this site, so I understand that the Type III test and Solution for Fixed Effects return the same p-values when there are no interaction effects.  The odds ratios are just e raised to the parameter estimate values.However, I am confused about what all of these elements represent when the interaction term is added.  Why are the p-values different for the same variables in Type III test and Solution for Fixed Effects?  How is the odds ratio being calculated? Would someone be able to help me interpret this output?

 

Thanks in advance for the help! 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Usage Note 23695: Why do the results of the Type 3 F-tests differ from the t-tests that are produced by the SOLUTION option in the MODEL statement?

 

http://support.sas.com/kb/23/695.html

--
Paige Miller
StatsMan
SAS Super FREQ

This answer is done in terms of PROC MIXED, but applies to any modeling procedure using the GLM parameterization for CLASS effects

 

The T-tests produced by the SOLUTION option may be testing different hypotheses than the Type 3 F-tests.  To check the hypothesis tested with the F-test, add the /E3 option to the MODEL statement.  Here's an example.

 

The DATA step below generates data for a simple model:

 

options ls=64;

 

 /* generate sample data. */

 

data check;

   seed = 213845740;

   do v1 = 1 to 2;

      do n = 1 to 20;

         x1 = ranuni(seed);

         y = v1 + x1 + rannor(seed);

         output;

      end;

   end;

run;

 

This PROC MIXED code estimates the model for this data:

 

proc mixed data=check;

   class v1;

   model y = v1 x1 v1*x1 / s e3;

   lsmeans v1 / pdiff e;

run;

 

Here are the results of the /S option for the model above:

 

 

                    Solution for Fixed Effects

 

                            Standard

Effect      v1   Estimate      Error     DF   t Value   Pr > |t|

 

Intercept          2.3605     0.3681     36      6.41    <.0001

v1          1     -1.7722     0.5554     36     -3.19    0.0029

v1          2           0          .      .       .            .

x1                 0.3744     0.7303     36      0.51    0.6113

x1*v1       1      1.3046     1.0224     36      1.28    0.2101

x1*v1       2           0          .      .       .            .

 

 

The estimates here need a little interpretation because of the paramaterization that PROC MIXED (and PROC GLM) use.  The CLASS statement sets up an overparamterized model, using 1 dummy variablefor each level of a class effect.  This parameterization causes one level of the class variable to be set to zero.  We choose to make that level the last, or highest ordered.  The other parameters for the CLASS variables are differences between that level and the last level.  For instance, the -1.7722 above for V1 level 1 is really the difference between level 1 and level 2 of V1.  So, the test on V1 level 1 is a test of the difference between those two levels of V1. The INTERCEPT value is the actual estimate for the last level of V1, making the actual estimate for V1 level 1 equal to 2.3605 - 1.7722.

 

A similar interpretation can be made for the interaction term.  The estimate for X1 is actually the estimate for X1*V1 level 2, while the estimate for X1*V1 is a test of the difference in the slopes of X1 across the two levels of V1. 

 

Now take a look at the results of the Tests of Fixed Effects section:

 

 

                  Type 3 Tests of Fixed Effects

 

                  Num     Den

    Effect         DF      DF    F Value             Pr > F

 

    v1              1      36      10.18               0.00

    x1              1      36       4.03               0.05

    x1*v1           1      36       1.63               0.21

 

 

These results can be hard to understand if you are not familiar with Type 3 tests.  To help understand the tests, the /E3 option shows exactly how each test is formed.  For V1, the /E3 option shows:

 

 

                      Type 3 Coefficients

                            for v1

 

                   Effect       v1      Row1

 

                   Intercept

                   v1           1          1

                   v1           2         -1

                   x1

                   x1*v1        1

                   x1*v1        2

 

 

The coefficients on V1, the 1 and -1, show that the Type 3 test is testing a difference in the levels of V1.  This is the same test you get in the solution output for V1. 

 

For X1, the /E3 option shows:

 

 

                     Type 3 Coefficients

                            for x1

 

                   Effect       v1      Row1

 

                   Intercept

                   v1           1

                   v1           2

                   x1                      1

                   x1*v1        1        0.5

                   x1*v1        2        0.5

 

 

which implies that the Type 3 test is testing that the average slope of X1 across the two levels of V1 is not equal to 0.  We do not get a similar test in the solution option.  Remember, the test on X1 in the solution option is a test that the slope on X1 for the second level of V1 is not zero.

 

For X1*V1, the /E3 option shows:

 

 

                     Type 3 Coefficients

                           for x1*v1

 

                   Effect       v1      Row1

 

                   Intercept

                   v1           1

                   v1           2

                   x1

                   x1*v1        1          1

                   x1*v1        2         -1

 

 

which is a test of the equality of the slopes on X1 across the two levels of V1.  This is the same test we get in the solution output.

 

Here are the results of the LSMEANS statement with the PDIFF option:

 

 

               Differences of Least Squares Means

 

                             Standard

  Effect  v1  _v1  Estimate     Error    DF  t Value  Pr > |t|

 

  v1      1   2     -1.1531    0.2721    36    -4.24    0.0001

 

 

This result is different from the test on V1 in either the solution output or Type 3 tests output.  The /E option on the LSMEANS statement shows why:

 

 

                      Coefficients for v1

                      Least Squares Means

 

              Effect       v1      Row1      Row2

 

              Intercept               1         1

              v1           1          1

              v1           2                    1

              x1                 0.4745    0.4745

              x1*v1        1     0.4745

              x1*v1        2               0.4745

 

 

In the Type 3 tests, we test the difference in the two levels of V1 assuming that the value of X1 is 0.  In the LSMEANS result, we test the difference in the two levels of V1 at the mean value of the covariate, X1, of .4745.  Since the slopes of X1 are different across the two levels of V1, you will get a different test depending on the value of X1 used.  This difference causes some statisticians to mean-center their covariates before running an analysis.  If the mean value of the covariate is 0, then these test results will agree.

 

All of the above hypothesis tests are interesting, but they do test different things.  By understanding how the model is parameterized and using the /E3 and /E options, you can see exactly what tests are performed. 

 

 

 

sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Perhaps this link will help. An internet search will turn up more resources, although many involve one or more continuous predictors, and you have two categorical predictors.

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 3 replies
  • 3436 views
  • 0 likes
  • 4 in conversation