[R] Linear Discriminant Analysis
Uwe Ligges
ligges at statistik.uni-dortmund.de
Wed Jun 6 17:39:46 CEST 2007
So what about asking your teacher (who seems to be Peter Filzmoser) and
try to find out your homework yourself?
You might want to think about some assumptions that must hold for LDA
and look at the class of your explaining variables ...
Uwe Ligges
Soare Marcian-Alin wrote:
> Hello,
>
> I want to make a linear discriminant analysis for the dataset olive, and I
> get always this error:#
> Warning message:
> variables are collinear in: lda.default(x, grouping, ...)
>
> ## Loading Data
> library(MASS)
> olive <- url("
> http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R")
> print(load(olive))
>
> y <- 1:572
> x <- sample(y)
> y1 <- x[1:286]
>
> train <- olive[y1,-11]
> test <- olive[-y1,-11]
>
> summary(train)
> summary(test)
>
> table(train$Region)
> table(test$Region)
>
> # Linear Discriminant Analysis
> z <- lda(Region ~ . , train)
> predict(z, train)
>
> z <- lda(Region ~ . , test)
> predict(z, test)
>
> Thanks in advance!
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> 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