BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Cruise
Ammonite | Level 13

Could you please help understand why Time*Group interactions are not quantified? in the proc mixed model (See SAS output in Fig 2 below)? What am I missing here?

 

Let me give you a background of this: I'm working with randomized clinical trial with wait-list control where wait-listed subjects eventually received identical treatment as controls had. Fig 1 shows trial scheme. Please note that this is a small pilot study with unbalanced, missing, loss in follow up and potential that wait-listed subjects were not happy to be wait-listed..et.c issues. However, for the benefit of learning, I wanted to use the data and thought mixed model would help. See code below and "sas_forum_data.csv" is attached. In Fig 1, "time" variable is coded after number of weeks passed until each groups receive treatment (David Howell, Reference at the end). "group" variable is coded 1 for wait-listed subjects vs 2 for treatment group. SAS version here is 9.4.

 

proc mixed data = sas_forum_data;
    class group1 time1 subj;
    model pcs = group1 time1 group1*time1/solution;
    random subj(group1); 
    repeated time1/ type = AR(1) subject = subj(group1) rcorr;
run;

 

Fig 1:

time, group nobs.png

Fig2:

proc mixed output.png

 

Reference:

http://www.uvm.edu/~dhowell/StatPages/Mixed-Models-Repeated/Mixed-Models-for-Repeated-Measures1.html

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Add a LSMEANS statement to your code. I think that is what you want.

--
Paige Miller

View solution in original post

13 REPLIES 13
PaigeMiller
Diamond | Level 26

There are not enough degrees of freedom to calculate all of the model terms you have requested.

 

Also, to estimate interactions, there must be at least one data point at each level of the interaction, otherwise you can't estimate the interaction.

 

One or both of these is happening here.

 

You might want to treat time1 as a continuous variable instead of a class variable, if that meets your needs (which it may not).

--
Paige Miller
Cruise
Ammonite | Level 13

@PaigeMiller

How about exclude data corresponding to time point of "9" (where wait-listed are receiving treatment after 4 week wait) and code time 16 to 12? Because data at 12 and 16 time points are comparable concentually both being 3-month follow-up?

PaigeMiller
Diamond | Level 26

This is something I can't help you with, it's not a SAS or statistical issue. The decision to do this has to be based on the project needs -- which you understand a lot better than I do.

--
Paige Miller
Cruise
Ammonite | Level 13
Your comment makes total sense. Now I can see what's happening here. I'll let you know what happens when I recode time variable rather conceptually than chronologically.
Cruise
Ammonite | Level 13
I can not lump across the different groups because I have a restriction of "subject = subj(group1)" in the mixed model where variations between subjects matter.
PaigeMiller
Diamond | Level 26

@SUNY_Maggie wrote:
I can not lump across the different groups because I have a restriction of "subject = subj(group1)" in the mixed model where variations between subjects matter.

Sometimes the real world study and data is not amenable to the statistical method we would like to use.

 

Here's my opinion on what to do next, for what it's worth. Since you can't estimate the interactions you want, I would take them out of the model and make a note of that when you report on the results. But you are more knowledgeable about this study, perhaps that's not acceptable, or you have other ideas on how to proceed.

--
Paige Miller
Cruise
Ammonite | Level 13

@PaigeMiller

Hi Paige,

As we discussed, there are two main issues here. Degrees of freedom (my smallest group has N=6) and uneven number of groups would be needed for interection terms. I can allocate study subjects to even number of time points. With that done, if I had 12 subjects instead 6, would my interection terms be calculated?   

 

I've been looking out for resources for sample size requirements for multi-level models. It seems there is no rules of thumb for min number of subjects to have per condition as long as the researcher is aware of loss of power due to small sample size. Maxwell and Delany (2004) Designing Experiments and Analyzing data. Chapter 14.

PaigeMiller
Diamond | Level 26

@SUNY_Maggie wrote:

@PaigeMiller

Hi Paige,

As we discussed, there are two main issues here. Degrees of freedom (my smallest group has N=6) and uneven number of groups would be needed for interection terms. I can allocate study subjects to even number of time points. With that done, if I had 12 subjects instead 6, would my interection terms be calculated?   

 

I've been looking out for resources for sample size requirements for multi-level models. It seems there is no rules of thumb for min number of subjects to have per condition as long as the researcher is aware of loss of power due to small sample size. Maxwell and Delany (2004) Designing Experiments and Analyzing data. Chapter 14.


 

The inability to estimate interactions comes from the design not having all possible combinations of Time*Group. Until you have a design that has all of these possible combinations, you will not be able to estimate interactions. It does not depend on the number of subjects.

 

 

--
Paige Miller
Cruise
Ammonite | Level 13

@PaigeMiller

After modification, Proc freq now shows that I have all possible combinations of Time*Group. Yet interactions terms are not calculated. Could you please look at the attached output?

proc freq.png

PaigeMiller
Diamond | Level 26

It would help if you could chop down the .pdf file to simply the parts relevant to the question you ask.

 

Nevertheless, on page 15 we see that you have 2 degrees of freedom for the interaction, which is the correct number, so it is ALL there! The 2 df for interaction is computed as (number of levels of time-1)*(number of levels of group-1) = (3-1) * (2- 1) = 2.

 

What SAS does with this specific model is it has to zero out terms that cannot be estimated. If you really want to see the effects of each of the six levels of the interaction, you could estimate the model

 

model pcs = group1 time1 group1*time1/solution;

and this will give you five (one for each degree of freedom) and a zero for the sixth level of the interaction. But then you get no main effects for group1 and time1. This is a consequence of basic modeling math in the case of categorical variables. If you have n levels, you can only estimate n-1 effects.

 

Going one step further, if you eliminate the intercept from the model, now you can get all six interaction effects:

 

model pcs = group1 time1 group1*time1/solution noint;

However, all of these models are in effect identical ... they will produce the exact same predicted values, and in fact if you were to write out each model and combine terms, you find the coefficients are identical and the predicted values are identical. There is no reason to prefer one over the other. Again, basic math in the case of categorical variables.

 

 

Now, I think perhaps what you REALLY want (again, this is my understanding of your questions) is the table of MEANS or LSMEANS that are produced from the model, where you can indeed get six distinct means for each of the six interaction levels; plus additional tables of MEANS or LSMEANS for each of the three time1 levels, plus two additional MEANS or LSMEANS for each of the two group1 levels.

 

UPDATE: The above SAS code is just sloppy on my part, I cut and pasted and didn't make the necessary modifications. The code should read

model pcs = group1*time1/solution;

model pcs = group1*time1/solution noint;
--
Paige Miller
Cruise
Ammonite | Level 13

@PaigeMiller

Thank you very much Paige. It's not acceptable that I had uploaded whole two days of history of outputs there! I actually noticed it at my first attempt then cleared the Results Viewer. I probably had cleared the Log not the Viewer by mistake. I apologize.

 

I'm still puzzled that most interaction terms requested are not created (See Snapshot below). Below is the code I used. Only modification made was that now incercept is eliminated.

 

 

proc mixed data = have;
    class group1 time1 subj;
    model pcs = group1 time1 group1*time1/solution noint;
    random subj(group1); 
    repeated time1/ type = AR(1) subject = subj(group1) rcorr;
run;

Output from using above code:

relevant part.png

 

Attached is the underlying data, just in case.

PaigeMiller
Diamond | Level 26

Add a LSMEANS statement to your code. I think that is what you want.

--
Paige Miller
Cruise
Ammonite | Level 13

@PaigeMiller

 

Thank you Paige. It seems that LSmeans is what I needed. How I used it in the code below make sense? That's because I'm interested in differences between control and teatment groups across three different measurement time points.

 

    proc mixed data = have;
    class group2 time1 subj;
    model pcs = group2 time1 group2*time1/solution noint;
    random subj(group2); 
    repeated time1/ type = AR(1) subject = subj(group2) rcorr;
lsmeans group2*time1/diff; ods output diffs=diff; run;

Resulting output seems to be showing that all control vs treatment groups are sig different from each other whereas within group differences have P>0.05 (0.87 for control vs control  and 0.40 for treatment vs treatment).

Is the way I interpret the results make sense?

relevant part.png

 

l

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 13 replies
  • 7809 views
  • 2 likes
  • 2 in conversation