Transcript Slajd 1
Ecological modelling A B C Our program 1. 2. 3. 4. 5. 6. 7. 8. Matrix algebra I Matrix algebra II General additive models Jackknifing and bootstrapping Population models Richness patterns in communities Nestedness analysis Indicator species analysis Additional sources http://en.wikipedia.org/wiki/Matrix_(mathematics) K. Kaw. 2002. Introduction to matrix algebra http://www.autarkaw.com/books/matrixalgebra/index.html http://www.ems.bbk.ac.uk/faculty/phdStudents/efthyvoulou/Kaw.pdf Introduction to matrix algebra and linear models: http://nitro.biosci.arizona.edu/courses/EEB5812006/handouts/LinearI.pdf http://matwww.ee.tut.fi/Kost/MatrixAlgebra-toc.html Matrix cook book http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/3274/pdf /imm3274.pdf Matrix http://en.wikipedia.org/wiki/Matrix_the ory A first course in linear algebra (free online textbook) http://linear.ups.edu/download.html Matrix algebra and regression http://www.stat.tugraz.at/courses/files/s05.pdf Mathe online http://www.matheonline.at/mathint.html Species Taxon Guild Nanoptilium kunzei (Heer, 1841) Acrotrichis dispar (Matthews, 1865) Ptiliidae Ptiliidae Necrophagous Necrophagous Mean length (mm) 0.60 0.65 Acrotrichis silvatica Rosskothen, 1935 Ptiliidae Necrophagous Acrotrichis rugulosa Rosskothen, 1935 Ptiliidae Acrotrichis grandicollis (Mannerheim, 1844) Acrotrichis fratercula (Matthews, 1878) Ptiliidae Ptiliidae Site 1 Site 2 Site 3 Site 4 0 13 0 0 0 4 0 7 0.80 16 0 2 0 Necrophagous 0.90 0 0 1 0 Necrophagous 0.95 1 0 0 1 Necrophagous 1.00 0 1 0 0 1 0 0 0 13 0 0 8 3 0 5 23 0 5 0 2 5 0 4 0 0 5 6 0 6 9 2 0 0 1 0 0 Carcinops pumilio (Erichson, 1834) Histeridae Predator 2.15 Saprinus aeneus (Fabricius, 1775) Histeridae Histeridae Histeridae Staphylinidae Histeridae Histeridae Histeridae Predator Predator Predator Predator Predator Predator Predator 3.00 Gnathoncus nannetensis (Marseul, 1862) Margarinotus carbonarius (Hoffmann, 1803) Rugilus erichsonii (Fauvel, 1867) Margarinotus ventralis (Marseul, 1854) Saprinus planiusculus Motschulsky, 1849 Margarinotus merdarius (Hoffmann, 1803) 3.10 3.60 3.75 4.00 4.45 4.50 A vector can be interpreted as a file of data Handling biological data is most easily done with a matrix approach. An Excel worksheet is a matrix. A matrix is a collection of vectors and can be interpreted as a data base The red matrix contain three column vectors A general structure of databases a11 A a m1 a1 a2 V a3 a4 a1n a mn The first subscript denotes rows, the second columns. n and m define the dimension of a matrix. A has m rows and n columns. V a1 a 2 a3 a 4 Row vector Column vector a11 a12 V a 21 a 22 a 31 a 32 a13 a 23 a 33 a11 a12 V a 21 a 22 a 31 a 32 a13 a 23 a 33 Two matrices are equal if they have the same dimension and all corresponding values are identical. Solving systems of linear equations The Nine Chapters on the Mathematical Art. (1000BC-100AD). Systems of linear equations, Gaussian elimination Takakazu Shinsuke Seki (1642-1708) Determinants to solve linear equations Gottfried Wilhelm Leibniz (1646-1716) Determinants to solve linear equations Matrix approaches Johann Carl Friedrich Gauss (1777 – 1855) Gaussian elimination, inverse Arthur Cayley (1821-1895) Formal matrix algebra Olga Taussky-Todd (1906-1995) Finite value matrices Some elementary types of matrices In biology and statistics are square matrices An,n of particular importance 1 3 A 5 4 2 4 6 3 3 5 7 2 4 6 8 1 The symmetric matrix is a matrix where An,m = A m,n. 1 2 A 3 4 2 4 5 6 3 5 7 8 4 6 8 1 Lower and upper triangular matrices 1 2 A 3 4 0 4 5 6 0 0 0 1 0 0 7 8 1 0 A 0 0 2 4 0 0 3 5 7 0 4 6 8 1 The diagonal matrix is a square and symmetrical. 1 0 A 0 0 0 4 0 0 0 0 7 0 Λ 3 is a matrix with one row and one column. It is a scalar (ordinary number). 0 1 0 0 A 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 1 Unit matrix I Matrix operations Addition and Subtraction 1 2 A 3 3 a11 b11 ... ... a1m b1m 2 3 2 4 0 2 8 1 5 14 4 ... ... ... ... 2 4 1 2 0 7 5 5 10 9 9 AB ... ... ... ... 5 7 6 9 1 0 0 1 9 14 9 a b ... ... a b 1 0 1 1 4 5 6 1 9 8 5 nm nm n1 n1 Addition and subtraction are only defined for matrices with identical dimensions S-product 1 2 A 3 3 2 2 5 1 3 1 4 2 7 3 0 3 b11 ... B ... b n1 2 2 5 1 3 1 4 2 7 3 0 3 2 2 5 1 ... ... b1m ... ... ... B ... ... ... ... ... bnm 3 3 6 4 6 6 7 9 15 0 9 3 9 1 12 2 3 3 21 0 3 2 2 5 1 3 3 1 4 32 7 3 3 0 33 32 32 3 5 3 1 A B B A 1B A AB BA A (B C) (A B) C A A (A B) A B A( ) A A 3 3 34 37 30 The inner or dot or scalar product Assume you have production data (in tons) of winter wheat (15 t), summer wheat (20 t), and barley (30 t). In the next year weather condition reduced the winter wheat production by 20%, the summer wheat production by 10% and the barley production by 30%. How many tons do you get the next year? (15*0.8 + 20* 0.9 + 30 * 0.7) t = 51 t. 0.8 P 15 20 30 0.9 15*0.8 20*0.9 30*0.7 51 0.7 A B a1 b1 n ... a n ... a i bi scalar b i 1 n The dot product is only defined for matrices, where the number of columns in the first matrix equals the number of rows in the second matrix. We add another year and ask how many cereals we get if the second year is good and gives 10 % more of winter wheat, 20 % more of summer wheat and 25 % more of barley. For both years we start counting with the original data and get a vector with one row that is the result of a two step process 0.8 1.1 P 15 20 30 0.9 1.2 15*0.8 20*0.9 30*0.7 15*1.1 20*1.2 30*1.25 51 78 0.7 1.25 a11 ... a1m b11 A B ... ... ... ... a ... a a nm m1 n1 m a1i bi1 ... ... b1k i 1 ... ... ... ... ... a mk m a ni bi1 ... i 1 A B B A (A B) C A (B C) A B C (A B) C A C B C a b 1i ik A B ... A1Bk i 1 1 1 ... ... ... ... m A B ... A B m 1 m k a ni bik i 1 m 1 2 4 2 3 5 3 2 4 2 4 6 2 2 4 5 2 4 4 6 2 6 4 7 24 32 40 3 5 5 6 7 3 2 5 5 3 4 5 6 3 6 5 7 31 42 53 2 4 2 4 6 3 5 The number of columns in the first matrix must equal the number of rows in the second matrix. AijB jkCkl Dlm...Z yz Ciz AijB jk Cik A 2x3 1 1 2 2 1 2 4 3 3 3 2 4 3 2 3 1 B 3x2 AB 2x2 17 9 18 12 5 2x4 5 106 66 87 51 86 48 2x3 ABCD 1153 687 1943 1167 1011 597 C 2x4 ABC 4 1 D 4x3 1 3 1 4 6 2 3 5 3 2 4 1 175 105 Transpose A’ ot AT 1 2 3 4 2 . 171828 1 8 9 3.14159 3.56 4 3 2 1 2 3 4 1 4 3 2 1 2 3 4 5 3 4 T 1 2.171828 3.141459 2 1 3 . 56 3 8 4 4 9 3 1 29 30 2 21 20 3 39 40 4 AB a11 T a11 ... ... a1n ... ... ... ... ... a ... ... ... a mn m1 a 1n 1 2 1 3 4 2 * 1 2 3 4 3 4 (A B)T BT AT 2 3 2 1 ... am1 ... ... ... ... ... amn 4 3 29 21 39 4 30 20 40 5 BT A T Matrix add in for Excel: www.digilander.libero.it/foxes/SoftwareDownload.htm Some properties of the transpose A ' A AA ' A ' A AA ' always exists and gives a symmetric matrix only if A is square and symmetric If A is orthogonal A’A is diagonal, but AA’ need not to be diagonal A A' Orthogonal matrix 3 -1 2 2 1 -1 -1 0.5 2 3 -1 -1 2 2 0.5 1 -1 2 AA' 11 3.5 2 3.5 8.25 1 2 1 6 A'A 14 0 0 0 6 0 0 0 5.25 Ground beetles on Mazurian lake islands (Mamry) Carabus problematicus Carabus auratus Photo Marek Ostrowski Species Pterostichus nigrita (Paykull) Platynus assimilis (Paykull) Amara brunea (Gyllenhal) Agonum lugens (Duftshmid) Loricera pilicornis (Fabricius) Pterostichus vernalis (Panzer) Amara plebeja (Gyllenhal) Badister unipustulatus Bonelli Lasoitrechus discus (Fabricius) Poecilus cupreus (Linnaeus) Amara aulica (Panzer) Anisodatylus binotatus (Fabricius) Bembidion articulatum (Panzer) Clivina collaris (Herbst) wros 0 0 1 1 0 1 0 0 0 0 0 wron 2 0 1 1 0 1 0 0 0 0 1 wil 61 1 0 2 1 21 0 0 0 0 0 ter 53 0 0 2 0 2 0 0 1 0 0 swi 0 0 19 0 0 0 1 4 0 0 0 sos 18 9 40 0 0 1 2 1 0 2 0 mil 39 0 0 0 3 7 0 0 1 0 0 lip 2 117 1 0 0 0 4 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 1 2 0 0 0 Species associations Species Pterostichus nigrita (Paykull) Platynus assimilis (Paykull) Amara brunea (Gyllenhal) Agonum lugens (Duftshmid) Loricera pilicornis (Fabricius) Pterostichus vernalis (Panzer) Amara plebeja (Gyllenhal) Badister unipustulatus Bonelli Lasoitrechus discus (Fabricius) Poecilus cupreus (Linnaeus) Amara aulica (Panzer) Anisodatylus binotatus (Fabricius) Bembidion articulatum (Panzer) Clivina collaris (Herbst) wros 0 0 1 1 0 1 0 0 0 0 0 0 0 0 wron 2 0 1 1 0 1 0 0 0 0 1 0 0 0 wil 61 1 0 2 1 21 0 0 0 0 0 0 0 0 ter 53 0 0 2 0 2 0 0 1 0 0 0 0 0 swi 0 0 19 0 0 0 1 4 0 0 0 0 0 0 sos 18 9 40 0 0 1 2 1 0 2 0 0 0 0 mil 39 0 0 0 3 7 0 0 1 0 0 2 1 2 lip 2 117 1 0 0 0 4 3 0 0 0 0 0 0 Panagaeus cruxmajor (Linnaeus) Poecilus versicolor (Sturm) Pterostichus gracilis Dejean) Stenolophus mixtus Pseudoophonus rufipes (De Geer) Harpalus latus (Linnaeus) Agonum duftshmidi Shmidt Harpalus solitaris Dejean 0 0 0 0 0 0 0 0 24 0 0 0 0 0 0 0 0 0 0 0 13 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 5 3 0 0 5 0 0 0 3 0 0 1 1 2 0 0 2 2 0 0 Species Pterostichus nigrita (Paykull) Platynus assimilis (Paykull) Amara brunea (Gyllenhal) Agonum lugens (Duftshmid) Loricera pilicornis (Fabricius) Pterostichus vernalis (Panzer) Amara plebeja (Gyllenhal) Badister unipustulatus Bonelli Lasoitrechus discus (Fabricius) Poecilus cupreus (Linnaeus) Amara aulica (Panzer) Anisodatylus binotatus (Fabricius) Bembidion articulatum (Panzer) Clivina collaris (Herbst) wros 0 0 1 1 0 1 0 0 0 0 0 0 0 0 wron 2 0 1 1 0 1 0 0 0 0 1 0 0 0 wil 61 1 0 2 1 21 0 0 0 0 0 0 0 0 ter 53 0 0 2 0 2 0 0 1 0 0 0 0 0 swi 0 0 19 0 0 0 1 4 0 0 0 0 0 0 sos 18 9 40 0 0 1 2 1 0 2 0 0 0 0 mil 39 0 0 0 3 7 0 0 1 0 0 2 1 2 lip 2 117 1 0 0 0 4 3 0 0 0 0 0 0 S wros wron wil ter swi sos mil lip Panagaeus cruxmajor (Linnaeus) 0 24 0 0 1 0 5 1 Poecilus versicolor (Sturm) 0 0 0 0 0 0 0 2 Pterostichus gracilis Dejean) 0 0 0 0 0 0 0 0 Stenolophus mixtus 0 0 0 1 0 0 0 0 Pseudoopho nus rufipes (De Geer) 0 0 13 0 0 5 3 2 Harpalus latus (Linnaeus) 0 0 0 0 0 3 0 2 Agonum duftshmidi Shmidt 0 0 1 0 0 0 0 0 Harpalus solitaris Dejean 0 0 0 0 1 0 1 0 Species Pterostichus nigrita (Paykull) Platynus assimilis (Paykull) Amara brunea (Gyllenhal) Agonum lugens (Duftshmid) Loricera pilicornis (Fabricius) Pterostichus vernalis (Panzer) Amara plebeja (Gyllenhal) Badister unipustulatus Bonelli Lasoitrechus discus (Fabricius) Poecilus cupreus (Linnaeus) Amara aulica (Panzer) Anisodatylus binotatus (Fabricius) Bembidion articulatum (Panzer) Clivina collaris (Herbst) Panagaeus cruxmajor (Linnaeus) 245 117 44 24 15 59 5 7 5 0 24 10 5 10 Poecilus versicolor (Sturm) 4 234 2 0 0 0 8 6 0 0 0 0 0 0 Pterostichus gracilis Dejean) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Stenolophus mixtus 53 0 0 2 0 2 0 0 1 0 0 0 0 0 Pseudoopho nus rufipes (De Geer) 1004 292 202 26 22 299 18 11 3 10 0 6 3 6 Harpalus latus (Linnaeus) 58 261 122 0 0 3 14 9 0 6 0 0 0 0 Agonum duftshmidi Shmidt 61 1 0 2 1 21 0 0 0 0 0 0 0 0 Harpalus solitaris Dejean 39 0 19 0 3 7 1 4 1 0 0 2 1 2 Probabilities of co-occurrence Species wros Pterostichus nigrita (Paykull) 0 Platynus assimilis (Paykull) 0 Amara brunea (Gyllenhal) 0.59 Agonum lugens (Duftshmid) 0.02 Loricera pilicornis (Fabricius) 0 Pterostichus vernalis (Panzer) 0.1 Amara plebeja (Gyllenhal) 0 Badister unipustulatus Bonelli 0 Lasoitrechus discus (Fabricius) 0 Poecilus cupreus (Linnaeus) 0 Amara aulica (Panzer) 0 Anisodatylus binotatus (Fabricius) 0 Bembidion articulatum (Panzer) 0 Clivina collaris (Herbst) 0 Species wros Panagaeus cruxmajor (Linnaeus) 0 Poecilus versicolor (Sturm) 0 Pterostichus gracilis Dejean) 0 Stenolophus mixtus 0 Pseudoophonus rufipes (De Geer) 0 Harpalus latus (Linnaeus) 0 Agonum duftshmidi Shmidt 0 Harpalus solitaris Dejean 0 wron wil 0.79 0.01 0 0.83 0.97 0 0.06 0.18 0 0.08 0.59 0.88 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 wron wil 0 0 0 0 0 0 0 0 0 0.22 0 0 0 0.17 0 0 ter 0.14 0 0 0.74 0 0.87 0 0 0.02 0 0 0 0 0 ter 0 0 0 0.11 0 0 0 0 swi sos 0 0.15 0 0.53 0.11 0.02 0 0 0 0 0 0.4 0.19 0.09 0.4 0.03 0 0 0 0.42 0 0 0 0 0 0 0 0 swi sos 0 0 0 0 0 0 0 0 0 0.83 0 0.29 0 0 0 0 mil 0.37 0 0 0 0.97 1 0 0 0 0 0 0.8 0.72 0.65 mil 0 0 0 0 0.98 0 0 0 lip 0.14 0.86 0.47 0 0 0 0.86 0.58 0 0 0 0 0 0 lip 0.7 0.38 0 0 0.66 0.64 0 0 kor hel 0 0 0.76 0.59 0 0.87 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0 0 0 0 0 0 0 0 0 kor hel 0 0 0 0 0 0 0 0 0.58 0.04 0.35 0 0 0 0 0 guc 0.45 0.62 0.54 0 0 0 0 0 0 0 0 0 0 0 guc 0 0 0 0 0.32 0 0 0 gil 0.51 0.2 0 1 0.27 0 0.19 0.34 0 0 0 0 0 0 gil 0 0 0.38 0 0.51 0.18 0 0.81 ful 0.56 0.03 0.39 0 0.56 0 0 0 0 0 0 0 0 0 ful 0 0 0 0 0.19 0.15 0 0.85 dab 0.01 0.85 0.47 0.37 0.89 0 0.37 0 0 0 0 0 0 0 dab 0 0 0 0 0.62 0 0 0 3pog 0.28 0.37 0 0 0 0 0 0 0 0 0.59 0 0 0 3pog 0 0 0 0 0.17 0.17 0.22 0 2pog 0.74 0.83 0 0 0.46 0 0 0 0 0 0 0 0 0 2pog 0 0 0 0 0.54 0.25 0 0 1pog 0.18 0 0 0.89 0 0 0 0 0 0 0 0 0 0 1pog 0 0 0 0 0.53 0 0.17 0 R P1P2 T Species Panagaeus cruxmajor Poecilus versicolor (Linnaeus) Pterostichus (Sturm) Stenolophus gracilis Dejean) Pseudoophonus mixtus Harpalus rufipes latus Agonum (De (Linnaeus) Geer) duftshmidi HarpalusShmidt solitaris Dejea Pterostichus 0.034035 nigrita (Paykull) 0.036504 0.213372 0.347488 4.640972 2.625121 0.682791 0.328616 Platynus assimilis 0.35977 (Paykull) 0.385866 0.047028 0 2.791692 2.228522 0.572894 0.16836 Amara brunea0.22055 (Gyllenhal) 0.236548 0 0 2.735377 1.078382 0 0.005715 Agonum lugens (Duftshmid) 0 0 0.149993 0.477588 2.060951 0.613648 0.432521 0.206119 Loricera pilicornis (Fabricius) 0 0 0.062924 0 2.527301 1.257689 0.254665 0.235746 Pterostichus vernalis0(Panzer) 0 0 0.287552 1.234233 0.455731 0.020836 0 Amara plebeja 0.126953 (Gyllenhal) 0.136162 0.145696 0 1.244267 0.955163 0 0.200214 Badister unipustulatus 0.209502 Bonelli 0.224699 0.059252 0 0.895534 1.127406 0 0.081424 Lasoitrechus discus (Fabricius) 0 0 0 0.158252 0.18667 0 0 0 Poecilus cupreus (Linnaeus) 0 0 0 0 0.804519 0.570117 0 0 Amara aulica (Panzer) 0 0 0 0 0.015829 0.016889 0.004067 0 Anisodatylus binotatus 0 (Fabricius) 0 0 0 0.006664 0 0 0 Bembidion articulatum 0 (Panzer) 0 0 0 0.333915 0 0 0 Clivina collaris (Herbst) 0 0 0 0 0.082518 0 0 0 The entries of the matrix give the sum of probabilities that two species meet on any of the islands. 15 R( Pterostichus Panagaeus) PPterosticus PPanagaeus i 1 Assume you are studying a contagious disease. You identified as small group of 4 persons infected by the disease. These 4 persons contacted in a given time with another group of 5 persons. The latter 5 persons had contact with other persons, say with 6, and so on. How often did a person of group C indirectly contact with a person of group A? B C A B 1 2 3 4 5 1 2 3 4 1 0 0 0 1 1 1 0 1 1 1 0 1 0 0 0 2 0 1 0 0 2 We eliminate 0 0 0 1 1 3 A 1 0 0 1 3 group B and leave B the first and last 0 0 0 1 1 4 0 0 0 1 4 0 1 0 0 0 group. 0 1 0 0 5 5 0 1 0 0 0 6 No. 1 of group C C A indirectly 1 2 3 4 contacted with all 1 0 0 0 1 1 1 1 1 1 members of group 1 0 1 1 0 1 0 0 2 A. 0 1 0 0 0 0 1 0 0 0 0 0 1 1 3 No. 2 of group A 0 1 0 1 1 0 0 1 C BA indirectly 0 1 0 1 4 0 0 0 1 1 contacted with all 0 1 0 0 0 0 0 0 1 0 1 0 0 5 six persons of 0 1 0 0 0 1 0 0 0 group C. 0 1 0 0 6 Instead of contact we use probabilities of being infected. A B 1 2 3 4 5 C 1 2 3 4 5 6 1 0.3 0 0.3 0 0 1 0.3 0 0 0 0 0 2 0 0.3 0 0 0.3 3 0.2 0 0 0 0 4 0.2 0 1 1 0 2 0 0.3 0 0 0.3 0.3 B 3 0 0 0 0 0 0 4 0 0 0.1 0.1 0 0 5 0.2 0 0.2 0.2 0 0 3 0.06 0 0 0 0 0 4 0.06 0 0.1 0.1 0 0 Sum 0.27 0.09 0.16 0.16 0.09 0.09 A C 1 2 3 4 5 6 1 0.09 0 0 0 0 0 2 0.06 0.09 0.06 0.06 0.09 0.09 C BA Person 1 of group C has the highest probability of being infected.