BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cpolihronis
Fluorite | Level 6

Hi there, 

I am using SAS 9.4 and I was wondering how to get separate covariance estimates for a three level growth model using MIANALYZE. I would like to get these estimates to calcluate the ICC.

In step 2, I don't think I am properly separating the estimates for level 3. I believe I am just getting the estimates for the residual and for level 2.

I think it might be an issue with the output statement, or in step 2 with trying to separate the level 2 and level 3 estimates. Any help with my code is appreciated 🙂

 

*conduct means model to get estimates;

ODS _ALL_ CLOSE;
proc mixed data=person method = ml covtest;
class ID school;
model RV = / solution ddfm=bw covb;
random intercept /sub=id type=un;
random intercept /sub=id(school) type=un;
ods output SolutionF=cparms CovB=ccovb fitstatistics=fitstats;
ods output covparms=cvparmsm;
by _imputation_;
ODS LISTING;

 

*Get the combined fixed parameter estimates of the RV mean;
proc mianalyze parms=cparms covb(effectvar=rowcol)=ccovb;
modeleffects intercept;
run;

 

*Print covariance estimate dataset for children and schools;
proc print data = cvparmsm (obs = 30);
run;

 

*Step 1: This doesnt seem to work. I would like to separate the residual, level 2 (child) and level 3 (school) estimates;
data cvparmsm;
set cvparmsm;
covparm2=covparm||id;
covparm3=covparm||id(school);
run;

 

*Step 2: sort covariance parameters dataset;
proc sort data= cvparmsm;
by covparm; run;

 

*Step 3: Obtain the combined covariance parameters separately for level 2(child)? ;
proc mianalyze data = cvparmsm;
by covparm2;
modeleffects estimate;
stderr stderr;
run;

 

*Step 4: Obtain the combined covariance parameters separately for level 3(school)? I seem to get the same estimate as Step 3.;

proc mianalyze data = cvparmsm;
by covparm3;
modeleffects estimate;
stderr stderr;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
cpolihronis
Fluorite | Level 6

Thanks for your help! I believe I needed to combine the covparm and subject into one variable!

 

*Step 1: Combine covparm and subject in one variable;
data cvparmsm1;
set cvparmsm;
covparm2=covparm||subject;
run;

 

*Sort by covariance parameter estimate;

proc sort data= cvparmsm1;
by covparm2; run;

 

*Step 3: Obtain the combined covariance parameters separately for the residual, nested level 2 and level 3;
proc mianalyze data = cvparmsm1;
by covparm2;
modeleffects estimate;
stderr stderr;
run;

 

View solution in original post

2 REPLIES 2
Reeza
Super User

I don't know if your Step 1 is calculating covparm3 correctly. Did the log show any errors?

 

I wouldn't expect id(school) to generate correct results. 

Should it be id||school?

cpolihronis
Fluorite | Level 6

Thanks for your help! I believe I needed to combine the covparm and subject into one variable!

 

*Step 1: Combine covparm and subject in one variable;
data cvparmsm1;
set cvparmsm;
covparm2=covparm||subject;
run;

 

*Sort by covariance parameter estimate;

proc sort data= cvparmsm1;
by covparm2; run;

 

*Step 3: Obtain the combined covariance parameters separately for the residual, nested level 2 and level 3;
proc mianalyze data = cvparmsm1;
by covparm2;
modeleffects estimate;
stderr stderr;
run;

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 2 replies
  • 1268 views
  • 0 likes
  • 2 in conversation