BookmarkSubscribeRSS Feed
L_HE
Calcite | Level 5

Hey guys, I have a question in PROC MIXED. I am analysing a dataset with several participants who have been tested four times with various time intervals. The demo dataset is as follows:

 

DATA demo;

                INPUT ID $ sex $ group $ time DV IV1 IV2 IV3 ;

                DATALINES;

001 1 A 10 10 0.4 0.6 0.7

001 1 A 30 10 0.4 0.6 0.7

001 1 A 60 12 0.4 0.6 0.7

001 1 A 80 13 0.4 0.6 0.7

002 0 B 15 8 0.5 0.7 0.5

002 0 B 30 7 0.5 0.7 0.5

002 0 B 50 10 0.5 0.7 0.5

002 0 B 75 11 0.5 0.7 0.5

003 1 B 18 10 0.3 0.5 0.8

003 1 B 32 11 0.3 0.5 0.8

003 1 B 55 11 0.3 0.5 0.8

003 1 B 80 14 0.3 0.5 0.8

;

 

The values of DV are measured four times while the time intervals vary with paticipants. The IV1, IV2 and IV3 are values of independent variables at baseline level.

I would like to analysis the effect of time and baseline IV (separately) on DV while control for sex and group, and I assume there is a random effect of participant and time.Therefore, I use the following code:

 

PROC MIXED DATA = demo;

            CLASS ID sex group;

            MODEL DV = IV1 time group|sex / SOLUTION;

            RANDOM intercept time / TYPE = VC SUBJECT = ID;

            REPEATED / SUBJECT = ID TYPE=SP(POW)(time);

RUN;

 

PROC MIXED DATA = demo;

            CLASS ID sex group;

            MODEL DV = IV2 time group|sex / SOLUTION;

            RANDOM intercept time / TYPE = VC SUBJECT = ID;

            REPEATED / SUBJECT = ID TYPE=SP(POW)(time);

RUN;

 

PROC MIXED DATA = demo;

            CLASS ID sex group;

            MODEL DV = IV3 time group|sex / SOLUTION;

            RANDOM intercept time / TYPE = VC SUBJECT = ID;

            REPEATED / SUBJECT = ID TYPE=SP(POW)(time);

RUN;

 

My question is:

 

  1. in the RANDOM and REPEATED statement, how can I decide which TYPE should be used?

 

  1. when I use the above codes, from the results, I find that the Estimate of time is the same in IV1, IV2 and IV3, but the Estimates of IVs are changed. Is that normal? Is that because I choose a wrong TYPE? Or should I add quadratic or cubic time? If so, how do I know whether to add quadratic and cubic time or not?

 

Many thanks!

 

3 REPLIES 3
seeff
Obsidian | Level 7

1. Matrix structure is selected using a combination of judgment and fit. Judgment because some types are inappropriate for certain conditions (i.e., autoregressive structures may not be appropriate for unequal intervals) and fit because part of modeling is determining the structure that best suits your observed data. Here is a good review of selecting a structure: https://support.sas.com/resources/papers/proceedings/proceedings/sugi30/198-30.pdf 

 

2. If the estimate of time is stable regardless of which covariates you introduce, this probably just means that time and your covariates are not explaining the same variance in the DV. I am unsure why this would lead you to wonder about polynomials of time; you should rely on your exploratory data analysis (and model fit diagnostics) to tell you about whether that is necessary.

 

 

L_HE
Calcite | Level 5

Hi Seeff,

 

Thanks for your reply.

The pdf file is very helpful.

 

About the second question, I had the confusion because I would expect an interaction between the IV and the time. That's why I was surprised when the coefficient of time remained consistent. However, I could not add the IV*time term because both of them are continuous variables.

seeff
Obsidian | Level 7

Hm, I don't follow. Your original question was:

 

I find that the Estimate of time is the same in IV1, IV2 and IV3, but the Estimates of IVs are changed. Is that normal?

 

I took this question to mean you were referring to the estimates of the fixed effects of IV and time (the rest of what I write is predicated on that). But, then you typed this:

 

I had the confusion because I would expect an interaction between the IV and the time. That's why I was surprised when the coefficient of time remained consistent. However, I could not add the IV*time term because both of them are continuous variables.

 

There is no restriction on interactions among continuous variables in generalized linear models; there is no problem with adding a continuous*continuous term as a fixed effect. Are you trying to put this effect in the REPEATED line, by chance (I cannot see *why* you'd do that, but it would throw the error that only class level variables are allowed).

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
  • 1451 views
  • 0 likes
  • 2 in conversation