BookmarkSubscribeRSS Feed
Fluorite | Level 6



Please I need your urgent help, 

I have Hierarchically data and I want to fit three level models in proc Mixed, it was working perfectly when I specify (random intercept/sub=Id), but when I changed it to nested I got missing in Pr> F and degree of freedom = 0 in Type 3 Tests of Fixed Effects table output. 


Here's the code 


ods output LSMeans = means9;

proc mixed data = data method = ml covtest;
class Id TIME sport_level;
model dep = TIME sport_level  TIME*sport_level;
repeated / type=vc;
random intercept/sub=sport_level;
random intercept/sub=sport_level(TIME);
lsmeans TIME*sport_level;run;


proc sgplot data=means9;
series x=TIME y=Estimate / group= sport_level;
scatter x= TIME y=Estimate /group = sport_level
yerrorlower = Lower yerrorupper = Upper;


I am completely confused, and I really need your help. I  do not know where even the issue at least someone explains it to me!

Knowing that Time is a character variable (0 1 2 ) and sport_level is the character variable (0 1 2 3 4 5 6 7 until 40). In each sport_level there is time 0 1 2 


I think the issue is coming from lsmeans because when I delete it and type model dep = /; is gives the intercept values and residuals.

Jade | Level 19

The most likely reason for along these lines is inadequate sample size to estimate all of the variance components you are trying to fit. This is certainly possible if I correctly understand your design, You say there are 3 levels of time and 40 levels of sport_level. Your RANDOM statements are trying to fit 160 random intercepts, and the random effects and fixed effects are confounded completely. (a random effect for every level of sport_level and sport_level*time). Additionally, you are fitting some R side variance components. So, when you specify that the id's are the subject, you have adequate data to have things work out.


I would suspect that there are WARNINGs in the log as well, that relate to non-convergence or the hessian matrix being singular. 


One thing you might try is to remove sport_level and sport_level*time from the MODEL statement, so that you are modeling variance at three levels ( sport_level, time within sport_level and residual (id)).  This leaves time as the only fixed effect, and is very similar to your fully nested model (MODEL= /;). Note that lsmeans are not appropriate for that model statement. You can get the predicted BLUP estimates, however, using an OUTPUT statement, and then post process those values to get means and confidence intervals. Note that p values are not easily estimated for comparison of these values.





Fluorite | Level 6
Thank you so much for your reply and your explanation. I really helpful. Actually, it worked when I added the Degree of Freedom (Kenward-Roger method (DDFM=KR) or the Satterthwaite method (DDFM=SATTERTH).

But there are two more questions: the intercept estimate for sport_leve and sport_level(TIME) = 0 in the Covariance Parameter Estimates table; why are = 0? Does that mean there is something wrong, so the output is also incorrect?? Based on my knowledge, the intercept has no biological meaning, so it does not matter what the value is, but I am unsure.

Regarding your thought and answers, No, there are no warning messages.

--> One thing you might try is to remove sport_level and sport_level*time from the MODEL statement, so that you are modeling variance at three levels ( sport_level, time within sport_level and residual (id))

That's correct; it would work, but if I want to use the lsmeans statement, the variables must be in model statements.
Jade | Level 19

The estimates of the variance components for sport_level and time(sport_level) are zero because the fixed effects sport_level and sport_level*time completely describe the data. You would need non-identical observations for multiple subjects (=id) at each level of the sport_level*time to avoid this. The number of observations to get a meaningful estimate of each variance component is probably at least 8 to 10.  So, in YOUR analysis dataset, there is no additional variation due to these factors. The F tests and any comparison tests from the LSMEANS statement reflect this. They are not "wrong", except that you probably don't have enough data to estimate these random effects, and may wish to drop them entirely.


I look back at your analysis and your descriptions of what is going on, and would consider fitting a model with no RANDOM effects, and a REPEATED time/subject=id type=UN; statement.



Fluorite | Level 6
Thank you, STeveDenham. I was actually thinking about using sub= id at the beginning, but I was not sure; you confirmed it!!
Fluorite | Level 6
Hi again,

What do you think about using GLIMMIX procedure instead?




Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2 in conversation