## Covariance parameter estimates for 3 level growth model using MIANALYZE

Solved
Occasional Contributor
Posts: 5

# Covariance parameter estimates for 3 level growth model using MIANALYZE

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;

Accepted Solutions
Solution
‎11-05-2016 08:00 PM
Occasional Contributor
Posts: 5

## Re: Covariance parameter estimates for 3 level growth model using MIANALYZE

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;

All Replies
Super User
Posts: 20,714

## Re: Covariance parameter estimates for 3 level growth model using MIANALYZE

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?

Solution
‎11-05-2016 08:00 PM
Occasional Contributor
Posts: 5

## Re: Covariance parameter estimates for 3 level growth model using MIANALYZE

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;

☑ This topic is solved.