[R] discriminant analysis lda under MASS

Jens Koch Jens.Koch at gmx.li
Wed Mar 2 16:19:21 CET 2016


Hello all,

I'd like to run a simple discriminant analysis to jump into the topic with the following dataset provided by a textbook:

Gruppe Einwohner Kosten
1 1642 478,2
1 2418 247,3
1 1417 223,6
1 2761 505,6
1 3991 399,3
1 2500 276
1 6261 542,5
1 3260 308,9
1 2516 453,6
1 4451 430,2
1 3504 413,8
1 5431 379,7
1 3523 400,5
1 5471 404,1
2 7172 499,4
2 9419 674,9
2 8780 468,6
2 5070 601,5
2 5780 578,8
2 8630 641,5

The coefficients according to the textbook need to be -0.00170 and -0.01237.

If I put the data into the lda function under MASS, my result is:

Call:
lda(Gruppe ~ Einwohner + Kosten, data = data)

Prior probabilities of groups:
  1   2
0.7 0.3

Group means:
  Einwohner   Kosten
1  3510.429 390.2357
2  7475.167 577.4500

Coefficients of linear discriminants:
                   LD1
Einwohner 0.0004751092
Kosten    0.0050994964

I also tried to solve it by an another software package, but there is also not the result I have expected. I know now, that the solution for the coefficients is standardized by R and the discrimination power is not different at the end of the day.

But: How can I get (calculate) the results printed in the textbook with R?

Thanks in advance,

Jens.



More information about the R-help mailing list