pca | R Documentation |
Principal Component Analysis
pca(data, vars, nFactorMethod = "parallel", nFactors = 1,
minEigen = 1, rotation = "varimax", hideLoadings = 0.3,
sortLoadings = FALSE, screePlot = FALSE, eigen = FALSE,
factorCor = FALSE, factorSummary = FALSE, kmo = FALSE,
bartlett = FALSE)
data |
the data as a data frame |
vars |
a vector of strings naming the variables of interest in
|
nFactorMethod |
|
nFactors |
an integer (default: 1), the number of components in the model |
minEigen |
a number (default: 1), the minimal eigenvalue for a component to be included in the model |
rotation |
|
hideLoadings |
a number (default: 0.3), hide loadings below this value |
sortLoadings |
|
screePlot |
|
eigen |
|
factorCor |
|
factorSummary |
|
kmo |
|
bartlett |
|
A results object containing:
results$loadings | a table | ||||
results$factorStats$factorSummary | a table | ||||
results$factorStats$factorCor | a table | ||||
results$modelFit$fit | a table | ||||
results$assump$bartlett | a table | ||||
results$assump$kmo | a table | ||||
results$eigen$initEigen | a table | ||||
results$eigen$screePlot | an image | ||||
results$factorScoresOV | an output | ||||
Tables can be converted to data frames with asDF
or as.data.frame
. For example:
results$loadings$asDF
as.data.frame(results$loadings)
data('iris')
pca(iris, vars = vars(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width))
#
# PRINCIPAL COMPONENT ANALYSIS
#
# Component Loadings
# ----------------------------------------
# 1 Uniqueness
# ----------------------------------------
# Sepal.Length 0.890 0.2076
# Sepal.Width -0.460 0.7883
# Petal.Length 0.992 0.0168
# Petal.Width 0.965 0.0688
# ----------------------------------------
# Note. 'varimax' rotation was used
#
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.