## INITIALISATION
data(dFactors) # Load the nFactors dataset
attach(dFactors)
vect <- Raiche # Use the example from Raiche
eigenvalues <- vect$eigenvalues # Extract the observed eigenvalues
nsubjects <- vect$nsubjects # Extract the number of subjects
variables <- length(eigenvalues) # Compute the number of variables
rep <- 100 # Number of replications for the parallel analysis
cent <- 0.95 # Centile value of the parallel analysis
## PARALLEL ANALYSIS (qevpea for the centile criterion, mevpea for the mean criterion)
aparallel <- parallel(var = variables,
subject = nsubjects,
rep = rep,
cent = cent
)$eigen$qevpea # The 95 centile
## NOMBER OF FACTORS RETAINED ACCORDING TO DIFFERENT RULES
results <- nScree(eig = eigenvalues,
aparallel = aparallel
)
results
## PLOT ACCORDING TO THE nScree CLASS
plotnScree(results)
## RESULTS OF THE nSree FUNCTION: AN EXAMPLE
## RESULTS CAN VARY ACCORDING TO RANDOM SIMULATION IN PARALLEL ANALYSIS
# $Components
# noc naf nparallel nkeyser
# 1 2 1 2 5
# $Analysis
# Eigenvalues Prop Cumu Par.Analysis Pred.eig OC Acc.factor AF
# 1 5.54 0.369333333 0.3693333 2.8807740 2.6461538 NA (< AF)
# 2 2.46 0.164000000 0.5333333 2.3570618 1.9575000 (< OC) 2.43
# 3 1.81 0.120666667 0.6540000 2.0132405 1.4690909 0.19
# 4 1.35 0.090000000 0.7440000 1.7117006 1.0960000 0.11
# 5 1.00 0.066666667 0.8106667 1.5115951 0.7400000 0.02
# 6 0.67 0.044666667 0.8553333 1.3196573 0.6025000 0.20
# 7 0.54 0.036000000 0.8913333 1.1188151 0.4857143 0.02
# 8 0.43 0.028666667 0.9200000 0.9552613 0.3900000 0.02
# 9 0.34 0.022666667 0.9426667 0.8249083 0.3640000 0.06
# 10 0.31 0.020666667 0.9633333 0.6714989 0.2275000 -0.09
# 11 0.19 0.012666667 0.9760000 0.5814073 0.1866667 0.08
# 12 0.15 0.010000000 0.9860000 0.4473462 0.1450000 0.00
# 13 0.11 0.007333333 0.9933333 0.3451530 0.0800000 -0.01
# 14 0.06 0.004000000 0.9973333 0.2622424 NA 0.03
# 15 0.04 0.002666667 1.0000000 0.1722911 NA NA
Run the code above in your browser using DataLab