| utils_pca | R Documentation |
pca() Computes a Principal Component Analysis. It wrappers
stats::prcomp(), but returns more results such as data, scores,
contributions and quality of measurements for individuals and variables.
get_biplot(): Produces a biplot for an object computed with pca().
plot.pca(): Produces several types of plots, depending on the type and which
arguments.
type = "var" Produces a barplot with the contribution (which = "contrib"), qualitity of adjustment which = "cos2", and a scatter plot
with coordinates (which = "coord") for the variables.
type = "ind" Produces a barplot with the contribution (which = "contrib"), qualitity of adjustment which = "cos2", and a scatter plot
with coordinates (which = "coord") for the individuals.
type = "biplot" Produces a biplot.
pca(x, scale = TRUE)
get_biplot(
x,
axes = c(1, 2),
show = c("both"),
show_ind_id = TRUE,
show_unit_circle = TRUE,
expand = NULL
)
## S3 method for class 'pca'
plot(x, type = "var", which = "contrib", axis = 1, ...)
x |
|
scale |
A logical value indicating whether the variables should be
scaled to have unit variance before the analysis takes place. Defaults to
|
axes |
The principal component axes to plot. Defaults to |
show |
Which to show in the biplot. Defaults to |
show_ind_id |
Shows the labels for individuals? Defaults to |
show_unit_circle |
Shows the unit variance circle? Defaults to |
expand |
An expansion factor to apply when plotting the second set of
points relative to the first. This can be used to tweak the scaling of the
two sets to a physically comparable scale. Setting to |
type |
One of |
which |
Which measure to plot. Either |
axis |
The axist to plot the contribution/cos2. Defaults to 1. |
... |
Further arguments passed on to |
pca() returns a list including:
data: The raw data used to compute the PCA.
variances: Variances (eigenvalues), and proportion of explained
variance for each component.
center,scale: the centering and scaling used.
ind,var A list with the following objects for individuals/variables, respectively.
coord: coordinates for the individuals/variables (loadings * the
component standard deviations)
cos2: cos2 for the individuals/variables (coord^2)
contrib: The contribution (in percentage) of a variable to a given
principal component: (cos2 * 100) / (total cos2 of the component)
plot.pca() returns a list with the coordinates used.
get_biplot() returns a NULL object
library(pliman)
pc <- pca(mtcars[1:10 ,1:6])
plot(pc)
plot(pc, type = "ind")
plot(pc, type = "var", which = "coord")
plot(pc, type = "ind", which = "coord")
plot(pc, type = "biplot")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.