# Canonical Correlation

## Technote (troubleshooting)

## Problem(Abstract)

Older versions of SPSS had a procedure named CANCORR for canonical correlation analysis. I don't see such a procedure in the menus in my current version of SPSS. How do I do canonical correlation analysis in current releases of SPSS?

## Resolving the problem

There are several ways to run canonical correlation analysis in SPSS Statistics. An extension, STATS CANCORR, is available from the SPSS Community website at http://www.ibm.com/developerworks/spssdevcentral. This requires the Python Essentials, also available at the same site, or in recent versions in your installation materials. Beginning with Version 22, the Python Essentials are part of the default installation of the program, and you can download and install the STATS CANCORR extension via the menus: Utilities>Extension Bundles>Download and Install Extension Bundles. Once this is installed, you'll have a menu option under Analyze>Correlations to run canonical correlation analysis via a dialog box interface.

All versions of SPSS Statistics includes a command syntax file bundled with your product. The macro is named Canonical correlation.sps.

To run the canonical correlation macro, open a new syntax window, and execute the following form of command syntax:

INCLUDE 'Canonical correlation.sps'.

CANCORR SET1 = varlist1 / SET2 = varlist2 .

where varlist1 and varlist2 are your two sets of variables. You may need to specify the entire path name for the file, such as 'C:\Program Files\IBM\SPSS\Statistics\Samples\English\Canonical correlation.sps'.

Note that the data for the macro or the extension must be "raw" data, or cases (rows) by variables (columns). The macro does not handle a correlation matrix as input. If you have a correlation matrix to use as input, you must use the MANOVA procedure, which will require a vector of means, a vector of standard deviations, and a vector of Ns (which must all have the same value).

The MANOVA procedure performs canonical correlation analysis via the DISCRIM subcommand if you have only dependent variables and covariates. To get the information you would normally get with a canonical correlation analysis, you would also want to ask for EIGEN and DIM on the PRINT SIGNIF subcommand. So something similar to the following would be specified:

MANOVA y1 y2 y3 WITH x1 x2 x3

/DISCRIM ALL ALPHA(1)

/PRINT=SIG(EIGEN DIM)

The ALL and ALPHA(1) tell MANOVA that you want to look at all the output and that you want to see all functions regardless of significance level.

You can adjust these according to your desires. About the only differences between MANOVA and the CANCORR macro are that MANOVA produces extraneous output and will not save canonical scores. The macro produces only output specific to this task and will save canonical scores.

A full demonstration of the use of MANOVA to produce canonical correlations is provided in the following technical note.

Technote 1479194 : Canonical Correlation with matrix input

http://www-01.ibm.com/support/docview.wss?uid=swg21479194

If you compare the results of these canonical correlation procedures, you may note that the canonical function coefficients for a pair of canonical functions (i.e. for the set 1 variables and the set 2 variables) have opposite signs across 2 of the procedures. As demonstrated in the technical note which is linked below, the reversal of signs in the functions produced by MANOVA /DISCRIMINANT and the Python extension command STATS CANCORR, for example, are of no consequence (although we would expect the magnitude to be the same across procedures and for either all of the signs or none of the signs to be reversed for a given function).

As expected, iff the coefficients for one canonical variable in the pair are of opposite sign for MANOVA vs STATS CANCORR, then the coefficients for the other canonical variable in the pair are also of opposite sign across procedures.

Technote 1479953 : Canonical Correlations canonical covariates have signs reversed

http://www-01.ibm.com/support/docview.wss?uid=swg21479953

This technical note states:

"The Canonical Correlation macro ultimately computes a Singular Value Decomposition (SVD) of the

covariance matrix to obtain the canonical correlations and associated canonical covariates. The SVD is not unique, and for each singular value it is possible to multiply each of the associated vectors by -1 to obtain another equally valid SVD. This arbitrary choice of sign is reflected in the reversed signs you have observed in Canonical Correlations output. However, the disagreement does not in any way change any correctly drawn conclusions."

The technical note includes a matrix exercise to demonstrate the argument.

## Related information

Need more help? Our Statistics forum is Live!

## Historical Number

12720

### Document information

**More support for:**
SPSS Statistics

**Software version:**
Not Applicable

**Operating system(s):**
Platform Independent

**Reference #:**
1476005

**Modified date:**
07 September 2016