[R] discriminant analysis lda under MASS

David L Carlson dcarlson at tamu.edu
Thu Mar 3 15:08:19 CET 2016


If the textbook provides the equations, you can work through them directly. But without knowing more, it is hard to say. You could also contact the author of the textbook.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352


-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Jens Koch
Sent: Wednesday, March 2, 2016 9:19 AM
To: r-help at r-project.org
Subject: [R] discriminant analysis lda under MASS

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.

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


More information about the R-help mailing list