Programming the statistical procedures from SAS

Glimmix model: confirmation and error debugging

Reply
Frequent Contributor
Posts: 76

Glimmix model: confirmation and error debugging

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.

SAS Super FREQ
Posts: 287

Re: Glimmix model: confirmation and error debugging

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.

 

 

 

 

 

 

Frequent Contributor
Posts: 76

Re: Glimmix model: confirmation and error debugging

Posted in reply to WarrenKuhfeld

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 ?

SAS Super FREQ
Posts: 3,752

Re: Glimmix model: confirmation and error debugging

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

Frequent Contributor
Posts: 76

Re: Glimmix model: confirmation and error debugging

[ Edited ]

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 ?

SAS Super FREQ
Posts: 287

Re: Glimmix model: confirmation and error debugging

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.

PROC Star
PROC Star
Posts: 229

Re: Glimmix model: confirmation and error debugging

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

Frequent Contributor
Posts: 76

Re: Glimmix model: confirmation and error debugging

Data is longitudinal; trial = pre or post variable.

PROC Star
PROC Star
Posts: 229

Re: Glimmix model: confirmation and error debugging

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?

 

Frequent Contributor
Posts: 76

Re: Glimmix model: confirmation and error debugging

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.)

PROC Star
PROC Star
Posts: 229

Re: Glimmix model: confirmation and error debugging

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?

 

 

Frequent Contributor
Posts: 76

Re: Glimmix model: confirmation and error debugging

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.

PROC Star
PROC Star
Posts: 229

Re: Glimmix model: confirmation and error debugging

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.

Frequent Contributor
Posts: 76

Re: Glimmix model: confirmation and error debugging

So is time a SAS keyword here?

PROC Star
PROC Star
Posts: 229

Re: Glimmix model: confirmation and error debugging

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.

Ask a Question
Discussion stats
  • 16 replies
  • 551 views
  • 12 likes
  • 4 in conversation