Well, I figured it out on my own. It turns out, even though my test set
of data appeared to be a matrix, it wasn't. Adding "as.matrix" to
the
front of the name of the data set solved the problem. (Maybe there's some
alternative way of doing it, such as yours?) Thanks for your suggestion.
Stewart
On Thu, 26 Aug 2004, Liaw, Andy wrote:
> What version of R, what version of pls.pcr, and on what OS? Have you
> checked whether your versions of software are up to date? I get:
>
> > n <- 1350
> > p <- 180
> > y <- rnorm(n)
> > x <- matrix(sample(0:1, n*p, replace=TRUE), n, p)
> > fit <- mvr(x, y, method="SIMPLS",
validat="none", ncomp=2)
> > xt <- matrix(sample(0:1, 312*p, replace=TRUE), 312, p)
> > yt <- predict(fit, xt)
>
>
> Andy
>
> > From: Stewart T Chang
> >
> > Greetings,
> >
> > I've encountered an error message while using the pls.pcr package
> > that's left me scratching my head for a couple of hours, and
> > I thought I
> > might post it here in the hopes that someone else uses this package.
> > Using a data set of 1350 observations (each observation comprises 180
> > predictor variables and 1 output variable), I trained a model using
> > pls.pcr. (Other details: ncomp=2,
> > method="SIMPLS",validation="none". I
> > might also add that each predictor variable has a value of
> > either 0 or 1,
> > though the output variable is a real number.)
> > '
> > When I tried to use this model to make predictions (on 312 sets of 180
> > predictor variables), I received the following error:
> >
> > Error in X %*% object$training$B[, , index, drop = TRUE] :
> > requires numeric matrix/vector arguments
> >
> > Normally I'd ask a friend of mine in Biostatistics here to
> > help me out,
> > but he's currently away! Have any of you used pls.pcr and gotten
this
> > kind of message? Thanks!
> >
> > Stewart
> >
> > ______________________________________________
> > 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
> >
> >
>
>
>
------------------------------------------------------------------------------
> Notice: This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
Jersey, USA 08889), and/or its affiliates (which may be known outside the United
States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu)
that may be confidential, proprietary copyrighted and/or legally privileged. It
is intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this message
in error, please notify us immediately by reply e-mail and then delete it from
your system.
>
------------------------------------------------------------------------------
>
>
>