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

📄 predict.mvr.html

📁 应用程序 偏最小二乘法回归分析 pls matlab
💻 HTML
字号:
<html><head><title>R: Predict Method for PLSR and PCR</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>

<table width="100%" summary="page for predict.mvr {pls}"><tr><td>predict.mvr {pls}</td><td align="right">R Documentation</td></tr></table>
<h2>Predict Method for PLSR and PCR</h2>


<h3>Description</h3>

<p>
Prediction for mvr (PCR, PLSR) models.  New responses or scores are
predicted using a fitted model and a new matrix of observations.
</p>


<h3>Usage</h3>

<pre>
## S3 method for class 'mvr':
predict(object, newdata, comps = 1:object$ncomp,
        type = c("response", "scores"), cumulative = TRUE, ...)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>object</code></td>
<td>
an <code>mvr</code> object.  The fitted model</td></tr>
<tr valign="top"><td><code>newdata</code></td>
<td>
a data frame.  The new data.  If missing, the training
data is used.</td></tr>
<tr valign="top"><td><code>comps</code></td>
<td>
vector of positive integers.  The components to use in
the prediction.  See below.</td></tr>
<tr valign="top"><td><code>type</code></td>
<td>
character.  Whether to predict scores or response values</td></tr>
<tr valign="top"><td><code>cumulative</code></td>
<td>
logical.  How the elements of <code>comps</code> are
interpreted.  Ignored if <code>type</code> is <code>"scores"</code>.  See below</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
further arguments.  Currently not used</td></tr>
</table>

<h3>Details</h3>

<p>
When <code>type</code> is <code>"response"</code> (default), predicted response
values are returned.  If <code>cumulative</code> is <code>TRUE</code>, the
elements of <code>comps</code> are interpreted cumulatively,
i.e. predictions for models with <code>comps[1]</code> components,
<code>comps[2]</code> components, etc., are returned.  Otherwise, predicted
response values for a single model with the exact components in
<code>comps</code> are returned.
</p>
<p>
When <code>type</code> is <code>"scores"</code>, predicted score values are
returned for the components given in <code>comps</code>.
</p>
<p>
It is also possible to supply a matrix instead of a data frame as
<code>newdata</code>, which is then assumed to be the <i>X</i> data matrix.
Note that the usual checks for the size and type of the data are then
omitted.  Also note that this is
<EM>only</EM> possible with <code>predict</code>; it will not work in
functions like <code><a href="predplot.html">predplot</a></code>, <code><a href="MSEP.html">RMSEP</a></code> or
<code><a href="MSEP.html">R2</a></code>, because they also need the response variable of the new
data.
</p>


<h3>Value</h3>

<p>
When <code>type</code> is <code>"response"</code>, a three dimensional array of
predicted response values is returned.  The dimensions correspond to
the observations, the response variables and the model sizes,
respectively.
<br>
When <code>type</code> is <code>"scores"</code>, a score matrix is returned.</p>

<h3>Note</h3>

<p>
A warning message like <SAMP>'newdata' had 10 rows but variable(s)
found have 106 rows</SAMP> means that not all variables were found in the
<code>newdata</code> data frame.  This (usually) happens if the formula
contains terms like <code>NIR$X</code>.  Do not use such terms; use the
<code>data</code> argument instead.  See <code><a href="mvr.html">mvr</a></code> for details.
</p>


<h3>Author(s)</h3>

<p>
Ron Wehrens and Bj鴕n-Helge Mevik
</p>


<h3>See Also</h3>

<p>
<code><a href="mvr.html">mvr</a></code>, <code><a href="summary.mvr.html">summary.mvr</a></code>,
<code><a href="coef.mvr.html">coef.mvr</a></code>, <code><a href="plot.mvr.html">plot.mvr</a></code>
</p>


<h3>Examples</h3>

<pre>
data(NIR)
nir.mvr &lt;- mvr(y ~ X, ncomp = 5, data = NIR[NIR$train,])

## Predicted responses for models with 1, 2, 3 and 4 components
pred.resp &lt;- predict(nir.mvr, comps = 1:4, newdata = NIR[!NIR$train,])

## Predicted responses for a single model with components 1, 2, 3, 4
predict(nir.mvr, comps = 1:4, cumulative = FALSE, newdata = NIR[!NIR$train,])

## Predicted scores
predict(nir.mvr, comps = 1:3, type = "scores", newdata = NIR[!NIR$train,])
</pre>



<hr><div align="center">[Package <em>pls</em> version 1.1-0 <a href="00Index.html">Index]</a></div>

</body></html>

⌨️ 快捷键说明

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