utils_pca {pliman}R Documentation

Utilities for Principal Component Axis analysis

Description

Usage

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, ...)

Arguments

x
  • For pca(), a numeric or complex matrix (or data frame) which provides the data for the principal components analysis.

  • For plot.pca() and get_biplot(), an object computed with pca().

scale

A logical value indicating whether the variables should be scaled to have unit variance before the analysis takes place. Defaults to TRUE.

axes

The principal component axes to plot. Defaults to axes = c(1, 2), i.e., the first and second interaction principal component axis.

show

Which to show in the biplot. Defaults to "both" (both variables and individuals). One can also use "var", or "ind".

show_ind_id

Shows the labels for individuals? Defaults to TRUE.

show_unit_circle

Shows the unit variance circle? Defaults to TRUE.

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 TRUE will automatically compute the expansion factor. Alternatively, a numeric value can be informed.

type

One of "var" (to plot variables), "ind" (to plot individuals), or "biplot" to create a biplot.

which

Which measure to plot. Either which = "contribution" (default), which = "cos2" (quality of representation), or which = "coord" (coordinates)

axis

The axist to plot the contribution/cos2. Defaults to 1.

...

Further arguments passed on to get_biplot() when type = "biplot". Otherwise, When which = "coord", further arguments passed on to get_biplot(). When which = "contrib", or which = "cos2" further arguments passed on to graphics::barplot().

Value

Examples

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")

[Package pliman version 2.1.0 Index]