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.
A list is expected. Here is the doc (without the formulas).
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.
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 ?
The syntax is TYPE=SP(POW)(time)
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 ?
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.
What is the TRIAL factor, and what role does it play in your study?
Data is longitudinal; trial = pre or post variable.
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?
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.)
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?
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.
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.
So is time a SAS keyword here?
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.