⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 predict.mvr.rd

📁 做主成分回归和偏最小二乘回归
💻 RD
字号:
%% $Id: predict.mvr.Rd 99 2006-10-04 10:54:35Z bhm $\encoding{latin1}\name{predict.mvr}\alias{predict.mvr}\title{Predict Method for PLSR and PCR}\description{  Prediction for mvr (PCR, PLSR) models.  New responses or scores are  predicted using a fitted model and a new matrix of observations.}\usage{\method{predict}{mvr}(object, newdata, ncomp = 1:object$ncomp, comps,        type = c("response", "scores"), na.action = na.pass, \dots)}\arguments{  \item{object}{an \code{mvr} object.  The fitted model}  \item{newdata}{a data frame.  The new data.  If missing, the training    data is used.}  \item{ncomp, comps}{vector of positive integers.  The components to use in    the prediction.  See below.}  \item{type}{character.  Whether to predict scores or response values}  \item{na.action}{function determining what should be done with missing    values in \code{newdata}.  The default is to predict \code{NA}.  See    \code{\link{na.omit}} for alternatives.}  \item{\dots}{further arguments.  Currently not used}}\details{  When \code{type} is \code{"response"} (default), predicted response  values are returned.  If \code{comps} is missing (or is \code{NULL}),  predictions for \code{length(ncomp)} models with \code{ncomp[1]}  components, \code{ncomp[2]} components, etc., are returned.  Otherwise, predictions for a single model with the exact components in  \code{comps} are returned.  (Note that in both cases, the intercept is  always included in the predictions.  It can be removed by subtracting  the \code{Ymeans} component of the fitted model.)  When \code{type} is \code{"scores"}, predicted score values are  returned for the components given in \code{comps}.  If \code{comps} is  missing or \code{NULL}, \code{ncomps} is used instead.  It is also possible to supply a matrix instead of a data frame as  \code{newdata}, which is then assumed to be the \eqn{X} data matrix.  Note that the usual checks for the type of the data are then  omitted.  Also note that this is  \emph{only} possible with \code{predict}; it will not work in  functions like \code{\link{predplot}}, \code{\link{RMSEP}} or  \code{\link{R2}}, because they also need the response variable of the new  data.}\value{  When \code{type} is \code{"response"}, a three dimensional array of  predicted response values is returned.  The dimensions correspond to  the observations, the response variables and the model sizes,  respectively.  When \code{type} is \code{"scores"}, a score matrix is returned.}\note{  A warning message like \samp{'newdata' had 10 rows but variable(s)    found have 106 rows} means that not all variables were found in the  \code{newdata} data frame.  This (usually) happens if the formula  contains terms like \code{yarn$NIR}.  Do not use such terms; use the  \code{data} argument instead.  See \code{\link{mvr}} for details. }\author{Ron Wehrens and Bj鴕n-Helge Mevik}\seealso{\code{\link{mvr}}, \code{\link{summary.mvr}},  \code{\link{coef.mvr}}, \code{\link{plot.mvr}}}\examples{data(yarn)nir.mvr <- mvr(density ~ NIR, ncomp = 5, data = yarn[yarn$train,])## Predicted responses for models with 1, 2, 3 and 4 componentspred.resp <- predict(nir.mvr, ncomp = 1:4, newdata = yarn[!yarn$train,])## Predicted responses for a single model with components 1, 2, 3, 4predict(nir.mvr, comps = 1:4, newdata = yarn[!yarn$train,])## Predicted scorespredict(nir.mvr, comps = 1:3, type = "scores", newdata = yarn[!yarn$train,])}\keyword{regression}\keyword{multivariate}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -