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
- /
- PROC MIXED TIME*GROUP INTERACTION TERMS ARE NOT CA...

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

06-12-2017 10:47 AM

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:

Fig2:

Reference:

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

Accepted Solutions

Solution

06-14-2017
01:53 PM

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

Posted in reply to Cruise

06-14-2017 01:03 PM

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

--

Paige Miller

Paige Miller

All Replies

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

Posted in reply to Cruise

06-12-2017 11:12 AM - edited 06-12-2017 11:17 AM

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

Paige Miller

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

Posted in reply to PaigeMiller

06-12-2017 11:20 AM

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?

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

Posted in reply to Cruise

06-12-2017 11:21 AM - edited 06-12-2017 11:22 AM

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

Paige Miller

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

Posted in reply to PaigeMiller

06-12-2017 11:25 AM

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.

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

Posted in reply to PaigeMiller

06-12-2017 11:43 AM

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.

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

Posted in reply to Cruise

06-12-2017 02:27 PM

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

Paige Miller

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

Posted in reply to PaigeMiller

06-14-2017 10:40 AM - edited 06-14-2017 10:45 AM

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.

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

Posted in reply to Cruise

06-14-2017 10:59 AM

SUNY_Maggie wrote:

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

Paige Miller

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

Posted in reply to PaigeMiller

06-14-2017 11:42 AM

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?

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

Posted in reply to Cruise

06-14-2017 12:00 PM - edited 06-14-2017 01:09 PM

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

Paige Miller

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

Posted in reply to PaigeMiller

06-14-2017 12:38 PM

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:

Attached is the underlying data, just in case.

Solution

06-14-2017
01:53 PM

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

Posted in reply to Cruise

06-14-2017 01:03 PM

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

--

Paige Miller

Paige Miller

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

Posted in reply to PaigeMiller

06-14-2017 01:42 PM

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?

l