pca.biplot: pca.biplot

Description Usage Arguments Examples

View source: R/pca.biplot.R

Description

A customizable correlational biplot function. PC's are scaled to unit variance.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
pca.biplot(
  data,
  center = TRUE,
  scale = FALSE,
  pcx = 1,
  pcy = 2,
  groups = 1,
  col = NULL,
  pch = 1,
  ellipse = FALSE,
  ellipse.alpha = 0.2,
  ellipse.conf = 0.68,
  ellipse.lwd = 2,
  arrow.options,
  label.options,
  abbrev = FALSE,
  circle = TRUE,
  circle.options,
  legend = TRUE,
  legend.pos = "bottomleft",
  ...
)

Arguments

data

The data used to build the biplot

center

Column centering the data (default = TRUE). If center is TRUE then centering is done by subtracting the column means (omitting NA's) of x from their corresponding columns, and if center is FALSE, no centering is done.

scale

Scaling the data (default = FALSE). If scale is TRUE then scaling is done by dividing the (centered) columns of x by their standard deviations if center is TRUE, and the root mean square otherwise. If scale is FALSE, no scaling is done.

pcx

Which principal component to plot on the X-axis (default = 1)

pcy

Which principal component to plot on the Y-axis (default = 2)

groups

A vector from which the unique values are used to color the observations

col

Vector of colors, to color observations. Needs to be equal to the number of unique values of groups variable. If no groups is defined then all points will have the defined color.

pch

Either an integer specifying a symbol or a single character to be used as the default in plotting points. See points for possible values and their interpretation.

ellipse

Whether to add confidence ellipses to the different groups

ellipse.alpha

Alpha transparency value for the fill color (0 = transparent, 1 = opaque)

ellipse.conf

Confidence limit for ellipses, e.g. 0.68. If given, the corresponding sd or se is multiplied with the corresponding value found from the Chi-squared distribution with 2df.

ellipse.lwd

Line width of ellipse border

arrow.options

List to define options for the variable arrows (for all options see arrows ). Needs to be defined as a list, e.g. arrows.options = list(angle = 0.15, col = "blue"), errors could occur if a vector is used.

label.options

List to define options for the variable labels (for all options see text ). Needs to be defined as a list, e.g. label.options = list(cex = 1.2, col = "red"), errors could occur if a vector is used.

abbrev

Whether to abbreviate the variable names

circle

Whether to add a unit circle. Only applies if data is scaled!

circle.options

List to define options for the unit circle (for all options see polygon ). Needs to be defined as a list, e.g. circle.options = list(lty = "dashed", col = "grey"), errors could occur if a vector is used.

legend

Whether to add a legend

legend.pos

Position of the legend

...

Other graphical parameters, see plot for more details.

Examples

1
2
3
4
5
6
  data(iris)
  pca.biplot(iris[1:4])
  pca.biplot(iris[,-5], col = c("#00AFBB", "#E7B800", "#FC4E07"), groups = iris$Species, 
       legend = F, arrow.options = list(col="blue", angle = 20, length = 0.15))
  pca.biplot(iris[,-5], scale = T, col = c("#00AFBB", "#E7B800", "#FC4E07"), groups = iris$Species, 
       ellipse = T, pch = 16, legend.pos = 'topright')

StefaanVerwimp/Biplot documentation built on Feb. 10, 2021, 9:37 a.m.