help xtmixed_corr-------------------------------------------------------------------------------

Title

xtmixed_corr-- Model-implied intracluster correlations afterxtmixed

Syntax

xtmixed_corr[,options]

optionsDescription ------------------------------------------------------------------------- Mainat(at_spec)specify level values; the default is the first level-two clusterallcorrelations for all the datalistlist model data corresponding to displayed correlationsnosortlist matrices in the row order as listed in the dataformat(format)specify display formatmatlist_optionsstyle options for displaying matrices; see[P]matlist-------------------------------------------------------------------------

DescriptionLinear mixed models as fit by

xtmixedhave complex expressions for intracluster correlation. Correlation comes from two sources: (1) the design of the random effects and their assumed covariance from the multiple levels in your model; and (2) the correlation structure of the residuals, whether they be treated as independent, auto-regressive, Toeplitz, etc. Residuals may also be modeled as heteroskedastic; seextmixedfor details.

xtmixed_corris designed to combine all sources of correlation into one overall correlation matrix for a given cluster (or for a given group of clusters, if you wish). This allows you to compare different multilevel models in terms of the ultimate intracluster correlation matrix that each model implies.

Options+------+ ----+ Main +-------------------------------------------------------------

level_var=value[level_var=value...]specifies the cluster of observations for which you want the intracluster correlation matrix.

For example, if you specify

. xtmixed_corr, at(school = 33)you get the intracluster correlation matrix for those observations in school 33. If you specify,

. xtmixed_corr, at(school = 33 classroom = 4)you get the correlation matrix for classroom 4 in school 33.

If

at()is not specified, then you get the correlations for the first level-two cluster encountered in the data. This is usually what you want.

allspecifies that you want the correlation matrix for all the data. This is not recommended unless you have a relatively small dataset or you enjoy seeing large N x N matrices. However, this can prove useful in some cases.

listlists the model data for those observations depicted in the displayed correlation matrix. This option is useful if you have many random-effects design variables (Z's inxtmixedterminology) and you wish to see the represented values of these design variables.

nosortlists the rows and columns of the correlation matrix in the order that they were originally present in the data. Normally,xtmixed_corrwill first sort the data according to level variables, by-group variables, and time variables in order to produce correlation matrices whose rows and columns follow a natural ordering.nosortsuppresses this.

format(format)sets the display format for the standard-deviation vector and correlation matrix. The default is%6.3f.

matlist_optionscontrol how matrices are displayed. See[P] matlistfor details.

RemarksThe intracluster variance-covariance matrix is given by V = Z*Psi*Z' + R, where Z is the design matrix for the random effects, Psi is the variance-covariance matrix of the random effects, and R is the residual variance-covariance matrix.

xtmixed_corrperforms this calculation for the data subset that you specify and displays the resulting standard deviations and correlations based on V.

Examples--------------------------------------------------------------------------- Setup

. webuse pig, clearRandom-intercept model, analogous to

xtreg. xtmixed weight week || id:. xtmixed_corrRandom-intercept and random-slope (coefficient) model

. xtmixed weight week || id: week, cov(un). xtmixed_corr, at(id = 33)--------------------------------------------------------------------------- Setup

. webuse productivity, clearThree-level model, observations nested within

statenested withinregion. xtmixed gsp private emp hwy water other unemp || region: ||state:. xtmixed_corr, at(region = 2 state = 28). xtmixed_corr, at(region = 2) format(%5.2f)--------------------------------------------------------------------------- Setup

. webuse pig, clearCrossed random effects

. xtmixed weight week || _all: R.week || id:. xtmixed_corr--------------------------------------------------------------------------- Setup

. use http://www.stata-press.com/data/mlmus2/wagepan, clear. gen educt = educ - 12. gen yeart = year - 1980Linear mixed model with AR 1 errors

. xtmixed lwage black hisp union yeart educt || nr:, nocons res(ar 1,t(yeart)). xtmixed_corr--------------------------------------------------------------------------- Setup

. webuse ovary, clear. keep if time<=7Linear mixed model with MA 2 errors

. xtmixed follicles sin1 cos1 || mare: sin1, residuals(ma 2, t(time)). xtmixed_corr, list--------------------------------------------------------------------------- Setup

. webuse childweight, clearLinear mixed model with heteroskedastic error variances

. xtmixed weight age || id:age, cov(un) residuals(independent,by(girl)). xtmixed_corr, list. xtmixed_corr, at(id=4108) list---------------------------------------------------------------------------

Saved results

xtmixed_corrsaves the following inr():Matrices

r(sd)standard deviationsr(corr)correlationr(V)variance-covariancer(psi)variance-covariance of random effectsr(Z)model-based design matrixr(R)variance-covariance matrix of level-one errors

Also seeHelp:

[XT] xtmixed;[XT] xtmixed postestimation