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

Title

xtmixed_corr -- Model-implied intracluster correlations after xtmixed

Syntax

xtmixed_corr [, options]

options Description ------------------------------------------------------------------------- Main at(at_spec) specify level values; the default is the first level-two cluster all correlations for all the data list list model data corresponding to displayed correlations nosort list matrices in the row order as listed in the data format(format) specify display format matlist_options style options for displaying matrices; see [P] matlist -------------------------------------------------------------------------

Description

Linear mixed models as fit by xtmixed have 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; see xtmixed for details.

xtmixed_corr is 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 +-------------------------------------------------------------

at(at_spec), where at_spec is

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.

all specifies 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.

list lists 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 in xtmixed terminology) and you wish to see the represented values of these design variables.

nosort lists the rows and columns of the correlation matrix in the order that they were originally present in the data. Normally, xtmixed_corr will 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. nosort suppresses this.

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

matlist_options control how matrices are displayed. See [P] matlist for details.

Remarks

The 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_corr performs this calculation for the data subset that you specify and displays the resulting standard deviations and correlations based on V.

Examples

--------------------------------------------------------------------------- Setup . webuse pig, clear

Random-intercept model, analogous to xtreg . xtmixed weight week || id: . xtmixed_corr

Random-intercept and random-slope (coefficient) model . xtmixed weight week || id: week, cov(un) . xtmixed_corr, at(id = 33)

--------------------------------------------------------------------------- Setup . webuse productivity, clear

Three-level model, observations nested within state nested within region . 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, clear

Crossed 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 - 1980

Linear 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<=7

Linear mixed model with MA 2 errors . xtmixed follicles sin1 cos1 || mare: sin1, residuals(ma 2, t(time)) . xtmixed_corr, list

--------------------------------------------------------------------------- Setup . webuse childweight, clear

Linear 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_corr saves the following in r():

Matrices r(sd) standard deviations r(corr) correlation r(V) variance-covariance r(psi) variance-covariance of random effects r(Z) model-based design matrix r(R) variance-covariance matrix of level-one errors

Also see

Help: [XT] xtmixed; [XT] xtmixed postestimation