Programming the statistical procedures from SAS

Class variable and interaction in PROC MIXED

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Class variable and interaction in PROC MIXED

Hey All,

I'm having some confusion running a repeated measures regression model in SAS proc mixed and hoping to get some help. I'm trying to determine whether or not I need to include the dichotomous variable in the interaction term (shown in the model below) in my Class line and why when I do so, I only get results for one level of the dichotomous variable.  Here is the model :

proc mixed data =   ks_adh.CPTII_sts_fixed_lbdi_cent;

class patno session sex;

model bdi = lbdi_cent sitenum F1_cpt3_Mean_cent_resid|sex   /s covb CL;

repeated session  / type=un subject = patno ;

run;

In the model = BDI is a continuous variable and represents patients scores on a depressive symptom measure at their 2nd,3rd,4th, and 5th sessions of treatment (or their next session BDI score). We are predicting this from : (1) The main effect of their BDI score at the current session (sessions 1,2,3,4) , the main effect of site, main effect of ratings of therapists use of cognitive methods at the current session (sessions 1,2,3,4- represented by the F1_cpt3_Mean_cent_resid variable), the main effect of patients sex, and the interaction of cognitive methods at each current session and patient sex. If I include sex in the class statement - in the output window, solutions for Fixed effects are only available for one level of SEX as shown here:

                                        Solution for Fixed Effects

Effect                                     sex     Estimate       Error      DF    t Value    Pr > |t|     Alpha

sitenum                                             -0.4326      0.4830      54      -0.90      0.3744      0.05

F1_cpt3_Mean_cent_re                        -0.1276      1.5644      54      -0.08      0.9353      0.05

sex                                         -0.5      0.2167      0.4812      54       0.45      0.6543      0.05

sex                                          0.5           0           .       .        .         .             .

F1_cpt3_Mean_cen*sex            -0.5     -6.0599      2.1393      54      -2.83      0.0065      0.05

F1_cpt3_Mean_cen*sex              0.5           0           .       .        .         .             .

Does anyone know why solutions don't appear for the .5 level of the sex variable?

Beyond this, is it necessary that I include sex in the class  statement? It's important to note, that I am going to plug the estimates derived from these analyses into the Johnson-Neyman tool for probing interactions: Two-Way Interaction Effects in MLR  in order to determine the simple slope of the F1 variable at each level of sex . Given this, should the estimates for fixed effects and the variance/covariances that I plug into the JN calculator be from a model that DOES include sex in the class statement? or from a model that does NOT include sex in the class statement. Simple slopes generated differ drastically among the two approaches. Any help at all or tips would be greatly appreciated!


Accepted Solutions
Solution
‎07-14-2014 10:19 AM
Respected Advisor
Posts: 2,655

Re: Class variable and interaction in PROC MIXED

When main effects and interactions are included in a model, the solution vector (by default) sets the last value to zero to avoid a singular matrix.  All other values need to be thought of as deviations from the intercept or overall slope as appropriate.

I see that you are treating sitenum as a continuous variable as well, so you have a multiple regression situation, where data imbalance will make estimates differ when alternative models are fit.

In any case, the last version of the output fits separate slopes, but a common intercept, by sex for f1_cpt3_mean_cen.  The first fits separate sloptes, and separate deviations from the overall intercept, by sex for this regression.

Steve Denham

View solution in original post


All Replies
New Contributor
Posts: 2

Re: Class variable and interaction in PROC MIXED

Just to give an update= After playing around with things, I noticed that when the main fixed effects of SEX and F1_cpt3_Mean_cent_re are NOT included in the model (but the interaction term is ) I do get results for both levels of the Sex variable (see model below):

proc mixed data =   ks_adh.CPTII_sts_fixed_lbdi_cent;

class patno session sex;

model bdi = lbdi_cent sitenum  F1_cpt3_Mean_cent_resid*sex   /s covb CL;

repeated session  / type=un subject = patno ;

run;

RESULTS:

                                     Solution for Fixed Effects

                                                     Standard

Effect                  sex     Estimate       Error      DF    t Value    Pr > |t|     Alpha

Intercept                        24.0615      0.2226      55     108.12      <.0001      0.05

lbdi_cent                         0.9774     0.02413      55      40.51      <.0001      0.05

sitenum                          -0.4730      0.4603      55      -1.03      0.3086      0.05

F1_cpt3_Mean_cen*sex    -0.5     -6.1841      1.4618      55      -4.23      <.0001      0.05

F1_cpt3_Mean_cen*sex     0.5     -0.1531      1.5656      55      -0.10      0.9224      0.05

HOWEVER, when the main effects AND the interaction are included ( as they were in the model I originally posted about) I do NOT get results for both levels of sex (see model and results above) . Anyone know why this is the case? and how I could get the results for the main effects AND both levels of my Sex and Sex by F1 interaction? This would solve all of my problems! thanks

Solution
‎07-14-2014 10:19 AM
Respected Advisor
Posts: 2,655

Re: Class variable and interaction in PROC MIXED

When main effects and interactions are included in a model, the solution vector (by default) sets the last value to zero to avoid a singular matrix.  All other values need to be thought of as deviations from the intercept or overall slope as appropriate.

I see that you are treating sitenum as a continuous variable as well, so you have a multiple regression situation, where data imbalance will make estimates differ when alternative models are fit.

In any case, the last version of the output fits separate slopes, but a common intercept, by sex for f1_cpt3_mean_cen.  The first fits separate sloptes, and separate deviations from the overall intercept, by sex for this regression.

Steve Denham

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 465 views
  • 0 likes
  • 2 in conversation