Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- MIXED Multilevel Cross-Level Correlation

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-05-2018 08:55 PM

Hi All,

I've got multi-level data (students nested within teachers), and i have some construct scale scores at the student level (level-1) and teacher level (level-2). For reporting purposes, i have to provide correlations among these scale scores, and i'm wondering how to go about this. I can aggregate the student data (i.e., mean scores) and generate correlations, or i can use the full dataset, where the teacher scores will be replicated c times, where c = the number of students taught by a teacher.

I came across a PDF on the HLM software website that discusses cross-level correlation calculation, but i don't find it to be particularly clear: http://www.ssicentral.com/hlm/help7/howto/How_to_Calculate_cross-level_correlations.pdf

Does anyone here have any advice, or experience with calculating these correlations as in the hyperlink above?

Thanks in advance,

Jason

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to jsberger

02-07-2018 08:46 AM

Hi All,

So here's what i have developed thus far in response to my question below, using the sample file created using:

data _null_;

set sample;

file "C:\Users\Jason\Desktop\sample.txt";

put teacherid student_id schoolid post_classman_ability post_pck_ability;

file print;

put teacherid student_id schoolid post_classman_ability post_pck_ability;

run;

If i correlate two variables using all available data (including duplicate level-2 values), i get a correlation of -.12783.

**correlation between two retaining all data;

proc corr data=sample;

var post_classman_ability post_pck_ability;

run;

If i use a mixed model with the student-level variable as the DV and the teacher as the IV, obtaining the var-covariance matrix of fixed effects (which includes an intercept and the post_pck_ability predictor fixed effects), i can then use that covariance matrix to calculate the cross-level correlation as specified in the link in the original post.

**model with student-level measure as dv and teacher-level measure as iv;

proc mixed data=tssc_y1 method=ml;

class schoolid;

model post_classman_ability = post_pck_ability/ solution corrb covb;

random intercept/ subject=teacherid type=un;

ods output covb=covb;

run;

The IML syntax below attempts to calculate the cross-level correlation, obtaining a value of -.057711. I'm glad to see the sign in the same direction, but i'm wondering if the decrease from -.12 down to .-05 seems reasonable, of if i'm missing something.

**correlation from covariance;

proc iml;

use covb;

read all var {Col1 Col2} into cov_mat[colname=varNames];

print cov_mat;

start Cov2Corr(S);

**grab the variances of each variable;

var_mat=(vecdiag(S))`;

*print var_mat;

**caculate sd by taking square root of product;

prod_sd=sqrt(var_mat[1,1]#var_mat[1,2]);

*print prod_sd;

**divide each element of covariance matrix by the prod_sd, focus on covariance cells;

r_mat=S/prod_sd;

r=r_mat[1,ncol(r_mat)];

return R;

finish;

r=Cov2Corr(cov_mat);

n=861;

t=sqrt(n-2)*sqrt((r*r)/(1-r*r));

p_onetail=1-probt(t,n-2);

p_twotail=(1-probt(abs(t),n-2))*2;

print r p_onetail p_twotail;

quit;