Re: [R] Linear Discriminant Analysis

From: Soare Marcian-Alin <soarealin_at_gmail.com>
Date: Wed, 06 Jun 2007 17:45:11 +0200

Thanks for explaining...

Im just sitting at the homework for 6 hours after taking for one week antibiotica, because i had an amygdalitis... I just wanted some tipps for solving this homework, but thanks, I will try to get help on another way :)

I think i solved it, but I still get this Error :(

## Loading Data
library(MASS)
olive <- url("
http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R") print(load(olive))
dim(olive)
summary(olive)

index <- sample(nrow(olive), 286)

train <- olive[index,-11]
test <- olive[-index,-11]

summary(train)
summary(test)

table(train$Region)
table(test$Region)

# Linear Discriminant Analysis
z <- lda(Region ~ . , train)
zn <- predict(z, newdata=test)$class
mean(zn != test$Region)

2007/6/6, Uwe Ligges <ligges_at_statistik.uni-dortmund.de>:
>
>
> 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.
>

-- 
Mit freundlichen Grüssen / Best Regards

Soare Marcian-Alin

	[[alternative HTML version deleted]]


______________________________________________ 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.

Received on Wed 06 Jun 2007 - 16:12:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 06 Jun 2007 - 19:31:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.