Hi all,
I obtained a strage result with LDA (MASS) function in R with NIR data.
I tried both CV (leave one out cross validation) and splitting my data in
odd (training) and even (prediction) sets.
In all the cases the minimum error was near to 0.

Due to the strange result, I tried with SPSS IBM software and it give me
around 11% of minimum error with and without leave one out cross validation.

Maybe the problem is a my error in my script?

Someone can check it pls?

data <- "data\\raw_data.csv"

r <- read.csv(data, header = T)
sound <- r[1:844,]
unsound <- r[845:2195,]

even_s <- seq(nrow(sound)) %% 2
even_u <- seq(nrow(unsound)) %% 2 
t <- rbind(sound[even_s == 1,], unsound[even_u == 1,])
p <- rbind(sound[even_s != 1,], unsound[even_u != 1,])

fit <- lda(samples ~., data = t)
ct <- table(p[, 1], predict(fit, p[,-1])$class)
errors <- 1-diag(prop.table(ct, 1))
min.err <- 1-sum(diag(prop.table(ct)))

fit_cv <- lda(samples ~., data = r, CV =T)
ct_cv <- table(r[,1], fit_cv$class)
errors_cv <- 1-diag(prop.table(ct_cv, 1))
min.err_cv <- 1-sum(diag(prop.table(ct_cv)))

thank you for your help!

Best regards,
Roberto



--
View this message in context: 
http://r.789695.n4.nabble.com/Different-results-between-lda-mass-and-spss-discriminant-analysis-tp4638763.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org 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.

Reply via email to