I don't really understand this. You seem willing only to reveal the bit of
the process where you are convinced the problem is. This may not be helpful if
the problem lies elsewhere.
I take it you are using the lda() function from MASS, though you don't say.
Let's look at a little example:
require(MASS)
fm <- lda(Species ~ ., iris)
nd <- iris[sample(150, 50),]
pfm <- predict(fm, nd)
This works fine for me. The result, pfm, is a list three components,
"class", "posterior" and "x", all of which look
entirely reasonable, and in particular have the right sizes.
So what are you doing, really?
Bill Venables
http://www.cmis.csiro.au/bill.venables/
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Gareth Campbell
Sent: Tuesday, 2 September 2008 9:19 AM
To: R Help
Subject: [R] LDA predictions
I've made an LDA model on some data from one source. I have some new data
that I want to see if I can "place" to the sources in the LDA model.
I used the predict function as follows:
predict(wak.insitu.ld, wak.alr.alluvial)
where wak.insitu.ld is an LDA model generated from some data and
wak.alr.alluvial is new data of similar origin. When I look at the results,
there is 86 observations which is the number in the original model, NOT in
the new data (nrow=53). Am I doing this correctly. When I plot the
predicted values, the plot is exactly the same as the original model plot.
Now I am certain it's not doing whata I thought it was.
thanks.
--
Gareth Campbell
PhD Candidate
The University of Auckland
P +649 815 3670
M +6421 256 3511
E gareth.campbell at esr.cri.nz
gcam032 at gmail.com
[[alternative HTML version deleted]]
______________________________________________
R-help at 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.