Principal Components Analyses with Joggle Data

##Commands for Joggle Data and w03Neupsy Data PCA Analyses on 1/24/14
##Packages Used: “psych”, “GPArotation”, “nFactors”
##load(file='/Users/meganwilliams/Desktop/Joggle/Joggle Data/Joggle.rdata')
load(file='/Users/meganwilliams/Desktop/HANDLS/Joggle/Joggle PCA/JoggleData.rdata')

#install.packages("psych")
library("psych")
#install.packages("GPArotation")
library("GPArotation")
#install.packages("nFactors")
library("nFactors")

#JoggleDataVARS = c("BARTaccuracy","DSSTefficiency","LOTefficiency","PVTefficiency","AMefficiency","NBACKaccuracy","VOLTefficiency","MPTspeed")
#JoggleData=Joggle[JoggleDataVARS]
#save(JoggleData,file='/Users/meganwilliams/Desktop/HANDLS/Joggle/Joggle PCA/JoggleData.rdata')

Initial Extraction of the Components

JogglePCA<-principal(JoggleData,nfactors=8,rotate="none")
principal(r=JoggleData,nfactors=8,rotate="none")
## Principal Components Analysis
## Call: principal(r = JoggleData, nfactors = 8, rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                 PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8 h2      u2
## BARTaccuracy   0.30  0.20  0.92 -0.11  0.08 -0.02 -0.04 -0.04  1 0.0e+00
## DSSTefficiency 0.82 -0.08 -0.12 -0.02 -0.07  0.24 -0.15 -0.48  1 1.9e-15
## LOTefficiency  0.80 -0.07 -0.06 -0.04 -0.01  0.29 -0.36  0.38  1 8.9e-16
## PVTefficiency  0.19  0.85 -0.10  0.13 -0.02  0.33  0.32  0.04  1 0.0e+00
## AMefficiency   0.58 -0.54  0.05 -0.29 -0.09  0.09  0.51  0.09  1 5.6e-16
## NBACKaccuracy  0.48 -0.21  0.10  0.83  0.03 -0.13  0.11  0.04  1 8.9e-16
## VOLTefficiency 0.60  0.18 -0.20 -0.16  0.66 -0.31  0.04  0.00  1 6.7e-16
## MPTspeed       0.61  0.33 -0.09 -0.12 -0.52 -0.47 -0.02  0.04  1 0.0e+00
## 
##                        PC1  PC2  PC3  PC4  PC5  PC6  PC7  PC8
## SS loadings           2.72 1.26 0.94 0.84 0.73 0.59 0.53 0.39
## Proportion Var        0.34 0.16 0.12 0.11 0.09 0.07 0.07 0.05
## Cumulative Var        0.34 0.50 0.62 0.72 0.81 0.89 0.95 1.00
## Proportion Explained  0.34 0.16 0.12 0.11 0.09 0.07 0.07 0.05
## Cumulative Proportion 0.34 0.50 0.62 0.72 0.81 0.89 0.95 1.00
## 
## Test of the hypothesis that 8 components are sufficient.
## 
## The degrees of freedom for the null model are  28  and the objective function was  1.44
## The degrees of freedom for the model are -8  and the objective function was  0 
## The total number of observations was  1793  with MLE Chi Square =  0  with prob <  NA 
## 
## Fit based upon off diagonal values = 1

Eigen Values

ev <- eigen(cor(JoggleData))
ev$values
## [1] 2.7241 1.2642 0.9379 0.8403 0.7325 0.5872 0.5281 0.3856

Scree Plot

ap <- parallel(subject=nrow(JoggleData),var=ncol(JoggleData), rep=100,cent=.05)
nS <- nScree(x=ev$values, aparallel=ap$eigen$qevpea)
plotnScree(nS)

plot of chunk unnamed-chunk-4

Rotation to Final Solution - 3 Factors

JogglePCA.r<-principal(JoggleData,nfactors=3,rotate="promax",scores=T)
principal(r=JoggleData,nfactors=3,rotate="promax",scores=T)
## Principal Components Analysis
## Call: principal(r = JoggleData, nfactors = 3, rotate = "promax", scores = T)
## Standardized loadings (pattern matrix) based upon correlation matrix
##                  PC1   PC2   PC3   h2    u2
## BARTaccuracy   -0.01  0.08  0.98 0.98 0.023
## DSSTefficiency  0.81  0.07 -0.05 0.69 0.310
## LOTefficiency   0.78  0.07  0.01 0.64 0.357
## PVTefficiency  -0.20  0.91  0.06 0.77 0.228
## AMefficiency    0.77 -0.46  0.02 0.63 0.371
## NBACKaccuracy   0.52 -0.16  0.12 0.29 0.714
## VOLTefficiency  0.51  0.32 -0.10 0.44 0.563
## MPTspeed        0.42  0.45  0.03 0.49 0.507
## 
##                        PC1  PC2  PC3
## SS loadings           2.57 1.35 1.00
## Proportion Var        0.32 0.17 0.13
## Cumulative Var        0.32 0.49 0.62
## Proportion Explained  0.52 0.27 0.20
## Cumulative Proportion 0.52 0.80 1.00
## 
##  With component correlations of 
##      PC1  PC2  PC3
## PC1 1.00 0.26 0.18
## PC2 0.26 1.00 0.05
## PC3 0.18 0.05 1.00
## 
## Test of the hypothesis that 3 components are sufficient.
## 
## The degrees of freedom for the null model are  28  and the objective function was  1.44
## The degrees of freedom for the model are 7  and the objective function was  0.4 
## The total number of observations was  1793  with MLE Chi Square =  717  with prob <  1.5e-150 
## 
## Fit based upon off diagonal values = 0.87

Rotation to Final Solution - 4 Factors

JogglePCA.r<-principal(JoggleData,nfactors=4,rotate="promax",scores=T)
principal(r=JoggleData,nfactors=4,rotate="promax",scores=T)
## Principal Components Analysis
## Call: principal(r = JoggleData, nfactors = 4, rotate = "promax", scores = T)
## 
##  Warning: A Heywood case was detected. 
## Standardized loadings (pattern matrix) based upon correlation matrix
##                  PC1   PC2   PC3   PC4   h2   u2
## BARTaccuracy   -0.04  0.02  1.00  0.00 0.99 0.01
## DSSTefficiency  0.80 -0.07 -0.04  0.13 0.69 0.31
## LOTefficiency   0.77 -0.07  0.02  0.10 0.64 0.36
## PVTefficiency   0.18  0.86  0.04  0.00 0.79 0.21
## AMefficiency    0.60 -0.61  0.06 -0.09 0.71 0.29
## NBACKaccuracy   0.11  0.04  0.00  0.96 0.97 0.03
## VOLTefficiency  0.68  0.15 -0.08 -0.10 0.46 0.54
## MPTspeed        0.64  0.29  0.05 -0.08 0.51 0.49
## 
##                        PC1  PC2  PC3  PC4
## SS loadings           2.53 1.23 1.01 0.99
## Proportion Var        0.32 0.15 0.13 0.12
## Cumulative Var        0.32 0.47 0.60 0.72
## Proportion Explained  0.44 0.21 0.18 0.17
## Cumulative Proportion 0.44 0.65 0.83 1.00
## 
##  With component correlations of 
##      PC1   PC2  PC3   PC4
## PC1 1.00  0.02 0.23  0.21
## PC2 0.02  1.00 0.03 -0.12
## PC3 0.23  0.03 1.00  0.08
## PC4 0.21 -0.12 0.08  1.00
## 
## Test of the hypothesis that 4 components are sufficient.
## 
## The degrees of freedom for the null model are  28  and the objective function was  1.44
## The degrees of freedom for the model are 2  and the objective function was  0.55 
## The total number of observations was  1793  with MLE Chi Square =  989.1  with prob <  1.6e-215 
## 
## Fit based upon off diagonal values = 0.89

Rotation to Final Solution - 5 Factors

JogglePCA.r<-principal(JoggleData,nfactors=5,rotate="promax",scores=T)
principal(r=JoggleData,nfactors=5,rotate="promax",scores=T)
## Principal Components Analysis
## Call: principal(r = JoggleData, nfactors = 5, rotate = "promax", scores = T)
## 
##  Warning: A Heywood case was detected. 
## Standardized loadings (pattern matrix) based upon correlation matrix
##                  PC1   PC5   PC2   PC4   PC3   h2     u2
## BARTaccuracy   -0.03 -0.01  0.03  0.01  1.01 1.00 0.0035
## DSSTefficiency  0.64  0.19 -0.06  0.14 -0.05 0.70 0.3048
## LOTefficiency   0.56  0.25 -0.06  0.11  0.02 0.64 0.3550
## PVTefficiency   0.29  0.19  0.90  0.00  0.04 0.79 0.2123
## AMefficiency    0.45  0.03 -0.63 -0.10  0.05 0.72 0.2776
## NBACKaccuracy  -0.02 -0.09  0.04  1.02  0.01 0.97 0.0295
## VOLTefficiency -0.14  1.07  0.17 -0.08 -0.01 0.90 0.0967
## MPTspeed        1.05 -0.30  0.31 -0.11 -0.01 0.78 0.2216
## 
##                        PC1  PC5  PC2  PC4  PC3
## SS loadings           1.99 1.21 1.23 1.06 1.01
## Proportion Var        0.25 0.15 0.15 0.13 0.13
## Cumulative Var        0.25 0.40 0.55 0.69 0.81
## Proportion Explained  0.31 0.19 0.19 0.16 0.16
## Cumulative Proportion 0.31 0.49 0.68 0.84 1.00
## 
##  With component correlations of 
##       PC1   PC5   PC2   PC4   PC3
## PC1  1.00  0.58 -0.24  0.37  0.23
## PC5  0.58  1.00 -0.25  0.35  0.17
## PC2 -0.24 -0.25  1.00 -0.21 -0.04
## PC4  0.37  0.35 -0.21  1.00  0.12
## PC3  0.23  0.17 -0.04  0.12  1.00
## 
## Test of the hypothesis that 5 components are sufficient.
## 
## The degrees of freedom for the null model are  28  and the objective function was  1.44
## The degrees of freedom for the model are -2  and the objective function was  1.09 
## The total number of observations was  1793  with MLE Chi Square =  1940  with prob <  NA 
## 
## Fit based upon off diagonal values = 0.9