# Follow-up: [R] Fisher LDA and prior=c(...) argument

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon May 19 08:28:28 CEST 2003

```MASS the package provides suport for MASS the book.  See the latter for
the details, also my book

Ripley, B. D. (1996) Pattern Recognition and Neural Networks. CUP

which explains leave-one-out CV and has the formulae.

Someone else mention n-fold CV.  That, including S code and examples, is
in the MASS book and its scripts are in the MASS package.

Please do not ignore the DESCRIPTION files of a package:
library(help=MASS) says

Description:

Package: MASS
Description: The main library.
Title: Main Library of Venables and Ripley's MASS
...
BundleDescription: Various functions from the software of Venables and
Ripley, `Modern Applied Statistics with S' (4th edition).

On Sun, 18 May 2003, Edoardo M Airoldi wrote:

> hello,
>  a clarification.
>
>   I am using LDA and QDA function of MASS library.  I understand Fisher
> LDA is a method non-probabilistic in nature, so I wonder what happens when

Who mentioned Fisher LDA?  Fisher is not mentioned on the help page, and
what is usually called LDA is not due to Fisher.

> I try to predict my test set examples as in:
>
> > fit <- lda(labels~., data=train.table, prior=c(.5,.5))
> > pred <- predict(fit, data=test.table, prior=c(.5,.5))
>
>   Specifically I ask this because in my problem there are 700 examples
> class A, and 50 in class B, and I'd be glad to use a way to weight the
> contribution of the examples in different classes (in the prediction
> stage for LDA I guess)
>
>   My guess is that the CODE above estimates the likelihood of 'the
> projection of the data onto the canonical variate' (only one with 2
> classes) as in:  P(example | class=.)  and then implements the Bayes
> rule to return the maximum a-posteriori class, using the estimated
> likelihood and the given prior=c(...)
>
>   Is that correct?  Any pointer towards the understanding is appreciated.
>
>   Further any pointer towards an example that uses the argument CV=TRUE is
> also appreciated, since i was not able (apparently) to get any change by
> setting it to TRUE  =:-)
>
> Edoardo M. Airoldi
> http://www.stat.cmu.edu/~eairoldi
> BH 232L  (412) 268.7829
> PC Lab   (412) 268.8719
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

```