1. Home
2. DCORRELATION procedure

DCORRELATION procedure

Plots a correlation matrix (A.I. Glaser).

Options

`PLOT` = string tokens Type of plot (`together`, `separate`); default `sepa` What features to include on the plots (`axes`, `diagonal`); default `axes` Number of distinct colour to use from 0 to -1 or 1; default 20 Text or variate with three values, defining the colours to use for correlations of -1, 0 and 1; default `*` chooses the colours automatically Provides weights for the units of the variates; default `*` assumes that they all have weight one

Parameters

`PVARIATES` = pointers or symmetric matrices Pointer to either the first (P-) set or the only set of variates to be correlated, or symmetric matrix containing the correlations themselves Pointer to the second (Q-) set of variates to be correlated Specifies the number of rows corresponding the first (P-) set of variates in a correlation matrix supplied by `PVARIATES`, when this contains two sets Title for the plot

Description

`DCORRELATION` provides a graphical representation of a correlation matrix, which can show the correlation within a dataset, as well as the correlation within and between two different datasets. Each element of the correlation matrix is represented by a shaded rectangle indicating the value at that location, using a different colour or shading density. This type of display is often used before a canonical correlation analysis to see if there are any significant correlations within and between the datasets to be analysed; see the `CANCORRELATION` procedure for details.

The `PVARIATES` parameter can supply a symmetric matrix containing correlations that have already been calculated (e.g. using the `FCORRELATION` procedure). If the matrix involves two sets of variates (as in a canonical correlation analysis), you should arrange for them to be specified in set order i.e. all the first set, and then all the second set. You should then specify the number of variates in the first set using the `PROWS` parameter.

Alternatively, you can set `PVARIATES` to a pointer containing the variates themselves. You can then use the `QVARIATES` parameter to supply a pointer with a second set of variates.

The `WEIGHTS` option can provide a variate of weights for the units of the variates; by default these are all assumed to have weight one.

The `PLOT` option selects the type of plot, with settings:

    `together` to plot the correlation matrix as one symmetric matrix, with a dashed black line to show the boundaries between two datasets (if supplied), and to plot the correlation matrix in three separate components with the within dataset correlations at the top of the window, and the between-dataset correlations underneath. When there are more variates in the second (Q-) set than the first (P-) set, the separate plot will display the transpose of the between-dataset correlations.

The default is `PLOT=separate`, unless there is only one set of variates when it defaults to ‘together’.

The `SHOW` option controls whether some features are included on the plots:

    `axes` includes axes, and includes the diagonal of the correlation matrix.

The default is `SHOW=axes`.

There is also a key containing a strip of colours showing how the colours in the plot represent the different correlations. The `NCOLOURS` option specifies the number of distinct colours to use as the correlations decrease from 0 to -1 or increase from 0 to 1. This can vary from 2 upwards, with a default of 20. The `COLOURS` option allows you to control the range of colours that are used. It should be set to a text or variate with three values: the first value defines the colour to use for correlations of -1, the second value gives the colour for correlations of 0, and the third gives the colour for correlations of 1. (See `PEN` for details of how colours are defined.) The default colours, if `COLOURS` is unset, range from dark blue for values close to -1 to dark red for values close to 1.

The `TITLE` parameter supplies a main title for each plot.

Options: `PLOT`, `SHOW`, `NCOLOURS`, `COLOURS`, `WEIGHTS`.

Parameters: `PVARIATES`, `QVARIATES`, `PROWS`, `TITLE`.

Method

The plots in `DCORRELATION` are produced using `DBITMAP`.

Directive: `CORRELATE`.

Procedures: `FCORRELATION`, `PARTIALCORRELATIONS`, `PRCORRELATION`.

Commands for: Graphics, Multivariate and cluster analysis.

Example

```CAPTION  'DCORRELATION example',\
'Data from Table 3.7 of Digby & Kempton (1987).';\
STYLE=meta,plain
TEXT     [VALUES='1d','3a','3d','4a','4d','7a','7d','8a','8d','9a','9d',\
'10a','10d','11/1a','11/1d','11/2a','11/2d','14a','14d','16a','16d',\
'17a','17d','18d'] Plot
POINTER  [VALUES=N,Nstar,P,K,Lime] Treats
&        [VALUES=Axis_1,Axis_2,Axis_3,Axis_4] Species
VARIATE  [NVALUES=Plot] Treats[],Species[]
1 0 0 0 0  0 0 0 0 1  0 0 0 0 0  2 0 1 0 1  2 0 1 0 0  0 0 1 1 1
0 0 1 1 0  0 0 1 0 1  0 0 1 0 0  2 0 1 1 1  2 0 1 1 0  2 0 1 0 1
2 0 1 0 0  3 0 1 1 1  3 0 1 1 0  3 0 1 1 1  3 0 1 1 0  0 2 1 1 1
0 2 1 1 0  0 1 1 1 1  0 1 1 1 0  0 1 0 0 1  0 1 0 0 0  2 0 0 1 0  :
354  177 -173   85   211 -406    2 -170   299 -294  -11  -46
191   11  246  209   331  226 -262   28  -333 -145 -212   36
200 -149  -11   -6   136 -347   -7 -100   162 -302   29 -194
-416   59  -27   19   281  257 -130 -154     9  -28  166  182
333  228 -251   33  -386  111   86  -92    52  242   52 -349
-387   98   42  -50    36  252   72 -346  -391 -127 -170  196
-419   30 -137  118  -333 -143 -171  149  -254  -89 -121   12
102 -388   11 -140   135 -260  -68  -60   331  238 -245   38  :
CALCULATE      Species[] = Species[] / 100
DCORRELATION   [PLOT=separate, together] PVARIATES=Treats; QVARIATES=Species
PRINT          Plot,Treats[],Species[]; FIELDWIDTH=7; DECIMALS=(0)6,(2)4
MATRIX         [ROWS=Plot; COLUMNS=4] Specs_Sc,Treat_Sc
CANCORRELATION [PRINT=correlations,pcoeff,qcoeff,pscores,qscores]\
Treats; Species; PSCORES=Treat_Sc; QSCORES=Specs_Sc
PRINT          Specs_Sc
```
Updated on June 20, 2019