**[MV] canon** -- Canonical correlations

__Syntax__

**canon** **(***varlist1***)** **(***varlist2***)** [*if*] [*in*] [*weight*] [**,** *options*]

*options* Description
-------------------------------------------------------------------------
Model
**lc(***#***)** calculate the linear combinations for canonical
correlation *#*
__fir__**st(***#***)** calculate the linear combinations for the first *#*
canonical correlations
__nocons__**tant** do not subtract means when calculating correlations

Reporting
__stdc__**oef** output matrices of standardized coefficients
__stde__**rr** display raw coefficients and conditionally estimated
standard errors
__l__**evel(***#***)** set confidence level; default is **level(95)**
**test(***numlist***)** display significance tests for the specified canonical
correlations
__notest__**s** do not display tests
__f__**ormat(***%fmt***)** numerical format for coefficient matrices; default is
**format(%8.4f)**
-------------------------------------------------------------------------
**by** and **statsby** are allowed; see prefix.
**aweight**s and **fweight**s are allowed; see weight.
See **[MV] canon postestimation** for features available after estimation.

__Menu__

**Statistics > Multivariate analysis >** **MANOVA, multivariate regression, and**
**related > Canonical correlations**

__Description__

**canon** estimates canonical correlations and provides the coefficients for
calculating the appropriate linear combinations corresponding to those
correlations.

**canon** typed without arguments redisplays previous estimation results.

__Options__

+-------+
----+ Model +------------------------------------------------------------

**lc(***#***)** specifies that linear combinations for canonical correlation *#* be
calculated. By default, all are calculated.

**first(***#***)** specifies that linear combinations for the first *#* canonical
correlations be calculated. By default, all are calculated.

**noconstant** specifies that means not be subtracted when calculating
correlations.

+-----------+
----+ Reporting +--------------------------------------------------------

**stdcoef** specifies that the first part of the output contain the standard
coefficients of the canonical correlations in matrix form. The
default is to present the raw coefficients of the canonical
correlations in matrix form.

**stderr** specifies that the first part of the output contains the raw
coefficients of the canonical correlations, the conditionally
estimated standard errors, and the conditionally estimated confidence
intervals in the standard estimation table. The default is to
present the raw coefficients of the canonical correlations in matrix
form.

**level(***#***)** specifies the confidence level, as a percentage, for confidence
intervals of the coefficients. The default is **level(95)** or as set by
**set level**. These "confidence intervals" are the result of an
approximate calculation; see the technical note in **[MV] canon**.

**test(***numlist***)** specifies that significance tests of the canonical
correlations in the *numlist* be displayed. Because of the nature of
significance testing, if there are three canonical correlations,
**test(1)** will test the significance of all three correlations, **test(2)**
will test the significance of canonical correlations 2 and 3, and
**test(3)** will test the significance of the third canonical correlation
alone.

**notests** specifies that significance tests of the canonical correlations
not be displayed.

**format(***%fmt***)** specifies the display format for numbers in coefficient
matrices. **format(%8.4f)** is the default. **format()** may not be
specified with **stderr**.

__Examples__

Setup
**. sysuse auto**

Estimate canonical correlations
**. canon (length weight headroom trunk) (displ mpg gear_ratio turn)**

Same as above, but display standardized coefficients
**. canon (length weight headroom trunk) (displ mpg gear_ratio turn),**
**stdcoef**

Display raw coefficients and conditional standard errors in the standard
estimation table
**. canon (length weight headroom trunk) (displ mpg gear_ratio turn),**
**stderr**

__Stored results__

**canon** stores the following in **e()**:

Scalars
**e(N)** number of observations
**e(df_r)** residual degrees of freedom
**e(df)** degrees of freedom
**e(df1)** numerator degrees of freedom for significance
tests
**e(df2)** denominator degrees of freedom for
significance tests
**e(n_lc)** the linear combination calculated
**e(n_cc)** number of canonical correlations calculated
**e(rank)** rank of **e(V)**

Macros
**e(cmd)** **canon**
**e(cmdline)** command as typed
**e(wtype)** weight type
**e(wexp)** weight expression
**e(properties)** **b V**
**e(estat_cmd)** program used to implement **estat**
**e(predict)** program used to implement **predict**
**e(marginsnotok)** predictions disallowed by **margins**

Matrices
**e(b)** coefficient vector
**e(stat_***#***)** statistics for canonical correlation *#*
**e(stat_m)** statistics for overall model
**e(canload11)** canonical loadings for *varlist_1*
**e(canload22)** canonical loadings for *varlist_2*
**e(canload12)** correlation between *varlist_1* and the
canonical variates from *varlist_2*
**e(canload21)** correlation between *varlist_2* and the
canonical variates from *varlist_1*
**e(rawcoef_var1)** raw coefficients for *varlist_1*
**e(rawcoef_var2)** raw coefficients for *varlist_2*
**e(stdcoef_var1)** standard coefficients for *varlist_1*
**e(stdcoef_var2)** standard coefficients for *varlist_2*
**e(ccorr)** canonical correlation coefficients
**e(ccorr_var1)** correlation matrix for *varlist_1*
**e(ccorr_var2)** correlation matrix for *varlist_2*
**e(ccorr_mixed)** correlation matrix between *varlist_1* and
*varlist_2*
**e(V)** variance-covariance matrix of the estimators

Functions
**e(sample)** marks estimation sample