BookmarkSubscribeRSS Feed
Melk
Lapis Lazuli | Level 10

I am trying to run a mixed model on a very small number of subjects with pre-post data. the data was collected over time simply due to the nature of the intervention, the collected timpoints pre and post and between patients are totally random and not equally spaced. I want to simples conclude that the post was better than the pre (which means the post values are greater, overall, than the pre). After some research, I came up with this model:

 

proc glimmix data=long;
  class Trial id;
      model y = Trial | time / solution;
      random intercept / subject=id;
      random intercept time/ subject=Trial*id type=sp(pow);
run;
quit;

 

 

Can anyone confirm that this indeed the best way to model this research question?

 

If so, I am getting the error message:

 

ERROR 79-322: Expecting a (.
ERROR 76-322: Syntax error, statement will be ignored.

 

at the end of the second random statement. Cant see to figure out why. Any help would be appreciated.

16 REPLIES 16
WarrenKuhfeld
Rhodochrosite | Level 12

A list is expected.  Here is the doc (without the formulas).

 

http://go.documentation.sas.com/?docsetId=statug&docsetVersion=14.2&docsetTarget=statug_glimmix_synt...

 

SP(POW)(c-list)

models a power covariance structure 

where . This is a reparameterization of the exponential structure, TYPE=SP(EXP). Specifically, . See TYPE=SP(EXP) for the computation of the distance  from the variables specified in c-list. When the estimated value of  becomes negative, the computed covariance is multiplied by  to account for the negativity.

 

 

 

 

 

 

Melk
Lapis Lazuli | Level 10

Actually, I am a little new to the glimmix procedure, so forgive me.

 

When I run the model with the above code, trial is insignificant

 

When I remove the interaction and just run the model on trial, trial becomes significant.

 

Based on my reseach question - is it ok to remove the interaction ?

Rick_SAS
SAS Super FREQ

The syntax is TYPE=SP(POW)(time)

Melk
Lapis Lazuli | Level 10

Thank you, I think I should be interpreting the time by trial interaction here, but the research question actually has nothing to do with difference by time- would it be more appropriate to report just the estimates for trial?

 

When I run the model with the above code, trial is insignificant

 

When I remove the interaction and just run the model on trial, trial becomes significant.

 

Based on my reseach question - is it ok to remove the interaction ?

WarrenKuhfeld
Rhodochrosite | Level 12

Sorry. I'll have to defer to others on the best way to set up your model.  I just responded because I knew the nature of your syntax error question.

sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

What is the TRIAL factor, and what role does it play in your study?

Melk
Lapis Lazuli | Level 10

Data is longitudinal; trial = pre or post variable.

sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Hmm. If TRIAL is the factor for pre/post (in other words, if TRIAL has two levels, one for pre and one for post), then what is TIME?

 

Melk
Lapis Lazuli | Level 10

Yes, a big confusing! At each trial (pre and post) the subject performed a task repeatedly over an interval of time, measurements were recorded at random intervals of time (5 secs, 10 secs, 18 sec, etc.)

sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Why did you use random time intervals? How many time intervals do you have for each trial for each subject? Do you have the same number of time observations for each trial for each subject? Does the response Y have a linear relationship with TIME?

 

 

Melk
Lapis Lazuli | Level 10

The time intervals for each trial/subject can vary - some have 5, some have 3, and the timepoints where measurements were taken were random (e.g. subject 1 had measurements at 5, 16, 21, and 27 secs while subject 2 had measurements at 3, 10, and 19 secs).

Y has a close to linear relationship with time.

sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Then I think something like this code might be appropriate, where CTIME = TIME

 

proc glimmix data=long;
    class trial id ctime;
    model y = trial | time / solution ddfm=kr2;
    random intercept / subject=id;
    random intercept time / subject=trial*id type=vc;
    random ctime / subject=trial*id type=sp(pow)(time) residual;
    output out=long_out pred=pred pred(noblup)=predpa;
    run;
/*  Observed and predicted (BLUP) for each trial for each id */
proc sgpanel data=long_out;
    panelby id;
    scatter x=time y=y / group=trial;
    series x=time y=pred / group=trial;
    run;
/*  Observed and predicted (BLUE) for each trial */
proc sgpanel data=long_out;
    panelby trial;
    series x=time y=y / group=id lineattrs=(pattern=2 color=red);
    series x=time y=predpa / lineattrs=(pattern=1 color=black);
    run;

 

Consider the statement

 

random intercept time / subject=trial*id type=vc;

You are defining a 2 x 2 covariance matrix here. With TYPE=VC, it estimates (1) the variance among intercepts, and (2) the variance among slopes. With TYPE=UN, it estimates (1) the variance among intercepts, (2) the variance among slopes and (3) the covariance among intercepts and slopes. Because it is just a 2 x 2 matrix, TYPE=SP(POW)(c-list) makes no sense here. Be sure that you have an adequate understanding of random coefficient models. https://www.sas.com/store/books/categories/usage-and-reference/sas-for-mixed-models-second-edition/p... by Littell et al. has a good chapter on the topic.

Melk
Lapis Lazuli | Level 10

So is time a SAS keyword here?

sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Here it is the factor you identified as TIME in your original post. I don't know the "blue or not blue" rule for the code inset.

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
  • 16 replies
  • 2168 views
  • 12 likes
  • 4 in conversation