Learn R Programming

jmv (version 2.5.6)

pca: Principal Component Analysis

Description

Principal Component Analysis

Usage

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)

Value

A results object containing:

results$loadingsa table
results$factorStats$factorSummarya table
results$factorStats$factorCora table
results$modelFit$fita table
results$assump$bartletta table
results$assump$kmoa table
results$eigen$initEigena table
results$eigen$screePlotan image
results$factorScoresOVan output

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$loadings$asDF

as.data.frame(results$loadings)

Arguments

data

the data as a data frame

vars

a vector of strings naming the variables of interest in data

nFactorMethod

'parallel' (default), 'eigen' or 'fixed', the way to determine the number of factors

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

'none', 'varimax' (default), 'quartimax', 'promax', 'oblimin', or 'simplimax', the rotation to use in estimation

hideLoadings

a number (default: 0.3), hide loadings below this value

sortLoadings

TRUE or FALSE (default), sort the factor loadings by size

screePlot

TRUE or FALSE (default), show scree plot

eigen

TRUE or FALSE (default), show eigenvalue table

factorCor

TRUE or FALSE (default), show inter-factor correlations

factorSummary

TRUE or FALSE (default), show factor summary

kmo

TRUE or FALSE (default), show Kaiser-Meyer-Olkin (KMO) measure of sampling adequacy (MSA) results

bartlett

TRUE or FALSE (default), show Bartlett's test of sphericity results

Examples

Run this code
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
#

Run the code above in your browser using DataLab