I have just tried two ways to perform a linear discriminant analysis.

Mode 1

This is the data, divided in two tables (printed from screen using R commander): enter image description here enter image description here

They belong respectively to the two already known groups.

I ran the next code to get the coefficients and critic value of the function:

d # Estos son los coeficientes de la función
0.5*t(m1+m2)%*%d # Este es el punto crítico

I get the next results:

> d # Coefficients of the discriminant analysis
x1 -0.089306662
x2  0.155774683
x3  0.005231617
x4 -0.177194601
x5 -0.177408670

> 0.5*t(m1+m2)%*%d # Este es el punto crítico
[1,] -30.46349

These results are exactly the same as those ones that appeared in a book I am studying.

Mode 2

I reordered the last two tables into only one with the first column as a factor: enter image description here

In this case, I used the function lda (from the package MASS), since it has been widely used in examples on internet.

I ran the next command:


Which displayed the next results:

> lda(group~.,data=Datos)
lda(group ~ ., data = Datos)

Prior probabilities of groups:
 0.53125  0.46875 

Group means:
               X1       X2       X3       X4       X5
CRANEOS1 174.8235 139.3529 132.0000 69.82353 130.3529
CRANEOS2 185.7333 138.7333 134.7667 76.46667 137.5000

Coefficients of linear discriminants:
X1  0.047726591
X2 -0.083247929
X3 -0.002795841
X4  0.094695000
X5  0.094809401

My questions are:

Is there anything wrong in the code displayed above?

Why are the both coefficients different depending on the mode used?

Which of them must be more reliable?

How can I get the critic value using the Mode 2?

  • $\begingroup$ Looks like the coefficients are actually identical, up to a constant factor. $\endgroup$ – amoeba says Reinstate Monica Mar 5 '15 at 12:00
  • $\begingroup$ Actually, they seem to be the same. However they're not. I have also tried with different data and their values are clearly different, much wider than those ones exposed in this example... $\endgroup$ – antecessor Mar 5 '15 at 12:03
  • $\begingroup$ They are identical, up to a constant factor -1.8712. $\endgroup$ – amoeba says Reinstate Monica Mar 5 '15 at 12:05
  • $\begingroup$ Oh, I see. And how can this difference be achieved comparing both methods? $\endgroup$ – antecessor Mar 5 '15 at 12:19
  • $\begingroup$ The length of the discriminant vector is essentially arbitrary and does not matter. Perhaps your own algorithm and lda() function use different normalizations. $\endgroup$ – amoeba says Reinstate Monica Mar 5 '15 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.