Skip to content
Prev 197442 / 398500 Next

LDA Precdict - Seems to be predicting on the Training Data

This is not an explanation but it gives you a solution,

Instead of using lda with a formula do it by giving the variables and the 
classification factor as arguments, base on your example and data:



outOfSample <- myDat[11:16,]

train <- myDat[1:10,]

outOfSample <- outOfSample[,3:5]

train2 <- train[,3:5]

fit <- lda(train2,train$c1)

forecast <- predict(fit,outOfSample)$class

length(forecast)

[1] 6



Seems that the problem arise when predict.lda works on lda fit applied to a 
formula class object.



Hope this help,

Gabriela.



______________________________
Lic. Mar?a Gabriela Cendoya
Mag?ster en Biometr?a
Profesor Adjunto
C?tedra de Estad?stica y Dise?o
Facultad de Ciencias Agrarias
Universidad Nacional de Mar del Plata
______________________________

----- Original Message ----- 
From: "BostonR" <dpope at capitaliq.com>
To: <r-help at r-project.org>
Sent: Tuesday, October 20, 2009 11:31 AM
Subject: [R] LDA Precdict - Seems to be predicting on the Training Data
___________________________________________________________________________

Aviso:
=====

El contenido del presente e-mail y sus posibles adjuntos pertenecen al INTA y pueden contener informaci?n confidencial. Si usted no es el destinatario original de este mensaje y por este medio pudo acceder a dicha informaci?n, por favor solicitamos contactar al remitente y eliminar el mensaje de inmediato. Se encuentra prohibida la divulgaci?n, copia, distribuci?n o cualquier otro uso de la informaci?n contenida en el presente e-mail por parte de personas distintas al destinatario. 


This e-mail contents and its possible attachments belong to INTA and may contain confidential information. If this message was not originally addressed to you, but you have accessed to such information by this means, please contact the sender and eliminate this message immediately. Circulation, copy, distribution, or any other use of the information contained in this e-mail is not allowed on part of those different from the addressee.


Antes de imprimir este mensaje, aseg?rese de que sea necesario. Proteger el medio ambiente est? tambi?n en su mano.