Hi,
I have a question about plotting a figure for a mixed model. Time is a categorical variable, the outcome is a score, and the covariate is the site.
Here is my code:
PROC MIXED DATA = test METHOD = REML COVTEST ;
CLASS id site time_dichotomous_number(ref="1");
MODEL Score =time_dichotomous_number site time_dichotomous_number*site/ SOLUTION OUTPRED=PREDDATA;
RANDOM INTERCEPT / SUBJECT = record_id;
repeatedtime_dichotomous_number / type=ar(1) sub=id;
store out=MixedModel;
RUN;
proc plm restore=MixedModel;
effectplot interaction (x=site sliceby=time_dichotomous_number) / clm connect;
effectplot interaction (x=time_dichotomous_number sliceby=site) / clm connect;
run;
Regardless of how I label the categorical time variable, whether it's named 1-7, using letters (a, b, c, d...), or with a space before the letter, the figure consistently put time 1 at the end (Time 1 is the reference group when running the mixed model). Does anyone know how to position time 1 before time 2? Thanks!
Additionally, on the y-axis, it is labeled as "linear predictor." Is this the mean predicted value generated from the mixed model?
Thanks!
One way to get what you wanted is to run PROC MIXED twice. Once with the (ref="1") option in the CLASS statement so you get what you want for the parameter estimates, and no STORE statement is needed. Then you can run PROC MIXED the second time, with no (ref="1") option in the CLASS statement. Use the STORE statement this time. Then your PROC PLM output should display the time in the order as you wanted. To speed up the second PROC MIXED, you might add NOTEST option in the MODEL statement, also add NOINFO NOITPRINT NOCLPRINT options in the PROC MIXED statement.
Alternatively, you might define a format for your variable time_dichotomous_number, such that the format for "1" comes first alphabetically, and assign this format to the variable time_dichotomous_number.
Yes, the values being plotted are the predicated values from your PROC MIXED model.
Hope this helps,
Jill
One way to get what you wanted is to run PROC MIXED twice. Once with the (ref="1") option in the CLASS statement so you get what you want for the parameter estimates, and no STORE statement is needed. Then you can run PROC MIXED the second time, with no (ref="1") option in the CLASS statement. Use the STORE statement this time. Then your PROC PLM output should display the time in the order as you wanted. To speed up the second PROC MIXED, you might add NOTEST option in the MODEL statement, also add NOINFO NOITPRINT NOCLPRINT options in the PROC MIXED statement.
Alternatively, you might define a format for your variable time_dichotomous_number, such that the format for "1" comes first alphabetically, and assign this format to the variable time_dichotomous_number.
Yes, the values being plotted are the predicated values from your PROC MIXED model.
Hope this helps,
Jill
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.