Hello proc mixed experts,
Variables in my data are person ID, itemduration(time spent answering each question), difficulty(item difficulty). Each person ID answers 150 questions, that is, row 1-row 150 are the same ID, row 151-row 300 are another person ID, etc. Item nested in person(ID), I am trying a multilevel modeling (two level model). Dependent variable is itemduration, level 1 predictor is item difficulty. Model below contains only level1 predictor.
proc mixed data= try method=ml;
class ID;
model itemduration = difficulty / solution outp=t;
random intercept difficulty / subject=ID type=un g solution;
ods output solutionR=randest;
run;
the following is portion of the output data "randest", I can't understand why "std Err Pred" are the same for all IDs. I am trying to get standard errors for each ID. How should I edit the code so that I can get standard errors for each ID?
Thank you for any help.
What does the output look like for the covariance parameters? What does the G matrix look like?
I suspect you get the same standard errors because the variable "difficulty" appears both in the MODEL statement as a fixed effect and in the RANDOM statement.
What happens if you change the MODEL statement to
model itemduration = / solution outp=t;
That should also change the df in the table from the residual df to the contained df.
Alternatively, consider 'difficulty' as a repeated effect measured on each ID, and model as an R side effect. You then have 2 levels on the R side (difficulty and ID within difficulty). Code would look like:
proc mixed data= try method=ml;
class ID;
model itemduration = difficulty / solution outp=t;
random intercept / subject=ID g solution;
repeated difficulty/ subject=ID r;
ods output solutionR=randest;
run;
Without some data to try these on, I can't be sure how to move beyond something like these.
SteveDenham
Thanks for the suggestions!
I am trying to investigate the effect of item difficulty on item response time, so I tried your code considering 'difficulty' as a repeated effect measured on each ID. However, I got the following error message
283 proc mixed data=long;
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
ERROR: Only CLASS variables allowed in this effect.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.T_NEW may be incomplete. When this step was stopped there were 0
observations and 0 variables.
284 class ID;
285 model itemdur = difficulty / solution outp=t;
286 random intercept / subject=ID g solution;
287 repeated difficulty/ subject=ID r;
288 ods output solutionR=randest;
289 run;
Could you please help how to modify the code so that to get correct results. I attached the data file for your reference. In the attached data, person 600096 answered 150 items (row 2-row 151), person 635021 answered the same set of items (row 152-row 301), etc. There are 37 person ID in total.
Thanks!
Hi superbug,
It looks to me that your G matrix might not be positive definite -- the estimated variance for the subject slope (deviation) of difficulty might be zero, and that might be the reason why the standard errors for your random slope estimates for each subject is zero. The reason why the standard errors for the random intercept for each subject is constant, is probably because of a balanced data you have. Is that the case -- that you have a balanced data?
There is nothing wrong with your code or PROC MIXED. Your data situation might be the reason why.
Hope this makes sense.
Jill
Thanks for your comments!
My G matrix looks like the following
Convergence criteria met. |
Estimated G Matrix | ||||
---|---|---|---|---|
Row | Effect | ID | Col1 | Col2 |
1 | Intercept | 600096 | 102.02 | 21.0655 |
2 | difficulty | 600096 | 21.0655 |
Does the G matrix above means it is not be positive definite
Also based on my data structure (as the attached), what's the best model would you suggest to use?
Thanks again!
You should see the following message in the Log --
NOTE: Estimated G matrix is not positive definite.
So yes, your G matrix is not positive definite.
You might consider taking out DIFFICULTY from the RANDOM statement.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.