**[ME] estat wcorrelation** -- Display within-cluster correlations and standard
deviations

__Syntax__

**estat** __wcor__**relation** [**,** *options*]

*options* Description
-------------------------------------------------------------------------
**at(***at_spec***)** specify the cluster for which you want the
correlation matrix; default is the first two-level
cluster encountered in the data
**all** display correlation matrix for all the data
__cov__**ariance** display the covariance matrix instead of the
correlation matrix
**list** list the data corresponding to the correlation matrix
**nosort** list the rows and columns of the correlation matrix
in the order they were originally present in the
data
__iter__**ate(***#***)** maximum number of iterations to compute random
effects; default is **iterate(50)**; only for use after
**menl**
__tol__**erance(***#***)** convergence tolerance when computing random effects;
default is **tolerance(1e-4)**; only for use after **menl**
**format(***%fmt***)** set the display format; default is **format(%6.3f)**
*matlist_options* style and formatting options that control how
matrices are displayed
-------------------------------------------------------------------------

__Menu for estat__

**Statistics > Postestimation**

__Description__

**estat wcorrelation** is for use after estimation with **menl** and **mixed**.

**estat wcorrelation** displays the overall correlation matrix for a given
cluster calculated on the basis of the design of the random effects and
their assumed covariance and the correlation structure of the residuals.
This allows for a comparison of different multilevel models in terms of
the ultimate within-cluster correlation matrix that each model implies.

__Options__

**at(***at_spec***)** specifies the cluster of observations for which you want the
within-cluster correlation matrix. *at_spec* is

*relevel_var* **=** *value* [*relevel_var* **=** *value* ...]

For example, if you specify

**. estat wcorrelation, at(school = 33)**

you get the within-cluster correlation matrix for those observations
in school 33. If you specify

**. estat wcorrelation, 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.

**covariance** specifies that the within-cluster covariance matrix be
displayed instead of the default correlations and standard
deviations.

**list** lists the model data for those observations depicted in the
displayed correlation matrix. With linear mixed-effects models, this
option is also useful if you have many random-effects design
variables 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, **estat**
**wcorrelation** will first sort the data according to level variables,
by-group variables, and time variables to produce correlation
matrices whose rows and columns follow a natural ordering. **nosort**
suppresses this.

**iterate(***#***)** specifies the maximum number of iterations when computing
estimates of the random effects. The default is **iterate(50)**. This
option is only for use after **menl**.

**tolerance(***#***)** specifies a convergence tolerance when computing estimates
of the random effects. The default is **tolerance(1e-4)**. This option
is only for use after **menl**.

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

*matlist_options* are style and formatting options that control how the
matrix (or matrices) is displayed; see **[P] matlist** for a list of
options that are available.

__Examples__

---------------------------------------------------------------------------
Setup
**. webuse pig**
**. mixed weight week || id: week, covariance(unstructured)**

Random-effects correlation matrix for level ID
**. estat recovariance, correlation**

Display within-cluster marginal standard deviations and correlations for
a cluster
**. estat wcorrelation, format(%4.2g)**

---------------------------------------------------------------------------
Setup
**. webuse childweight**
**. mixed weight age || id: age, covariance(unstructured)**

Display within-cluster correlations for the first cluster
**. estat wcorrelation, list**

Display within-cluster correlations for ID 258
**. estat wcorrelation, at(id=258) list**

---------------------------------------------------------------------------

__Stored results__

**estat wcorrelation** stores the following in **r()**:

Matrices
**r(sd)** standard deviations
**r(Corr)** within-cluster correlation matrix
**r(Cov)** within-cluster variance-covariance matrix
**r(G)** variance-covariance matrix of random effects
**r(Z)** model-based design matrix
**r(R)** variance-covariance matrix of level-one errors

Results **r(G)**, **r(Z)**, and **r(R)** are available only after **mixed**.