📄 stdize.html
字号:
<html><head><title>R: Standardization of Data Matrices</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 stdize {pls}"><tr><td>stdize {pls}</td><td align="right">R Documentation</td></tr></table>
<h2>Standardization of Data Matrices</h2>
<h3>Description</h3>
<p>
Performs standardization (centering and scaling) of a data matrix.
</p>
<h3>Usage</h3>
<pre>
stdize(x, center = TRUE, scale = TRUE)
## S3 method for class 'stdized':
predict(object, newdata, ...)
## S3 method for class 'stdized':
makepredictcall(var, call)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>x, newdata</code></td>
<td>
numeric matrices. The data to standardize.</td></tr>
<tr valign="top"><td><code>center</code></td>
<td>
logical value or numeric vector of length equal to the
number of coloumns of <code>x</code>.</td></tr>
<tr valign="top"><td><code>scale</code></td>
<td>
logical value or numeric vector of length equal to the
number of coloumns of <code>x</code>.</td></tr>
<tr valign="top"><td><code>object</code></td>
<td>
an object inheriting from class <code>"stdized"</code>, normally
the result of a call to <code>stdize</code>.</td></tr>
<tr valign="top"><td><code>var</code></td>
<td>
A variable.</td></tr>
<tr valign="top"><td><code>call</code></td>
<td>
The term in the formula, as a call.</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
other arguments. Currently ignored.</td></tr>
</table>
<h3>Details</h3>
<p>
<code>makepredictcall.stdized</code> is an internal utility function; it is noe
meant for interactive use. See <code><a href="../../stats/html/makepredictcall.html">makepredictcall</a></code> for details.
</p>
<p>
If <code>center</code> is <code>TRUE</code>, <code>x</code> is centered by subtracting
the coloumn mean from each coloumn. If <code>center</code> is a numeric
vector, it is used in place of the coloumn means.
</p>
<p>
If <code>scale</code> is <code>TRUE</code>, <code>x</code> is scaled by dividing each
coloumn by its sample standard deviation. If <code>scale</code> is a
numeric vector, it is used in place of the standard deviations.
</p>
<h3>Value</h3>
<p>
Both <code>stdize</code> and <code>predict.stdized</code> return a scaled and/or
centered matrix, with attributes <code>"stdized:center"</code> and/or
<code>"stdized:scale"</code> the vector used for centering and/or scaling.
The matrix is given class <code>c("stdized", "matrix")</code>.</p>
<h3>Note</h3>
<p>
<code>stdize</code> is very similar to <code><a href="../../base/html/scale.html">scale</a></code>. The
difference is that when <code>scale = TRUE</code>, <code>stdize</code> divides the
coloumns by their standard deviation, while <code>scale</code> uses the
root-mean-square of the coloumns. If <code>center</code> is <code>TRUE</code>,
this is equivalent, but in general it is not.
</p>
<h3>Author(s)</h3>
<p>
Bj鴕n-Helge Mevik and Ron Wehrens
</p>
<h3>See Also</h3>
<p>
<code><a href="mvr.html">mvr</a></code>, <code><a href="mvr.html">pcr</a></code>, <code><a href="mvr.html">plsr</a></code>,
<code><a href="msc.html">msc</a></code>, <code><a href="../../base/html/scale.html">scale</a></code>
</p>
<h3>Examples</h3>
<pre>
data(NIR)
## Direct standardization:
Ztrain <- stdize(NIR$X[NIR$train,])
Ztest <- predict(Ztrain, NIR$X[!NIR$train,])
## Used in formula:
mod <- plsr(y ~ stdize(X), ncomp = 6, data = NIR[NIR$train,])
pred <- predict(mod, newdata = NIR[!NIR$train,]) # Automatically standardized
</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 + -