a vector can be interpreted as a file of data

14
Species Taxon Guild M ean length (mm) Site 1 Site 2 Site 3 Site 4 Nanoptilium kunzei (H eer,1841) Ptiliidae N ecrophagous 0.60 0 0 0 0 A crotrichis dispar (M atthew s,1865) Ptiliidae N ecrophagous 0.65 13 0 4 7 A crotrichis silvatica R osskothen,1935 Ptiliidae N ecrophagous 0.80 16 0 2 0 A crotrichis rugulosa R osskothen,1935 Ptiliidae N ecrophagous 0.90 0 0 1 0 A crotrichis grandicollis (Mannerheim,1844) Ptiliidae N ecrophagous 0.95 1 0 0 1 A crotrichis fratercula (M atthew s,1878) Ptiliidae N ecrophagous 1.00 0 1 0 0 C arcinops pumilio (Erichson,1834) H isteridae Predator 2.15 1 0 0 0 S aprinus aeneus (Fabricius,1775) H isteridae Predator 3.00 13 23 4 9 G nathoncus nannetensis (Marseul,1862) H isteridae Predator 3.10 0 0 0 2 Margarinotus carbonarius (Hoffmann,1803) H isteridae Predator 3.60 0 5 0 0 R ugilus erichsonii (Fauvel,1867) Staphylinidae Predator 3.75 8 0 5 0 Margarinotus ventralis (Marseul,1854) H isteridae Predator 4.00 3 2 6 1 S aprinus planiusculus M otschulsky,1849 H isteridae Predator 4.45 0 5 0 0 Margarinotus merdarius (Hoffmann,1803) H isteridae Predator 4.50 5 0 6 0 A vector can be interpreted as a file of data A matrix is a collection of vectors and can be interpreted as a data base The red matrix contain three column vectors Handling biological data is most easily done with a matrix approach. An Excel worksheet is a matrix. Short recapitulation of matrix basics

Upload: tibor

Post on 22-Feb-2016

34 views

Category:

Documents


0 download

DESCRIPTION

Short recapitulation of matrix basics. A vector can be interpreted as a file of data. A matrix is a collection of vectors and can be interpreted as a data base. The red matrix contain three column vectors. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: A  vector can  be  interpreted  as a file of data

Species Taxon GuildMean length (mm)

Site 1 Site 2 Site 3 Site 4

Nanoptilium kunzei (Heer, 1841) Ptiliidae Necrophagous 0.60 0 0 0 0Acrotrichis dispar (Matthews, 1865) Ptiliidae Necrophagous 0.65 13 0 4 7Acrotrichis silvatica Rosskothen, 1935 Ptiliidae Necrophagous 0.80 16 0 2 0Acrotrichis rugulosa Rosskothen, 1935 Ptiliidae Necrophagous 0.90 0 0 1 0Acrotrichis grandicollis (Mannerheim, 1844) Ptiliidae Necrophagous 0.95 1 0 0 1Acrotrichis fratercula (Matthews, 1878) Ptiliidae Necrophagous 1.00 0 1 0 0Carcinops pumilio (Erichson, 1834) Histeridae Predator 2.15 1 0 0 0Saprinus aeneus (Fabricius, 1775) Histeridae Predator 3.00 13 23 4 9Gnathoncus nannetensis (Marseul, 1862) Histeridae Predator 3.10 0 0 0 2Margarinotus carbonarius (Hoffmann, 1803) Histeridae Predator 3.60 0 5 0 0Rugilus erichsonii (Fauvel, 1867) Staphylinidae Predator 3.75 8 0 5 0Margarinotus ventralis (Marseul, 1854) Histeridae Predator 4.00 3 2 6 1Saprinus planiusculus Motschulsky, 1849 Histeridae Predator 4.45 0 5 0 0Margarinotus merdarius (Hoffmann, 1803) Histeridae Predator 4.50 5 0 6 0

A vector can be interpreted as a

file of data

A matrix is a collection of

vectors and can be interpreted as a data base

The red matrix contain three

column vectors

Handling biological data is most easily done with a matrix approach.An Excel worksheet is a matrix.

Short recapitulation of matrix basics

Page 2: A  vector can  be  interpreted  as a file of data

11 1n

m1 mn

a aA

a a

1

2

3

4

aa

Vaa

1 2 3 4V a a a a

The first subscript denotes rows, the second columns.n and m define the dimension of a matrix. A has m rows and n columns.

Column vector

Row vector

1864875365424321

A

The symmetric matrix is a matrix where An,m = A m,n.

1000070000400001

A

The diagonal matrix is a square and symmetrical.

1000010000100001

A

Unit matrix Iis a matrix with one row and one column. It is a scalar (ordinary number).

Page 3: A  vector can  be  interpreted  as a file of data

For a non-singular square matrix the inverse is defined as

IAAIAA

1

1

987642321

A

1296654321

A

r2=2r1 r3=2r1+r2

Singular matrices are those where some rows or columns can be expressed by a linear

combination of others.Such columns or rows do not contain additional

information.They are redundant.

nnkkkk VVVVV ...332211

A linear combination of vectors

A matrix is singular if it’s determinant is zero.

122122112221

1211

2221

1211

aaaaaaaa

Det

aaaa

AA

A

Det A: determinant of A

A matrix is singular if at least one of the parameters k is not zero.

(A•B)-1 = B-1 •A-1 ≠ A-1 •B-1

1112

2122

21122211

1

2212

2111

1aaaa

aaaa

aaaa

A

A

Determinant

The inverse of a 2x2 matrix

Page 4: A  vector can  be  interpreted  as a file of data

nmnmnn

mm

baba

baba

..............................

......

11

111111

BA

BB

nmn

m

bb

bb

..............................

......

1

111

Addition and subtraction Scalar product

m m

1i i1 1i iki 1 i 111 1m 11 1k 1 1 1 k

m mn1 nm m1 mk m 1 m k

ni i1 ni iki 1 i 1

a b ... a ba ... a b ... b A B ... A B

A B ... ... ... ... ... ... ... ... ... ... ... ...a ... a a ... a A B ... A B

a b ... a b

The inner or dot product

A B B A(A B) C A (B C) A B C(A B) C A C B C

Basic rule of matrix multiplication

izyzlmkljkij CZDCBA ...

Page 5: A  vector can  be  interpreted  as a file of data

BAXIAA

BAAXABAX

1

1

11

XXIIX

I

1...00............0...100...01

Identity matrix

Only possible if A is not singular.If A is singular the system has no solution.

The general solution of a linear system

13.25.091283310423

zyxzyxzyx

Systems with a unique solution

The number of independent equations equals the number of unknowns.

3.25.09833423

13.25.091283310423

X: Not singular

0678.05627.43819.0

11210

3.25.09833423 1

zyx

Page 6: A  vector can  be  interpreted  as a file of data

∆𝑁=𝑟𝑁 − 𝑟𝐾 𝑁 2

Species Aspilota sp2 Aspilota sp51981 3.8 0.71982 3.5 0.51983 6.6 01984 5.8 2.31985 0.8 01986 26.8 13.41987 18.3 5.8

Aspilota sp2 Aspilota sp5DN N -N2 DN N -N2

-0.3 3.8 -14.44 -0.2 0.7 -0.493.1 3.5 -12.25 -0.5 0.5 -0.25-0.8 6.6 -43.56 2.3 0 0-5 5.8 -33.64 -2.3 2.3 -5.2926 0.8 -0.64 13.4 0 0

-8.5 26.8 -718.24 -7.6 13.4 -179.56

𝑌=𝑋𝑎𝑋𝑇𝑌=𝑋𝑇 𝑋𝑎

=IA=A

Transpose3.8 3.5 6.6 5.8 0.8 26.8

-14.44 -12.25 -43.56 -33.64 -0.64 -718.24

XTX822.77 -19829.7

-19829.7 519256.8

(XTX)-1

0.015267 0.0005830.000583 2.42E-05

XTY-231.57

6257.805

r K0.11308 6.90785

r/K 0.01637

r K-1.0019 30.9025

r/K -0.03242

Aspilota sp2

Aspilota sp5

Both species have low reproductive rate r. They are prone to fast extinction.

The general solution of a linear system

Page 7: A  vector can  be  interpreted  as a file of data

Orthogonal vectors

X=

Y= XY= The dot product of two orthogonal vectors is zero.

If the orthogonal vectors have unity length they are called orthonormal.

A system of n orthogonal vectors spans an n-dimensional hypervolume (a Cartesian system)

In ecological modelling orthogonal vectors are of particular importance. They define linearly independent variables.

Orthogonal matrix𝐴=( 𝑐𝑜𝑠𝛼 𝑠𝑖𝑛𝛼

−𝑠𝑖𝑛𝛼 𝑐 𝑜𝑠𝛼)𝐴𝑇=(𝑐𝑜𝑠𝛼 −𝑠𝑖𝑛𝛼𝑠𝑖𝑛𝛼 𝑐 𝑜𝑠𝛼 )

𝐴′ 𝐴=(𝑐 𝑜𝑠𝛼 −𝑠𝑖𝑛𝛼𝑠𝑖𝑛𝛼 𝑐𝑜𝑠𝛼 )( 𝑐𝑜𝑠𝛼 𝑠𝑖𝑛𝛼

−𝑠𝑖𝑛𝛼 𝑐 𝑜𝑠𝛼)Multiplying an orthogonal matrix with its transpose gives the identity matrix.

𝐴−1=𝐴𝑇

The transpose of an orthogonal system is identical to its inverse.

𝐴𝑇 𝐴=(1 00 1)𝐴−1 𝐴=(1 0

0 1)

d=1Y=sin(a)

X=cos(a)

V=

Page 8: A  vector can  be  interpreted  as a file of data

X

Y How to transform vector A into vector B?

A

B

BXA

97

31

5.25.121

Multiplication of a vector with a square matrix defines a new

vector that points to a different direction. The matrix defines a

transformation in space

X

Y

A

B

BXA

Image transformationX contains all the information

necesssary to transform the image

The vectors that don’t change during transformation are the

eigenvectors.

In general we define

U is the eigenvector and the eigenvalue of the square matrix X

Eigenvalues and eigenvectors

𝑿𝑨=𝑨

𝑿𝑼=𝝀𝑼

[X [X

Page 9: A  vector can  be  interpreted  as a file of data

A matrix with n columns has n eigenvalues and n eigenvectors.

Page 10: A  vector can  be  interpreted  as a file of data

Some properties of eigenvectors

11

UUAAUUUΛAUUΛΛU

If is the diagonal matrix of eigenvalues:

The product of all eigenvalues equals the

determinant of a matrix.

n

i i1det A

The determinant is zero if at least one of the eigenvalues is zero.

In this case the matrix is singular.

The eigenvectors of symmetric matrices are orthogonal

0':)(

UUA symmetric

Eigenvectors do not change after a matrix is multiplied by a scalar k.

Eigenvalues are also multiplied by k.

0][][ uIkkAuIA

If A is trianagular or diagonal the eigenvalues of A are the diagonal

entries of A.A Eigenvalues

2 3 -1 3 23 2 -6 3

4 -5 45 5

Page 11: A  vector can  be  interpreted  as a file of data

A B C D EA 1 2 3 4 5B 2 1 4 3 2C 3 4 1 3 4D 4 3 3 1 4E 5 2 4 4 1

A -4.37578B -3.49099C -2.20138D 0.347457E 14.72069

Eigenvalues of M

A B C D EA 0.438984 0.629065 0.007298 0.443962 0.46305B -0.29098 0.442618 -0.25089 -0.72095 0.369735C 0.435137 -0.37779 0.56955 -0.37455 0.450844D 0.127886 -0.50284 -0.71251 0.121699 0.456425E -0.71898 -0.11313 0.323958 0.357809 0.487132

A B C D EA 1 1.39E-17 6.11E-16 3.89E-16 1.22E-15B 1.39E-17 1 2.29E-16 -3.5E-16 1.25E-16C 6.11E-16 2.29E-16 1 1.39E-16 -5E-16D 3.89E-16 -3.5E-16 1.39E-16 1 -6.1E-16E 1.22E-15 1.25E-16 -5E-16 -6.1E-16 1

Matrix M

Eigenvectors U of M

UTU

UTU = I

The largest eigenvalue is associated with the left (dominant) eigenvector

Page 12: A  vector can  be  interpreted  as a file of data

𝑿𝑼=𝝀𝑼

0

2

4

6

8

10

0 2 4 6 8 10

Y

X

X Y7.492729 8.2992473.794709 6.6688417.188977 4.6550685.192209 10.101633.358493 3.7593260.543067 0.145558.105676 9.837813.094105 4.8852977.392673 4.355692.225443 1.0447799.748683 6.696282.831838 1.5910568.602463 6.5004772.977185 4.208492

3.5781 5.6976052.730209 1.4998517.122361 8.5626525.771215 7.3545062.740751 1.5327675.741111 2.2855760.301084 0.052058

X YX 1 0.7218Y 0.7218 1

Correlation matrixEigenvalues

0.27821.7218

EV1 EV20.707 0.707-0.707 0.707

Xmean

Ymean 12

The eigenvectors define the major axes of the data.The eigenvalues define the length of the eigenvalues

A geometrical interpretation of eigenvalues

Page 13: A  vector can  be  interpreted  as a file of data

(1 𝑟𝑟 1)−(𝜆1 0

0 𝜆1)=0

`

(𝜆1−1)2=𝑟2

𝜆1=+𝑟+1

X YX 1 0.7218Y 0.7218 1

Correlation matrixEigenvalues

0.27821.7218

[R

The eigenvalues of a correlation similarity matrix are linearly linked to the coefficients of

correlation.

0

2

4

6

8

10

0 2 4 6 8 10

Y

X

Xmean

The eigenvector ellipse

𝐴=𝜋 𝜆1 𝜆2=𝜋(1+𝑟 )(1−𝑟 )

𝜆2=−𝑟 +1

Page 14: A  vector can  be  interpreted  as a file of data

Eigenvectors and information content

𝑿𝑼=𝝀𝑼

A matrix is a data base that contains an amount of information.

Left and right sides of an equation contain the

same amount of information

The eigenvectors take over the information content of the data base (the matrix)

The eigenvalues define ow much information contains each eigenvector.The eigenvalue is a measure of correlation.

The squared eigenvalue is therefore a measure of the variance explained by the associated eigenvector.

The eigenvector of the largest eigenvalue is called the dominant eigenvector and contains the largest part of information of the associated data base.