Learn R Programming

SYNCSA (version 1.3.4)

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

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

pca(data)

# S3 method for 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.

See Also

syncsa syncsa

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab