mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 20:02:04 +02:00
(v1.0.1.9002) PCA unit tests
This commit is contained in:
@ -79,7 +79,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9001</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9002</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -236,14 +236,15 @@
|
||||
<span class='no'>x</span>,
|
||||
<span class='kw'>choices</span> <span class='kw'>=</span> <span class='fl'>1</span>:<span class='fl'>2</span>,
|
||||
<span class='kw'>scale</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
|
||||
<span class='kw'>pc.biplot</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
|
||||
<span class='kw'>labels</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
|
||||
<span class='kw'>labels_textsize</span> <span class='kw'>=</span> <span class='fl'>3</span>,
|
||||
<span class='kw'>labels_text_placement</span> <span class='kw'>=</span> <span class='fl'>1.5</span>,
|
||||
<span class='kw'>groups</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
|
||||
<span class='kw'>ellipse</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
|
||||
<span class='kw'>ellipse</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
|
||||
<span class='kw'>ellipse_prob</span> <span class='kw'>=</span> <span class='fl'>0.68</span>,
|
||||
<span class='kw'>ellipse_size</span> <span class='kw'>=</span> <span class='fl'>0.5</span>,
|
||||
<span class='kw'>ellipse_alpha</span> <span class='kw'>=</span> <span class='fl'>0.25</span>,
|
||||
<span class='kw'>ellipse_alpha</span> <span class='kw'>=</span> <span class='fl'>0.5</span>,
|
||||
<span class='kw'>points_size</span> <span class='kw'>=</span> <span class='fl'>2</span>,
|
||||
<span class='kw'>points_alpha</span> <span class='kw'>=</span> <span class='fl'>0.25</span>,
|
||||
<span class='kw'>arrows</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
|
||||
@ -275,6 +276,14 @@
|
||||
<code><a href='https://rdrr.io/r/stats/princomp.html'>princomp</a></code>. Normally <code>0 <= scale <= 1</code>, and a warning
|
||||
will be issued if the specified <code>scale</code> is outside this range.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>pc.biplot</th>
|
||||
<td><p>If true, use what Gabriel (1971) refers to as a "principal component
|
||||
biplot", with <code>lambda = 1</code> and observations scaled up by sqrt(n) and
|
||||
variables scaled down by sqrt(n). Then inner products between
|
||||
variables approximate covariances and distances between observations
|
||||
approximate Mahalanobis distance.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>labels</th>
|
||||
<td><p>an optional vector of labels for the observations. If set, the labels will be placed below their respective points. When using the <code><a href='pca.html'>pca()</a></code> function as input for <code>x</code>, this will be determined automatically based on the attribute <code>non_numeric_cols</code>, see <code><a href='pca.html'>pca()</a></code>.</p></td>
|
||||
@ -352,13 +361,13 @@
|
||||
<li><p>Rewritten code to remove the dependency on packages <code>plyr</code>, <code>scales</code> and <code>grid</code></p></li>
|
||||
<li><p>Parametrised more options, like arrow and ellipse settings</p></li>
|
||||
<li><p>Added total amount of explained variance as a caption in the plot</p></li>
|
||||
<li><p>Cleaned all syntax based on the <code>lintr</code> package</p></li>
|
||||
<li><p>Cleaned all syntax based on the <code>lintr</code> package and added integrity checks</p></li>
|
||||
<li><p>Updated documentation</p></li>
|
||||
</ol>
|
||||
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>The default colours for labels and points is set with <code>scale_colour_viridis_d()</code>, but these can be changed by adding another scale for colour, like <code>scale_colour_brewer()</code>.</p>
|
||||
<p>The colours for labels and points can be changed by adding another scale layer for colour, like <code>scale_colour_viridis_d()</code> or <code>scale_colour_brewer()</code>.</p>
|
||||
<h2 class="hasAnchor" id="maturing-lifecycle"><a class="anchor" href="#maturing-lifecycle"></a>Maturing lifecycle</h2>
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9001</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9002</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -403,7 +403,7 @@
|
||||
</tr><tr>
|
||||
|
||||
<td>
|
||||
<p><code><a href="pca.html">prcomp(<i><data.frame></i>)</a></code> <code><a href="pca.html">pca()</a></code> </p>
|
||||
<p><code><a href="pca.html">pca()</a></code> </p>
|
||||
</td>
|
||||
<td><p>Principal Component Analysis (for AMR)</p></td>
|
||||
</tr><tr>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Principal Component Analysis (for AMR) — prcomp.data.frame • AMR (for R)</title>
|
||||
<title>Principal Component Analysis (for AMR) — pca • AMR (for R)</title>
|
||||
|
||||
<!-- favicons -->
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
|
||||
@ -44,8 +44,8 @@
|
||||
<link href="../extra.css" rel="stylesheet">
|
||||
<script src="../extra.js"></script>
|
||||
|
||||
<meta property="og:title" content="Principal Component Analysis (for AMR) — prcomp.data.frame" />
|
||||
<meta property="og:description" content="Performs a principal component analysis (PCA) based on a data set with automatic determination for afterwards plotting the groups and labels." />
|
||||
<meta property="og:title" content="Principal Component Analysis (for AMR) — pca" />
|
||||
<meta property="og:description" content="Performs a principal component analysis (PCA) based on a data set with automatic determination for afterwards plotting the groups and labels, and automatic filtering on only suitable (i.e. non-empty and numeric) variables." />
|
||||
<meta property="og:image" content="https://msberends.gitlab.io/AMR/logo.png" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
|
||||
@ -79,7 +79,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="../index.html">AMR (for R)</a>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9000</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9002</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -229,11 +229,10 @@
|
||||
</div>
|
||||
|
||||
<div class="ref-description">
|
||||
<p>Performs a principal component analysis (PCA) based on a data set with automatic determination for afterwards plotting the groups and labels.</p>
|
||||
<p>Performs a principal component analysis (PCA) based on a data set with automatic determination for afterwards plotting the groups and labels, and automatic filtering on only suitable (i.e. non-empty and numeric) variables.</p>
|
||||
</div>
|
||||
|
||||
<pre class="usage"><span class='co'># S3 method for data.frame</span>
|
||||
<span class='fu'><a href='https://rdrr.io/r/stats/prcomp.html'>prcomp</a></span>(
|
||||
<pre class="usage"><span class='fu'>pca</span>(
|
||||
<span class='no'>x</span>,
|
||||
<span class='no'>...</span>,
|
||||
<span class='kw'>retx</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
|
||||
@ -241,9 +240,7 @@
|
||||
<span class='kw'>scale.</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>,
|
||||
<span class='kw'>tol</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
|
||||
<span class='kw'>rank.</span> <span class='kw'>=</span> <span class='kw'>NULL</span>
|
||||
)
|
||||
|
||||
<span class='fu'>pca</span>(<span class='no'>x</span>, <span class='no'>...</span>)</pre>
|
||||
)</pre>
|
||||
|
||||
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
|
||||
<table class="ref-arguments">
|
||||
@ -297,10 +294,13 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
|
||||
|
||||
<p>An object of classes pca and <a href='https://rdrr.io/r/stats/prcomp.html'>prcomp</a></p>
|
||||
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
|
||||
|
||||
<p>The <code>pca()</code> function takes a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> as input and performs the actual PCA with the R function <code><a href='https://rdrr.io/r/stats/prcomp.html'>prcomp()</a></code>.</p>
|
||||
<p>The result of the <code>pca()</code> function is a <code><a href='https://rdrr.io/r/stats/prcomp.html'>prcomp</a></code> object, with an additional attribute <code>non_numeric_cols</code> which is a vector with the column names of all columns that do not contain numeric values. These are probably the groups and labels, and will be used by <code><a href='ggplot_pca.html'>ggplot_pca()</a></code>.</p>
|
||||
<p>The <code>pca()</code> function takes a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> as input and performs the actual PCA with the <span style="R">R</span> function <code><a href='https://rdrr.io/r/stats/prcomp.html'>prcomp()</a></code>.</p>
|
||||
<p>The result of the <code>pca()</code> function is a <a href='https://rdrr.io/r/stats/prcomp.html'>prcomp</a> object, with an additional attribute <code>non_numeric_cols</code> which is a vector with the column names of all columns that do not contain numeric values. These are probably the groups and labels, and will be used by <code><a href='ggplot_pca.html'>ggplot_pca()</a></code>.</p>
|
||||
<h2 class="hasAnchor" id="experimental-lifecycle"><a class="anchor" href="#experimental-lifecycle"></a>Experimental lifecycle</h2>
|
||||
|
||||
|
||||
@ -332,6 +332,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>experimen
|
||||
<h2>Contents</h2>
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li><a href="#arguments">Arguments</a></li>
|
||||
<li><a href="#value">Value</a></li>
|
||||
<li><a href="#details">Details</a></li>
|
||||
<li><a href="#experimental-lifecycle">Experimental lifecycle</a></li>
|
||||
<li><a href="#examples">Examples</a></li>
|
||||
|
Reference in New Issue
Block a user