title: Performing Linear Discriminant Analysis (LDA) with Morphological Data
body: <p>I have a bunch of morphological data which I collected using the package <code>geomorph</code>. These data look like this:</p>
  
  <p>259 matrices (one file per individual)  with <code>x</code> and <code>y</code> coordinates (in columns) of 20 landmarks.</p>
  
  <pre><code>           [,1]         [,2]
   [1,] -0.2820496783 -0.003257662
   [2,] -0.2501083238  0.020960228
   [3,] -0.2250506399  0.049100368
   [4,] -0.2015860633  0.024673340
   [5,] -0.2246826220  0.001103431
   [6,] -0.0750488845  0.133714363
   [7,]  0.0006292017  0.133626261
   [8,]  0.0679419574  0.117149206
   [9,]  0.1239612670  0.097834963
  [10,]  0.2008532330  0.063564419
  [11,]  0.2763894852  0.026529132
  [12,]  0.3606700636  0.038228394
  [13,]  0.3665535317 -0.065490660
  [14,]  0.2728682794 -0.086504965
  [15,]  0.1113276708 -0.147876722
  [16,] -0.0742222455 -0.158015857
  [17,] -0.0746248649 -0.117267412
  [18,] -0.0775485339 -0.055400903
  [19,] -0.1122735300  0.041616289
  [20,] -0.1839993037 -0.114286212
  </code></pre>
  
  <p>The package <code>geomorph</code> contain tools to perform Principal Componant Analysis (PCA) but I don't think it contains anything for a Linear Discriminant Analysis (LDA). Or is there something?</p>
  
  <p>How can I perform a LDA on this kind of data?</p>
  
  <p>The solution might come from the package <code>geomorph</code> or from another package. One might as well be good enough to modify the functions from the <code>geomorph</code> package (the function <code>plotTangentSpace</code> for example. The functions of this package are usually not very long!) in order to create the function I need. Or maybe it is just a matter of transforming the data so that it is feasible with MASS:::lda (see discussion in the comments)  </p>
  
  <hr>
  
  <p><strong>Note:</strong></p>
  
  <p>I have 4 semi-landmarks (sliders) within the 20 landmarks listed above! Semi-landmarks are used to evaluate not a point position but a curve. Below is my matrix containing the informations for the semi-landmarks. This matrix is called <code>semi$sliders</code> and is used as an argument of the `gpagen function as shown below:</p>
  
  <pre><code>&gt; gpagen(3D_Array_With_All_Individuals, curves = semi$sliders, ShowPlot = T)
  
  &gt; semi$sliders
  
       [,1] [,2] [,3]
  [1,]    6    7    8
  [2,]    7    8    9
  [3,]    8    9   10
  [4,]    9   10   11
  </code></pre>
  
  <p><code>3D_Array_With_All_Individuals</code> is a 3D array where each layer is one of the 259 matrices.</p>