# Phenetic analysis (measuring similarity) 1 (25-Mar-03)

## Matrix conventions:

 a11 a12 a13 a14 matrix A = a21 a22 a23 a24 a31 a32 a33 a34

with elements ahi, for h = 1...m rows, and i = 1...n columns.
The order of A is the number of elements, m × n, abbreviated as Amn.

A can be thought of as being made up of component submatrices consisting of individual rows (1 × n) or columns (m × 1). These submatrices, or vectors, can be abbreviated as follows:

a
1· = a11, a12, a13, a14

 a13 a·3 = a23 a13

where · stands for all the elements in the corresponding dimension (this usage should not be confused with multiplication, where the · will be between two arguments, e.g. a·b, meaning a × b).

The transpose of A =

 a11 a21 a31 A´= a12 a22 a32 a13 a23 a33 a14 a24 a34

Note that the first row of A becomes the first column of , while the first column of A becomes the first row of .

A is a square matrix if m = n. Elements of A, ahi, such that h = i are the diagonal elements of A. The sum of the diagonal elements of a square matrix is its trace.

Square matrices can be of particular kinds, e.g.

A is a symmetric square matrix if = A.

A is a diagonal matrix if the off-diagonal elements are all zero,

 a11 0 0 e.g. 0 a22 0 0 0 a33

## What do vectors and matrices represent?

A vector is an ordered set of real numbers (scalars) that can be written as

 a1 a2 a = a3 . . an

or as = (a1,a2,a3, ...an). Geometrically, the elements of a can be thought of as coordinates of a point in n-dimensional space. We will restrict our discussion of vectors to what are called position vectors, in that they represent the direction and distance from the origin of an n-dimensional coordinate system to the point in space defined by the elements of a (see illustration at right). The 12 2-element (x1, x2) position vectors shown below can be thought of as making up a 12 × 2 matrix A.

## Matrix operations:

A + B (or A - B) is allowed if A and B are of the same order.

 a11 a21 b11 b12 For A = a12 a22 and B = b21 b22 a31 a32 b31 b32

 a11+b11 a12+b12 A + B = a21+b21 a22+b22 a31+b31 a32+b32

Matrix multiplication is based on the scalar products of vectors:

 a11 b11 b11 for a = a21 and b = b21 a´ b = a11 a21 a31 · b21 = a11·b11 + a21·b21 + a31·b31 a31 b31 b31

This is a scalar number, equivalent to a matrix of order 1 × 1, that is, with rows equal to those of the first matrix and columns equal to those of the second matrix.

Why is the square root of a´a equal to the length of vector a?

Consider the vector shown at the right; its length (denoted ||||) is given by generalizing the Pythagorean theorem to three dimensions (or more, depending on the number of elements in a).

 a11 for a = a21 a31

a´a = a11·a11 + a21·a21 + a31·a31

and |||| = (a11·a11 + a21·a21 + a31·a31)1/2

What is the length of = (1,2,2)?

Multiplication of entire matrixes is thus defined: for matrices A and B, their product AB can be thought of as containing elements that are the scalar products of the row vectors of A and the column vectors of B. In order for this to be possible, the number of columns in A must equal the number of rows in B. When this is the case, A and B are said to conform. Matrix multiplication is possible if and only if the number of columns of the first matrix equals the number of rows of the second.

Based on this definition, the results of matrix multiplication depend on the order in which matrices are multiplied.

For matrices A and B,

 a11 a12 a13 (a11·b11+a12·b21+a13·b31) (a11·b12+a12·b22+a13·b32) a21 a22 a23 b11 b12 (a21·b11+a22·b21+a23·b31) (a21·b12+a22·b22+a23·b32) AB = a31 a32 a33 · b21 b22 = (a31·b11+a32·b21+a33·b31) (a31·b12+a32·b22+a33·b32) a41 a42 a43 b31 b32 (a41·b11+a42·b21+a43·b31) (a41·b12+a42·b22+a43·b32) a51 a52 a53 (a51·b11+a52·b21+a53·b31) (a51·b12+a52·b22+a53·b32)

or, more compactly,

 (a1· · b.1) (a1· · b.2) (a2· · b.1) (a2· · b.2) (a3· · b.1) (a3· · b.2) (a4· · b.1) (a4· · b.2) (a5· · b.1) (a5· · b.2)

or (for N=3)

 (a1i·bi1) (a1i·bi2) (a2i·bi1) (a2i·bi2) (a3i·bi1) (a3i·bi2) (a4i·bi1) (a4i·bi2) (a5i·bi1) (a5i·bi2)

where signifies summation over i=1...N.

What would be the order of A´ A? - of AA´ ?

Some useful geometric properties of matrix multiplication are illustrated HERE (esp. pp. 1-3).

## The basic data matrix, and types of data

The basic data matrix that is used in (numerical) phenetics is one in which one dimension (rows, say) represents the operational taxonomic units (OTUs) while the other dimension (columns) represents the characters for which data have been collected. For example, consider the data in Table 1 (below) as representing a description of 11 races of bean rust, based on their reactions when inoculated onto a suite of differential bean cultivars.

 Table 1. Disease reactions for 11 Jamaican rust (Uromyces appendiculatus var. appendiculatus) isolates (J1-J20) inoculated on 10 bean (Phaseolus vulgaris) cultivars (first six, US differential vars.; last four, Jamaican landraces): 1, susceptible (sporulation); 0, immune (no sporulation). Data from M. Shaik (1983). GGW 814 765 111 643 181 PR RR JR MK J1 1 0 0 1 0 1 0 0 1 0 J3 1 0 0 0 0 1 0 0 1 0 J20 1 1 0 1 0 1 0 1 1 0 J11 1 1 1 1 0 1 1 1 1 1 J12 1 1 1 1 0 1 1 1 1 1 J13 1 1 1 1 0 1 1 1 1 1 J5 1 1 1 1 1 1 1 1 1 1 J6 1 1 1 1 1 1 1 1 1 1 J10 1 1 1 1 1 1 1 1 1 1 J14 0 1 1 1 1 1 1 1 1 1 J15 0 1 1 1 1 1 1 1 1 1

## R-mode measures of similarity

Covariance and correlation (page 4 ff.)

## Q-mode measures of similary

Euclidean distance (first 2 pages only)

Measures for binary and multi-state data

Measures for mixed data