[R] lda
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Nov 2 22:16:49 CET 2004
On Tue, 2 Nov 2004, T. Murlidharan Nair wrote:
> Hi !!
> I am trying to analyze some of my data using linear discriminant analysis.
> I worked out the following example code in Venables and Ripley
> It does not seem to be happy with it.
What is `it'? If you mean R, which version, and which version of the VR
bundle?
> ============================
> library(MASS)
> library(stats)
That line is definitely not in `Venables and Ripley'
> data(iris3)
> ir<-rbind(iris3[,,1],iris3[,,2],iris3[,,3])
> ir.species<-factor(c(rep("s",50),rep("c",50),rep("v",50)))
> ir.lda<-lda(log(ir),ir.species)
> ir.ld<-predict(ir.lda,dimen=2)$x
> eqscplot(ir.ld, type="n", xlab = "First linear discriminant", ylab =
> "second linear discriminant")
> text(ir.ld, labels= as.character(ir.species[-143]), col =3
> +codes(ir.species),cex =0.8)
>
> ======================================
>
>
> eqscplot does not plot anything and it gives me an error
> saying codes is defunct. Have I missed anything there.
I have no idea why eqscplot is misbehaving (your example works up to the
last line for me), but the R scripts which the book refers you to do work.
See p.12 (and the R posting guide asking you to read the relevant section
of the book).
--
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
More information about the R-help
mailing list