[R] ipred and lda

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jan 9 17:19:34 CET 2004


On 9 Jan 2004, Stefan Böhringer wrote:

> can anybody help me with the program below? The function predict.lda
> seems to be defined but cannot be used by errortest.

Precisely.  You should not be calling a method directly and in any case
that is not what is needed here.  ?errorest shows you a correct example,
so why not follow it?

> The R version is 1.7.1

You are overdue for an update then.  See what the posting guide asks you
to do if you find a problem and are not using the current version.

> 
> Thanks in advance,
> 
> 	Stefan
> 
> ----------------
> library("MASS");
> library("ipred");
> 
> data(iris3);
> tr <- sample(1:50, 25);
> train <- rbind(iris3[tr,,1], iris3[tr,,2], iris3[tr,,3]);
> test <- rbind(iris3[-tr,,1], iris3[-tr,,2], iris3[-tr,,3]);
> cl <- factor(c(rep("s",25), rep("c",25), rep("v",25)));
> z <- lda(train, cl);
> predict(z, test)$class;
> 
> data.frame(class=cl, train);
> flowers <- data.frame(class=cl, train);
> errorest(class ~ ., data=flowers, model=lda, estimator="cv",
> predict=predict.lda);
> 
> Error-Message is :
> Error: Object "predict.lda" not found
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list