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;
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.
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.
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.
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.