BookmarkSubscribeRSS Feed
franSTATS
Calcite | Level 5

Hi,

I was wondering if anyone can help me on this. I am not sure whether I am correctly specifying the random intercept in my model. I need some advices. I am interested in understanding if there are differences in looking behaviours between 5 groups of children, between 2 conditions (condition 1 and 2). Looking behaviours were collected at 2 time points (time 1 and time 2 - repeated measure). I want to model a random intercept for each subject and fit random intercept for time. The model fits the beta distribution as the outcome variable is proportion data using the logit link function (values vary between 0 and 1).   

Example of my data

ID   Group   Time   Condition  Looking

1         0            1              1                 0.87

1         0            2             2                0.22

2         1             1              1                0.97

2         1             2             2              0.30       

This is my code

proc glimmix data=mydata plots=residualpanel;
class group condition time;
model Looking= group condition time group*condition group*condition*time /dist=beta link=logit ddfm=satterthwaite solution;
random intercept / subject=ID type=un;
random intercept time / subject=ID type=un; 
run;

I believe that the first random intercept specify the subject variation. In the second random intercept I am not sure whether the random intercept applies variability across subjects at each level of time point. When I add the intercept of time the residuals plots show more deviations than the subject variation model only. 

Also, the empirical = classical accounts for robust standard error?

Thank you for your time and help 

 

 

3 REPLIES 3
SteveDenham
Jade | Level 19

I would suggest the following code:

 

proc glimmix data=mydata plots=residualpanel method=laplace;
/* you might want to explore method=quad or method=fastquad */
class group condition time;
model Looking= group condition time group*condition group*condition*time /dist=beta link=logit ddfm=kr2 solution;
random intercept / subject=ID type=un;
random  time / subject=ID(group*condition) type=un; 
run;

So long as time is a class variable, a random intercept for only time isn't going to be meaningful, especially when there are only two levels. The GLM parameterization sets the last level to zero in the solution. I think the change in red in the last RANDOM statement will address the issue you are describing. If it doesn't, then you might consider dropping the first RANDOM statement completely and using your existing second RANDOM statement as the only one.

 

Other changes are to shift from the pseudo-likelihood default method to METHOD=laplace, and to use the Kenward-Roger2 method for ddfm, as it builds in a shrinkage based approach to the standard errors.

 

SteveDenham

 

FreelanceReinh
Jade | Level 19

@SteveDenham wrote:

I would suggest the following code:

 

proc glimmix data=mydata plots=residualpanel method=laplace;
/* you might want to explore method=quad or method=fastquad */
class group condition time;
model Looking= group condition time group*condition group*condition*time /dist=beta link=logit ddfm=kr2 solution;
random intercept / subject=ID type=un;
random  time / subject=ID(group*condition) type=un; 
run;

(...)


[Just to make the red highlighting visible, which was overridden by the automatic syntax highlighting.]

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 3 replies
  • 964 views
  • 1 like
  • 3 in conversation