elbowPlot: Elbow Plot for PCA (Plot)

Description Usage Arguments See Also Examples

View source: R/Plots.R

Description

Generate a plot of 10 first variances of Principal Components. This is useful to determinate which are the most important components.

Usage

1
elbowPlot(data.pca)

Arguments

data.pca

a list with class "prcomp" containing all principal components calculated.

See Also

CalculateVariance, plotPC

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#Example 1
iris.x <- iris[,1:4] # These are the independent variables
# We know that there are no missing values in the data set

# performing prcomp
ir.pca <- prcomp(iris.x, center = TRUE, scale. = TRUE)

# Generating elbow plot to detect the most important principal components
elbowPlot(ir.pca)


#Example 2
# Getting a clean data set (without missing values)
cars <- read.csv("https://dl.dropboxusercontent.com/u/12599702/autosclean.csv", sep = ";", dec = ",")
cars.x <- cars[,1:16] # These are the independent variables

# Performing prcomp
cars.pca <- prcomp(cars.x, center = TRUE, scale. = TRUE)

# Generating elbow plot to detect the most important principal components
elbowPlot(cars.pca)

mariytu/RegressionLibs documentation built on May 21, 2019, 11:47 a.m.