pca: Principal Components Analysis (PCA) with NA (missing data)

Description Usage Arguments Value Author(s) See Also Examples

View source: R/pca.R

Description

The function use the option "pairwise.complete.obs" (in function cor) for calculate the correlation. The correlation between each pair of variables is computed using all complete pairs of observations on those variables.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
pca(data)

## S3 method for class 'pcasyncsa'
plot(
  x,
  show = c("variables", "individuals"),
  axis = c(1, 2),
  xlab = axis[1],
  ylab = axis[2],
  arrows = TRUE,
  text = TRUE,
  points = FALSE,
  ...
)

Arguments

data

A data frame or matrix with individuals in rows and variables in columns.

x

A object of class pcasyncsa.

show

Draw "variables" or "individuals".

axis

Axis for draw, must have length equal to two (Default axis = c(1, 2)).

xlab

Text for x label (Default xlab = axis[1]).

ylab

Text for y label (Default ylab = axis[2]).

arrows

Logical argument (TRUE or FALSE) to specify if arrows are showed for variables (Default arrows = TRUE).

text

Logical argument (TRUE or FALSE) to specify if text are showed for individuals (Default text = TRUE).

points

Logical argument (TRUE or FALSE) to specify if points are showed for individuals (Default points = FALSE).

...

Parameters for plot function.

Value

decomposition

list with the results of decomposition of correlation matrix.

eigenvalues

Data frame containing all the eigenvalues, the percentage of inertia and the cumulative percentage of inertia.

individuals

Coordinates for the individuals.

variables

Correlation between original variables and axes.

Author(s)

Vanderlei Julio Debastiani <vanderleidebastiani@yahoo.com.br>

See Also

syncsa syncsa

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(ADRS)
traits<-ADRS$traits
# Some NA
traits[c(1,5),1]<-NA
traits[3,2]<-NA
traits
res<-pca(traits)
res
plot(res, show = "variables", arrows = TRUE)
plot(res, show = "individuals", axis = c(1, 2), text = TRUE)
plot(res, show = "individuals", text = FALSE, points = TRUE)

SYNCSA documentation built on Jan. 11, 2020, 9:26 a.m.

Related to pca in SYNCSA...