Copyright: Version 1.03
Citation: University Rovira i Virgili (Tarragona


Index of help
CAR

CAR: Correspondence Analysis with Rotations

Description

Executing CAR with the user friendly interface

Executing CAR with the Matlab command line

Input

Output

Example data

Bibliography


Description of CAR
DESCRIPTION

CAR is an application for computing correspondence analysis that allows orthogonal and oblique rotations.

Two important features of CAR are:

(1) non-Matlab-users should be able to manage it.

(2) advanced users should find it useful. So the analysis should also be easily computed from Matlab command line.

1. Concepts in correspondence analysis (CA)

Let F be an n  p contingency table divided by the total number of observations, 1i an i  1 vector of ones, r = F1p, c = F'1n and Dr and  Dc are diagonal matrices with the elements of r and c on the diagonal, respectively. By assigning weights to the rows and the columns of a matrix of deviations from independence, we obtain the following matrix of standardized residuals,

.	(1)
The aim in correspondence analysis is to find k dimensional coordinate matrices X and Y, for row and column points, respectively, in such a way that the loss function

	(2)
is minimized subject to X'DrX = I and Y'DcY = I, where ||H||2 denotes the sum of squared elements of H. Let

	(3)
be the singular value decomposition of matrix [image], where [image] is a diagonal matrix with singular values on the diagonal, in weakly descending order, and K'K = V'V = I. As Van de Velden and Kiers (2005) pointed out, (X, Y) is minimized by

	(4)
and

,	(5)
where Kk and Vk are, respectively, the n  k and p  k matrices of singular vectors corresponding to the k largest singular values gathered in the k  k diagonal matrix k. Finally,  is the parameter that determines the type of coordinates in X and Y. Three choices are usually considered for :

(a)  = 0: The column coordinates Y are referred to as principal coordinates and the row coordinates X as standard coordinates.

(b)  = 1: The column coordinates Y are referred to as standard coordinates and the row coordinates X as principal coordinates.

(c)  = .5: Both column and row coordinates are referred to as symmetrical coordinates.

An important feature of X and Y is that for any choice of , the matrix product [image] optimally approximates [image], in the sense that the sum of squared differences between [image] and [image] is as small as possible. Hence, these solutions can be interpreted as so-called biplots.

The distinction between principal, standard and symmetrical coordinates is fundamental in CA:

(a) Principal coordinates are the coordinates of the set of (column or row) variables that are studied. If  = 0, these coordinates are related to column variables, and if  = 1, to row variables.

(b) Standard coordinates are the coordinates of the set of (column or row) variables that help to describe the set of variables studied. If  = 0, these coordinates are related to row variables; and, if  = 1, to column variables.

(c) When symmetrical coordinates are chosen, both column and row coordinates are described.

2. Model definition and rotations implemented in CAR

The following models are allowed in CAR:

1. Symmetrical coordinates for rows and columns (Biplot model)

The rotations allowed in this situation are:

•	Varimax orthogonal rotation of symmetrical coordinates, where both (rows and columns) are simultaneously rotated to maximize simplicity.

•	Quartimin oblique rotation of symmetrical coordinates, where both (rows and columns) are simultaneously rotated to maximize simplicity.

2. Principal coordinates for rows, and standard coordinates for columns

The rotations allowed in this situation are:

•	Varimax orthogonal rotation of principal coordinates, and standard coordinates are consequently rotated.

•	Varimax orthogonal rotation of standard coordinates, and principal coordinates are consequently rotated.

•	Quartimin oblique rotation of principal coordinates, and standard coordinates are consequently rotated.

3. Principal coordinates for columns, and standard coordinates for rows

The rotations allowed in this situation are:

•	Varimax orthogonal rotation of principal coordinates, and standard coordinates are consequently rotated.

•	Varimax orthogonal rotation of standard coordinates, and principal coordinates are consequently rotated.

•	Quartimin oblique rotation of principal coordinates, and standard coordinates are consequently rotated.

4. Principal coordinates for rows and columns (French symmetrical model)

No research has been done on the rotation of axes in this model, so rotations are not allowed with this model.

3. Weighting schemes in the rotation

In the context of Exploratory Factor Analysis, loading matrices are frequently weighted before rotations are computed. After rotation, the original distances of points from the origin are reestablished, so the interpretation is not affected by the weights applied.

In the context of CA, other weighting schemes may also be applicable. Let Wx and Wy be diagonal matrices, with weights on the diagonal and zeros elsewhere. Wx and Wy are weighting matrices related to the coordinate matrices X and Y, respectively. The aim is to weight the rows of X and Y during the rotation, so that the products WxX and WyY are rotated (instead of X and Y). Three options for Wx and Wy can be considered:

(a)	Each weighting matrix is defined as an identity matrix. With this option, no weight is actually applied.

(b)	Due to the specific weighting in correspondence analysis, infrequently observed points are sometimes positioned relatively far away from the origin. In this situation, these particular points may play an important role in determining the rotation angle. To prevent this from happening, the coordinates can be rescaled using the corresponding masses (i.e.  and [image]). This weighting procedure places infrequent points close to the origin, while others remain a long way from it.

(c)	 In the context of Exploratory Factor Analysis, it is common practice to carry out a row-wise normalization of the matrix to be rotated. In CA, this procedure involves rescaling the coordinates using [image] and [image]. With this scheme, all the rows have the same influence on the final position of the axes.


EXECUTING CAR USING THE USER FRIENDLY INTERFACE

From Matlab, just execute the command:

>> car

The main CAR window will appear.

To compute Correspondence analysis, you must carry out the following eight steps:

1 Load data

All the variables in the Matlab work space will be shown in the variables window. If the variables are structures, the fields of the structure will be shown. In the following example,

a variable (N), and a structure (labels) with two fields (rows and columns) are already available. Any of these variables can be used in the computation. If variables are not available, you can load any .mat file from disc using the Open option in the File menu.

If you are not a usual Matlab user, you may want to load data files from ASCII files without using the typical Matlab command lines (or any Matlab data file). In this case, you can use the option Import files from text files, in the File menu. The following menu will help you to load files from text files.

For a further explanation on input data, see the Input data section of this help.

2 Compute cross tabulation matrix

If your variables contain raw data (i.e. the cross tabulation matrix is not available yet), you must select the variables that contain (1) the variable to be considered as rows in the cross tabulation matrix, and (2) the variable to be considered as columns in the cross tabulation matrix. It must be noted that both variables must be numerical. However, if one of your matrices is already the cross tabulation matrix, you can tell CAR that this matrix is already available (and which variable contains the cross tabulation matrix).

3 Define labels

If some of your variables contain variables for rows and columns in the cross tabulation table, you can state what these variables are in this box:

It should be noted that these variables must be 'text variables'. If labels are not defined (and raw variables are available), CAR will automatically generate labels for the actual values in the raw variables.

4 Define supplementary rows or columns of the cross tabulation matrix

You can indicate which rows or columns of the cross tabulation matrix are to be considered as supplementary points in the analysis. You must enter the index of the row (or the column) in the cross tabulation matrix. You can define more that one row (or column) as supplementary points: in this case, indices must be separated by a space.

5 Specify the axes  model

The number of dimensions to be retained, and the kind of axes must be specified in this box:

For a further explanation of model specifications, see the Description section of this help.

6 Specify the rotation of axes

If you want a rotation to be computed, you must decide which weights scheme,

and which rotation technique

must be used. The rotation techniques available depend on the kind of axes defined in the model.

For a further explanation of rotation techniques, see the Description section of this help.

7 Configure the output options

You can define (1) if the MAP is to be generated, (2) the level of detail in the output, and (3) the name of the text file where the output is stored.

8 Start the computing

Once the analysis has been configured, correspondence analysis can be computed using the Compute button:

Further details related to the output

If you need to use the matrices obtained during the computing for further analysis, they can be recovered from the matlab command line. You can use these commands:

>> output = getappdata(0,'output');

>> rotation = getappdata(0,'rotation');

Now, output and rotation are structures that contain all the matrices obtained by CAR during the computing.


Matlab command line orders related to CAR
EXECUTING CAR USING THE MATLAB COMMAND LINE

Alternatively, you may prefer to use command lines to compute correspondence analysis. So you can load your own data and use the following commands:

>> addpath lib;

>> output = canalysis(N, k, labels_x,labels_y);

>> rotation = ComputeRotation(output, k, coordinates, method, weights);

>> PrintDescriptives(output,detailed);

>> PrintCoordinates(output,k,coordinates,detailed);

>> PrintRotation(rotation,method, weights, output.labels, detailed);

>> map(1,2,0);

where

(1) 'N' is a contingence table,

(2) 'k' is the number of dimensions to be retained.

(3) 'labels_x' and 'labels_y' store the corresponding labels,

(4) 'coordinates' is the coordinates used in the model. The admissible values are:

	1	Symmetrical coordinates (biplot model)
	2	Row principal coordinates, and column standard coordinates
	3	Column principal coordinates, and row standard coordinates
	4	Row and column principal coordinates (French symmetrical model)

(5) 'method' is the rotation method to be computed. The admissible values are:

	1	Orthogonal rotation of symmetrical coordinates
	2	Oblique rotation of symmetrical coordinates
	3	Orthogonal rotation of principal coordinates
	4	Orthogonal rotation of standard coordinates
	5	Oblique rotation of principal coordinates

(6) 'weights' is the weight scheme to be used in the rotation. The admissible values are:

	1	Row-wise normalization of coordinates
	2	Rescaling coordinates using masses
	3	None. No weights scheme is used.

(7) 'detailed' controls the level of detail of the report. The admissible values are:

	1	Prints all the details
	0	Prints the basic information

If you want to include some supplementary rows or columns, then you should replace this line:

>> output = canalysis(N, k, labels_x, labels_y);

for this one:

>> output = canalysis(N,k, labels_x,labels_y, Sup, labels_sup);

where

(8) 'Sup' is a structure that contains matrices 'r' and/or 'c' that are the contingence tables which contain the supplementary rows and columns.

(9) 'labels' is a structure that stores the labels for the supplementary rows and columns in strings 'r' and 'c' (for rows and columns, respectively).

Finally, function 'canalysis' can be also executed as,

>> output = canalysis(N);

In this case, the number of dimensions to retain is set to 2, and default labels for rows and columns are used.


INPUT DATA

The analysis can be computed from raw data, or from contingence tables. Labels for rows and/or columns are allowed. Also some rows and columns in the correspondence analysis can be considered as supplementary rows and/or columns.

You can use the data stored in the Matlab memory workspace, or data from MAT files from the application. You can also load matrices stored in text files (ASCII) using the application.

One example of the matrices you can define is the following:

N=[

    3  19  39  14  10  0

    1   2  13   1  12  1

    6  25  49  21  29  0

    3  15  41  35  26  0

    10 22  47   9  26  1

    3  11  25  15  34  1

    1   6  14   5  11  1

    0  12  34  17  23  1

    2   5  11   4   7  0

    2  11  37   8  20  1

];

labels.rows={'Geology' 'Biochemistry' 'Chemistry' 'Zoology' 'Physics' 'Engineering' 'Microbiology' 'Botany' 'Statistics' 'Mathematics'};

labels.columns={'A' 'B' 'C' 'D' 'E' 'Y'};

However, other formats are allowed. For example:

lab_rows={'Geology' 'Biochemistry' 'Chemistry' 'Zoology' 'Physics' 'Engineering' 'Microbiology' 'Botany' 'Statistics' 'Mathematics'};

lab_columns={'A' 'B' 'C' 'D' 'E' 'Y'};

lab_columns=['A'; 'B'; 'C'; 'D'; 'E'; 'Y'];

In this example, column 'Y' is considered as a supplementary column. In the image below you can see how the analysis of this data set can be defined in CAR:

Please note that in this example two dimensions were required on the basis of a biplot symmetrical model. Oblique rotation was also configured. A MAP was also required and a detailed OUTPUT was specified.

If you are not a usual Matlab user, you may want to load data files from ASCII files without using the typical Matlab command lines. In this case, you can use the option Import files from text files, in the File menu:

A menu will help you to specify the name of the matrix where the data is going to be stored, and the name of the file where the data is already stored in ASCII format.

In some situations, your raw data may be stored in a single matrix. If it is, you will need to tell CAR (1) which column of this matrix contains the variables to be set as rows in the cross tabulation matrix, and (2) which column of this matrix contains the variables to be set as columns in the cross tabulation matrix. To give CAR this information, you just must select the option To compute the cross tabulation matrix, and select the matrix that contains the two variables. The following menu will appear:

By default, the program assumes that the first column contains the row variable, and the second the column variable. However, you can specify the columns at your convenience. After you have selected the columns, they are indicated in the main menu as follows:

Note that in this example the default column specification is maintained.


OUTPUT

The output is stored in a text file, which, in Windows OS, is automatically shown in the notebook application. To get diagnostic indices and a detailed outcome, you must select the Detailed output option in CAR.

The MAP displays the coordinates. Note that if more than two dimensions are retained, all the possible bidimensional pairs of coordinates are displayed using a tool bar. Here you have the MAP for the data described in the Input section of this help.

Note that MAP is applied to the unrotated coordinates. Interpreting the rotated axes is useful only when a large number of dimensions are retained (also probably related to a large contingence table): in this situation, the map is not going to be of much use (because of the complexity of the situation).

After rotation, it is important to define which are the salient values in the rotated loading matrices that must be interpreted in order to name the dimensions. The following procedure is implemented in CAR. First, the mean of the squared coordinates for each dimension in each rotated loading matrix is computed. Then, each squared coordinate is compared to its corresponding mean: only coordinates whose squared values are larger than the mean are considered to be salient coordinates. Labels can be assigned to the dimensions depending on the characteristics of the variables with salient coordinates in the dimension.


EXAMPLE DATA

The folder 'data' contains some data that may be helpful to the user when learning how to use CAR.


BIBLIOGRAPHY

For further information on the methodological concepts underlying the computing applied in CAR, the user is invited to study the following references:

Greenacre, M. J., & Blasius, J. (1994). Correspondence Analysis in the Social Sciences: Recent developments and Applications. London: Academic Press.

Lorenzo-Seva, U., Van de Velden, M. & Kiers, H. A. L. (in press). Oblique rotation in correspondence analysis a step forward in the search of the simplest interpretation. British Journal of Mathematical and Statistical Psychology.

Van de Velden, M. & Kiers, H. A. L. (2003). An application of rotation in correspondence analysis. In H. Yanai, A. Okada, K. Shigemasu, Y. Kano, and J.J. Meulman, (Eds.), New Developments in Psychometrics (471-478). Tokyo: Springer Verlag.

Van de Velden, M. & Kiers, H. A. L. (2005). Rotation in correspondence analysis. Journal of Classification, 22, 251–271.