needed_packages <- c("psych",   "REdaS", "Hmisc", "corrplot", "ggcorrplot", "factoextra",  "nFactors")                      
# Extract not installed packages
not_installed <- needed_packages[!(needed_packages %in% installed.packages()[ , "Package"])]    
# Install not installed packages
if(length(not_installed)) install.packages(not_installed, repos = "http://cran.us.r-project.org") 
library(psych)
library(REdaS)
## Loading required package: grid
library(Hmisc)
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## Loading required package: ggplot2
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
## 
## Attaching package: 'Hmisc'
## The following object is masked from 'package:psych':
## 
##     describe
## The following objects are masked from 'package:base':
## 
##     format.pval, units
library(corrplot)
## corrplot 0.92 loaded
library(ggcorrplot)
library(factoextra)#Used for principal component analysis to get a different view of eigenvalues
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(nFactors)
## 
## Attaching package: 'nFactors'
## The following object is masked from 'package:lattice':
## 
##     parallel
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:Hmisc':
## 
##     src, summarize
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(readr)
#We read the dat and get its dimensions and structure 
studentdata <- read.csv("studentpartII.csv")
head(studentdata)
##    id school sex age.x address famsize Pstatus Medu Fedu     Mjob     Fjob
## 1   1     GP   F    15       R     GT3       T    1    1  at_home    other
## 2  10     GP   F    15       U     GT3       A    3    3    other   health
## 3 100     GP   F    17       R     LE3       T    2    2 services services
## 4 101     GP   F    17       R     LE3       T    3    1 services    other
## 5 102     GP   F    17       R     LE3       T    4    4 services    other
## 6 103     GP   F    17       U     GT3       A    2    1    other    other
##       reason nursery internet guardian.x traveltime.x studytime.x failures.x
## 1       home     yes      yes     mother            2           4          1
## 2 reputation     yes       no     father            1           4          0
## 3     course     yes      yes     mother            1           3          0
## 4 reputation     yes       no     mother            2           4          0
## 5      other     yes       no     mother            1           1          0
## 6     course     yes      yes     mother            2           3          0
##   schoolsup.x famsup.x paid.x activities.x higher.x romantic.x famrel.x
## 1         yes      yes    yes          yes      yes         no        3
## 2         yes       no     no           no      yes         no        4
## 3          no      yes    yes          yes      yes         no        3
## 4          no      yes    yes           no      yes         no        3
## 5          no      yes    yes           no      yes         no        5
## 6          no       no     no          yes      yes        yes        3
##   freetime.x goout.x Dalc.x Walc.x health.x absences.x G1.x G2.x G3.x
## 1          1       2      1      1        1          2    7   10   10
## 2          3       3      1      1        4         10   10   11   11
## 3          3       2      2      2        3          3   11   11   11
## 4          1       2      1      1        3          6   18   18   18
## 5          2       1      1      2        3         12    8   10   10
## 6          2       3      1      2        3         10   12   10   12
##   guardian.y traveltime.y studytime.y failures.y schoolsup.y famsup.y paid.y
## 1     mother            2           4          0         yes      yes    yes
## 2     father            1           4          0         yes       no     no
## 3     mother            1           3          0          no      yes     no
## 4     mother            2           4          0          no      yes     no
## 5     mother            1           1          0          no      yes     no
## 6     mother            2           3          0          no       no     no
##   activities.y higher.y romantic.y famrel.y freetime.y goout.y Dalc.y Walc.y
## 1          yes      yes         no        3          1       2      1      1
## 2           no      yes         no        4          3       3      1      1
## 3          yes      yes         no        3          3       2      2      2
## 4           no      yes         no        3          1       2      1      1
## 5           no      yes         no        5          2       1      1      2
## 6          yes      yes        yes        3          2       3      1      2
##   health.y absences.y G1.y G2.y G3.y A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 B1 B2 B3 B4
## 1        1          4   13   13   13  4  3  4  2  4  2  3  5  2   3  4  4  4  4
## 2        4         10   10   10   10  3  4  2  4  4  4  3  3  2   3  5  5  5  5
## 3        3          0   11   11   10  5  5  5  5  5  5  5  2  1   2  4  3  4  4
## 4        3          0   18   19   19  4  5  4  4  4  5  4  3  1   2  5  5  4  5
## 5        3          6   12   11   11  3  3  2  4  3  4  4  3  4   4  4  5  5  5
## 6        3          0   15   15   16  4  4  4  3  4  3  4  3  3   3  4  3  4  5
##   B5 B6 B7 B8 B9 B10 B11 B12 B13 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 D1 D2 D3 D4 D5
## 1  4  4  4  4  1   2   2   2   2  2  1  4  2  2  4  5  5  4   2  2  2  5  4  2
## 2  4  5  2  4  2   1   1   2   3  4  5  5  4  3  1  2  1  1   1  4  4  5  5  4
## 3  4  3  5  5  3   2   4   1   2  4  3  4  4  4  1  2  2  2   3  3  3  3  3  3
## 4  5  4  4  4  2   2   4   1   1  2  3  3  2  2  2  3  3  4   2  4  3  3  5  4
## 5  4  5  2  4  4   4   3   1   2  2  3  2  3  1  5  4  4  3   2  5  5  4  4  3
## 6  4  4  4  4  5   2   1   2   1  3  4  3  3  3  4  3  1  2   2  4  3  2  3  5
##   D6 D7 D8 D9 D10 E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10
## 1  4  2  2  3   5  2  3  4  2  5  5  1  2  3   1  1  2  1  1  1  4  4  4  4   4
## 2  4  1  1  2   1  4  4  5  5  5  4  1  1  1   1  2  2  1  3  5  3  4  5  3   5
## 3  4  3  3  4   4  3  3  5  2  5  1  1  3  2   2  4  5  5  4  5  2  2  3  1   1
## 4  4  3  2  4   1  3  2  4  4  4  2  2  3  1   4  3  3  1  4  2  3  3  5  3   4
## 5  2  2  2  2   2  2  2  3  1  4  3  5  5  4   3  3  3  2  2  2  4  4  5  3   4
## 6  5  2  2  2   2  3  3  4  2  4  3  2  3  2   3  3  3  2  4  2  3  4  3  3   4
##   G1 G2 G3 G4 G5 G6 G7 G8 G9 G10 H1 H2 H3 H4 H5 H6 H7 H8 H9 H10 I1 I2 I3 I4 I5
## 1  4  2  1  2  4  2  3  2  4   5  3  2  2  1  1  2  3  3  3   4  4  3  4  3  5
## 2  5  5  5  3  5  1  1  2  1   1  4  5  4  1  1  4  2  3  1   2  1  2  2  1  4
## 3  4  4  2  5  5  1  2  2  2   3  4  3  3  2  4  5  4  3  2   1  2  2  2  2  3
## 4  4  4  4  4  4  3  3  2  4   3  5  5  4  3  3  3  2  2  1   4  2  3  4  3  4
## 5  2  4  2  2  4  5  5  2  5   4  4  5  2  5  1  2  4  3  4   2  4  4  3  4  4
## 6  3  2  4  3  4  2  3  1  4   2  5  4  5  2  4  4  2  2  3   2  2  4  3  3  3
##   I6 I7 I8 I9 I10 J1 J2 J3 J4 J5 J6 J7 J8 J9 J10 K1 K2 K3 K4 K5 K6 K7 K8 K9 K10
## 1  2  3  3  3   3  5  4  3  4  5  3  5  1  2   2  5  4  4  5  2  2  4  1  4   4
## 2  2  3  5  4   4  4  3  2  2  4  4  5  1  3   3  1  2  1  1  1  5  4  4  4   5
## 3  1  4  4  4   3  2  3  2  5  2  1  2  4  2   2  2  1  3  2  2  5  4  4  3   4
## 4  3  3  3  3   3  4  5  5  5  4  3  3  3  1   2  3  3  1  4  4  3  2  1  2   4
## 5  2  3  4  3   3  4  2  2  2  2  4  4  2  4   4  4  2  2  4  3  2  3  4  3   3
## 6  3  2  2  3   3  4  4  5  5  3  3  4  3  1   1  3  4  4  3  3  3  3  3  3   4
##   L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 N1 N2 N3 N4 N5
## 1  2  2  3  4  5  1  4  2  2   4  2  4  5  4  2  3  2  3  2   2  2  5  4  1  3
## 2  1  1  1  2  2  1  2  4  4   4  4  5  5  5  5  1  1  1  1   1  3  3  4  3  4
## 3  5  0  3  3  2  4  3  3  4   3  2  4  5  3  3  2  2  2  2   3  2  2  4  3  4
## 4  4  3  2  4  4  4  5  1  3   4  5  4  5  4  3  1  1  1  1   1  3  4  4  3  4
## 5  5  4  4  5  4  5  4  1  1   3  3  5  3  4  2  2  2  2  4   2  4  4  5  4  5
## 6  2  3  3  4  4  3  2  2  2   4  5  5  5  4  4  2  1  2  2   3  3  4  4  4  4
##   N6 N7 N8 N9 N10 O1 O2 O3 O4 O5 O6 O7 O8 O9 O10 P1 P2 P3 P4 P5 P6 P7 P8 P9 P10
## 1  2  4  2  3   2  4  3  4  4  4  4  4  2  2   4  4  4  2  2  2  4  2  2  4   2
## 2  4  3  3  3   2  1  2  3  2  2  4  4  3  4   4  2  2  5  4  1  2  5  3  4   3
## 3  3  3  5  5   3  5  4  4  3  4  4  3  3  3   4  2  2  3  2  2  4  2  4  4   5
## 4  3  4  5  3   2  4  3  4  4  4  2  2  4  2   2  4  3  3  4  3  3  2  2  5   5
## 5  4  5  4  3   2  5  2  5  4  4  5  1  5  3   5  5  5  4  5  3  3  3  1  4   4
## 6  4  5  4  3   2  4  3  4  4  4  2  2  2  3   3  3  2  3  3  3  3  3  2  3   3
str(studentdata)
## 'data.frame':    382 obs. of  217 variables:
##  $ id          : int  1 10 100 101 102 103 104 105 106 107 ...
##  $ school      : chr  "GP" "GP" "GP" "GP" ...
##  $ sex         : chr  "F" "F" "F" "F" ...
##  $ age.x       : int  15 15 17 17 17 17 17 17 17 17 ...
##  $ address     : chr  "R" "U" "R" "R" ...
##  $ famsize     : chr  "GT3" "GT3" "LE3" "LE3" ...
##  $ Pstatus     : chr  "T" "A" "T" "T" ...
##  $ Medu        : int  1 3 2 3 4 2 2 3 4 4 ...
##  $ Fedu        : int  1 3 2 1 4 1 2 3 3 4 ...
##  $ Mjob        : chr  "at_home" "other" "services" "services" ...
##  $ Fjob        : chr  "other" "health" "services" "other" ...
##  $ reason      : chr  "home" "reputation" "course" "reputation" ...
##  $ nursery     : chr  "yes" "yes" "yes" "yes" ...
##  $ internet    : chr  "yes" "no" "yes" "no" ...
##  $ guardian.x  : chr  "mother" "father" "mother" "mother" ...
##  $ traveltime.x: int  2 1 1 2 1 2 1 1 1 2 ...
##  $ studytime.x : int  4 4 3 4 1 3 2 2 2 2 ...
##  $ failures.x  : int  1 0 0 0 0 0 1 0 0 0 ...
##  $ schoolsup.x : chr  "yes" "yes" "no" "no" ...
##  $ famsup.x    : chr  "yes" "no" "yes" "yes" ...
##  $ paid.x      : chr  "yes" "no" "yes" "yes" ...
##  $ activities.x: chr  "yes" "no" "yes" "no" ...
##  $ higher.x    : chr  "yes" "yes" "yes" "yes" ...
##  $ romantic.x  : chr  "no" "no" "no" "no" ...
##  $ famrel.x    : int  3 4 3 3 5 3 3 3 5 4 ...
##  $ freetime.x  : int  1 3 3 1 2 2 3 3 2 1 ...
##  $ goout.x     : int  2 3 2 2 1 3 1 3 2 4 ...
##  $ Dalc.x      : int  1 1 2 1 1 1 1 1 1 1 ...
##  $ Walc.x      : int  1 1 2 1 2 2 2 3 2 1 ...
##  $ health.x    : int  1 4 3 3 3 3 4 3 5 1 ...
##  $ absences.x  : int  2 10 3 6 12 10 0 6 23 6 ...
##  $ G1.x        : int  7 10 11 18 8 12 9 8 13 6 ...
##  $ G2.x        : int  10 11 11 18 10 10 8 7 13 5 ...
##  $ G3.x        : int  10 11 11 18 10 12 0 9 13 6 ...
##  $ guardian.y  : chr  "mother" "father" "mother" "mother" ...
##  $ traveltime.y: int  2 1 1 2 1 2 1 1 1 2 ...
##  $ studytime.y : int  4 4 3 4 1 3 2 2 2 2 ...
##  $ failures.y  : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ schoolsup.y : chr  "yes" "yes" "no" "no" ...
##  $ famsup.y    : chr  "yes" "no" "yes" "yes" ...
##  $ paid.y      : chr  "yes" "no" "no" "no" ...
##  $ activities.y: chr  "yes" "no" "yes" "no" ...
##  $ higher.y    : chr  "yes" "yes" "yes" "yes" ...
##  $ romantic.y  : chr  "no" "no" "no" "no" ...
##  $ famrel.y    : int  3 4 3 3 5 3 3 3 5 4 ...
##  $ freetime.y  : int  1 3 3 1 2 2 3 3 2 1 ...
##  $ goout.y     : int  2 3 2 2 1 3 1 3 2 4 ...
##  $ Dalc.y      : int  1 1 2 1 1 1 1 1 1 1 ...
##  $ Walc.y      : int  1 1 2 1 2 2 2 3 2 1 ...
##  $ health.y    : int  1 4 3 3 3 3 4 3 5 1 ...
##  $ absences.y  : int  4 10 0 0 6 0 18 10 14 2 ...
##  $ G1.y        : int  13 10 11 18 12 15 10 12 15 10 ...
##  $ G2.y        : int  13 10 11 19 11 15 12 13 14 13 ...
##  $ G3.y        : int  13 10 10 19 11 16 14 14 17 13 ...
##  $ A1          : int  4 3 5 4 3 4 4 5 5 4 ...
##  $ A2          : int  3 4 5 5 3 4 4 5 3 4 ...
##  $ A3          : int  4 2 5 4 2 4 4 4 3 5 ...
##  $ A4          : int  2 4 5 4 4 3 4 3 4 4 ...
##  $ A5          : int  4 4 5 4 3 4 4 5 4 5 ...
##  $ A6          : int  2 4 5 5 4 3 4 5 1 4 ...
##  $ A7          : int  3 3 5 4 4 4 5 4 2 5 ...
##  $ A8          : int  5 3 2 3 3 3 3 4 3 1 ...
##  $ A9          : int  2 2 1 1 4 3 2 2 2 1 ...
##  $ A10         : int  3 3 2 2 4 3 3 2 2 2 ...
##  $ B1          : int  4 5 4 5 4 4 3 4 5 4 ...
##  $ B2          : int  4 5 3 5 5 3 3 2 5 4 ...
##  $ B3          : int  4 5 4 4 5 4 4 5 5 4 ...
##  $ B4          : int  4 5 4 5 5 5 4 5 5 4 ...
##  $ B5          : int  4 4 4 5 4 4 4 3 4 4 ...
##  $ B6          : int  4 5 3 4 5 4 2 3 5 4 ...
##  $ B7          : int  4 2 5 4 2 4 4 5 4 4 ...
##  $ B8          : int  4 4 5 4 4 4 5 5 4 4 ...
##  $ B9          : int  1 2 3 2 4 5 4 4 2 2 ...
##  $ B10         : int  2 1 2 2 4 2 2 2 2 4 ...
##  $ B11         : int  2 1 4 4 3 1 2 4 1 4 ...
##  $ B12         : int  2 2 1 1 1 2 2 1 1 1 ...
##  $ B13         : int  2 3 2 1 2 1 3 2 1 1 ...
##  $ C1          : int  2 4 4 2 2 3 3 1 4 2 ...
##  $ C2          : int  1 5 3 3 3 4 4 4 5 4 ...
##  $ C3          : int  4 5 4 3 2 3 4 4 4 4 ...
##  $ C4          : int  2 4 4 2 3 3 3 5 3 2 ...
##  $ C5          : int  2 3 4 2 1 3 5 5 2 1 ...
##  $ C6          : int  4 1 1 2 5 4 2 1 2 4 ...
##  $ C7          : int  5 2 2 3 4 3 3 1 2 3 ...
##  $ C8          : int  5 1 2 3 4 1 3 2 1 2 ...
##  $ C9          : int  4 1 2 4 3 2 3 1 1 2 ...
##  $ C10         : int  2 1 3 2 2 2 3 2 3 2 ...
##  $ D1          : int  2 4 3 4 5 4 4 3 4 4 ...
##  $ D2          : int  2 4 3 3 5 3 3 4 2 4 ...
##  $ D3          : int  5 5 3 3 4 2 3 3 5 4 ...
##  $ D4          : int  4 5 3 5 4 3 3 4 5 4 ...
##  $ D5          : int  2 4 3 4 3 5 4 3 5 4 ...
##  $ D6          : int  4 4 4 4 2 5 4 4 5 4 ...
##  $ D7          : int  2 1 3 3 2 2 3 4 3 2 ...
##  $ D8          : int  2 1 3 2 2 2 2 2 1 2 ...
##  $ D9          : int  3 2 4 4 2 2 3 4 4 2 ...
##  $ D10         : int  5 1 4 1 2 2 3 1 1 2 ...
##  $ E1          : int  2 4 3 3 2 3 3 2 2 5 ...
##  $ E2          : int  3 4 3 2 2 3 4 5 2 4 ...
##   [list output truncated]
dim(studentdata)
## [1] 382 217

This information is not considered statistical, it is just to get an idea of the actual dataset.

#We need to reverse code the negative columns into positive values. 
ragdataNegative <- subset(studentdata, select = c("A1","A3","A5", "A7","C2", "C4","C6", "C8","E2", "E4","E6", "E8","E10"))

# Reverse the values in all columns
reverse_values <- function(col) {
  max_val <- max(col) + 1
  return(max_val - col)
}

ragDataNegative <- data.frame(apply(ragdataNegative, 2 , reverse_values))

raqDataPositive <- subset(studentdata, select = c("A2", "A4","A6","A8","A9", "A10","C1", "C3","C5", "C7","C9","C10","E1", "E3","E5", "E7","E9"))

raqData <- merge(raqDataPositive,ragDataNegative)

head(raqData)
##   A2 A4 A6 A8 A9 A10 C1 C3 C5 C7 C9 C10 E1 E3 E5 E7 E9 A1 A3 A5 A7 C2 C4 C6 C8
## 1  3  2  2  5  2   3  2  4  2  5  4   2  2  4  5  1  3  2  2  2  3  5  4  2  1
## 2  4  4  4  3  2   3  4  5  3  2  1   1  4  5  5  1  1  2  2  2  3  5  4  2  1
## 3  5  5  5  2  1   2  4  4  4  2  2   3  3  5  5  1  2  2  2  2  3  5  4  2  1
## 4  5  4  5  3  1   2  2  3  2  3  4   2  3  4  4  2  1  2  2  2  3  5  4  2  1
## 5  3  4  4  3  4   4  2  2  1  4  3   2  2  3  4  5  4  2  2  2  3  5  4  2  1
## 6  4  3  3  3  3   3  3  3  3  3  2   2  3  4  4  2  2  2  2  2  3  5  4  2  1
##   E2 E4 E6 E8 E10
## 1  3  4  1  4   5
## 2  3  4  1  4   5
## 3  3  4  1  4   5
## 4  3  4  1  4   5
## 5  3  4  1  4   5
## 6  3  4  1  4   5

##Step 1: Screen the correlation matrix

#create a correlation matrix (these are just some methods)
raqMatrix<-cor(raqData)
round(raqMatrix, 2)
##        A2    A4    A6    A8    A9   A10    C1    C3    C5    C7    C9   C10
## A2   1.00  0.40  0.51 -0.17 -0.27 -0.08  0.00  0.20  0.04  0.03  0.02 -0.01
## A4   0.40  1.00  0.34 -0.24 -0.39 -0.18  0.06  0.11  0.08  0.06 -0.09  0.02
## A6   0.51  0.34  1.00 -0.09 -0.27 -0.07  0.15  0.36  0.19 -0.14 -0.15 -0.15
## A8  -0.17 -0.24 -0.09  1.00  0.30  0.24  0.03  0.10  0.01  0.00  0.05 -0.01
## A9  -0.27 -0.39 -0.27  0.30  1.00  0.30 -0.03 -0.03 -0.13  0.15  0.15  0.11
## A10 -0.08 -0.18 -0.07  0.24  0.30  1.00 -0.01 -0.02 -0.01  0.07  0.14  0.10
## C1   0.00  0.06  0.15  0.03 -0.03 -0.01  1.00  0.22  0.32 -0.45 -0.28 -0.26
## C3   0.20  0.11  0.36  0.10 -0.03 -0.02  0.22  1.00  0.34 -0.28 -0.30 -0.46
## C5   0.04  0.08  0.19  0.01 -0.13 -0.01  0.32  0.34  1.00 -0.35 -0.28 -0.41
## C7   0.03  0.06 -0.14  0.00  0.15  0.07 -0.45 -0.28 -0.35  1.00  0.62  0.53
## C9   0.02 -0.09 -0.15  0.05  0.15  0.14 -0.28 -0.30 -0.28  0.62  1.00  0.48
## C10 -0.01  0.02 -0.15 -0.01  0.11  0.10 -0.26 -0.46 -0.41  0.53  0.48  1.00
## E1   0.36  0.18  0.29 -0.06 -0.16 -0.03  0.17  0.34  0.15 -0.17 -0.07 -0.24
## E3   0.36  0.26  0.23  0.03 -0.14  0.08  0.10  0.14  0.07 -0.01  0.09  0.06
## E5   0.43  0.34  0.43 -0.06 -0.15 -0.05  0.06  0.24  0.11  0.03  0.03 -0.05
## E7  -0.13 -0.09 -0.08  0.14  0.24  0.17 -0.01  0.01 -0.06  0.13  0.08  0.00
## E9  -0.08 -0.15 -0.14  0.13  0.15  0.15 -0.06 -0.13 -0.12  0.10  0.14  0.25
## A1   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## A3   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## A5   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## A7   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## C2   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## C4   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## C6   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## C8   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## E2   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## E4   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## E6   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## E8   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## E10  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
##        E1    E3    E5    E7    E9    A1   A3    A5    A7    C2    C4    C6
## A2   0.36  0.36  0.43 -0.13 -0.08  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A4   0.18  0.26  0.34 -0.09 -0.15  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A6   0.29  0.23  0.43 -0.08 -0.14  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A8  -0.06  0.03 -0.06  0.14  0.13  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A9  -0.16 -0.14 -0.15  0.24  0.15  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A10 -0.03  0.08 -0.05  0.17  0.15  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C1   0.17  0.10  0.06 -0.01 -0.06  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C3   0.34  0.14  0.24  0.01 -0.13  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C5   0.15  0.07  0.11 -0.06 -0.12  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C7  -0.17 -0.01  0.03  0.13  0.10  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C9  -0.07  0.09  0.03  0.08  0.14  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C10 -0.24  0.06 -0.05  0.00  0.25  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## E1   1.00  0.32  0.40 -0.10 -0.07  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## E3   0.32  1.00  0.53 -0.43 -0.12  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## E5   0.40  0.53  1.00 -0.26 -0.20  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## E7  -0.10 -0.43 -0.26  1.00  0.24  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## E9  -0.07 -0.12 -0.20  0.24  1.00  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A1   0.00  0.00  0.00  0.00  0.00  1.00 0.56  0.42  0.31  0.10  0.04  0.13
## A3   0.00  0.00  0.00  0.00  0.00  0.56 1.00  0.30  0.41  0.08  0.03  0.10
## A5   0.00  0.00  0.00  0.00  0.00  0.42 0.30  1.00  0.26  0.16  0.14 -0.10
## A7   0.00  0.00  0.00  0.00  0.00  0.31 0.41  0.26  1.00  0.00  0.06 -0.03
## C2   0.00  0.00  0.00  0.00  0.00  0.10 0.08  0.16  0.00  1.00  0.44 -0.24
## C4   0.00  0.00  0.00  0.00  0.00  0.04 0.03  0.14  0.06  0.44  1.00 -0.30
## C6   0.00  0.00  0.00  0.00  0.00  0.13 0.10 -0.10 -0.03 -0.24 -0.30  1.00
## C8   0.00  0.00  0.00  0.00  0.00 -0.04 0.08 -0.13  0.01 -0.63 -0.38  0.37
## E2   0.00  0.00  0.00  0.00  0.00  0.12 0.04  0.21  0.15  0.17  0.17 -0.06
## E4   0.00  0.00  0.00  0.00  0.00  0.13 0.09  0.24  0.19  0.14  0.11 -0.05
## E6   0.00  0.00  0.00  0.00  0.00  0.15 0.17  0.18  0.12  0.06  0.08  0.28
## E8   0.00  0.00  0.00  0.00  0.00 -0.03 0.05 -0.25 -0.11 -0.05 -0.07  0.25
## E10  0.00  0.00  0.00  0.00  0.00  0.02 0.05 -0.10 -0.06  0.12  0.08 -0.04
##        C8    E2    E4    E6    E8   E10
## A2   0.00  0.00  0.00  0.00  0.00  0.00
## A4   0.00  0.00  0.00  0.00  0.00  0.00
## A6   0.00  0.00  0.00  0.00  0.00  0.00
## A8   0.00  0.00  0.00  0.00  0.00  0.00
## A9   0.00  0.00  0.00  0.00  0.00  0.00
## A10  0.00  0.00  0.00  0.00  0.00  0.00
## C1   0.00  0.00  0.00  0.00  0.00  0.00
## C3   0.00  0.00  0.00  0.00  0.00  0.00
## C5   0.00  0.00  0.00  0.00  0.00  0.00
## C7   0.00  0.00  0.00  0.00  0.00  0.00
## C9   0.00  0.00  0.00  0.00  0.00  0.00
## C10  0.00  0.00  0.00  0.00  0.00  0.00
## E1   0.00  0.00  0.00  0.00  0.00  0.00
## E3   0.00  0.00  0.00  0.00  0.00  0.00
## E5   0.00  0.00  0.00  0.00  0.00  0.00
## E7   0.00  0.00  0.00  0.00  0.00  0.00
## E9   0.00  0.00  0.00  0.00  0.00  0.00
## A1  -0.04  0.12  0.13  0.15 -0.03  0.02
## A3   0.08  0.04  0.09  0.17  0.05  0.05
## A5  -0.13  0.21  0.24  0.18 -0.25 -0.10
## A7   0.01  0.15  0.19  0.12 -0.11 -0.06
## C2  -0.63  0.17  0.14  0.06 -0.05  0.12
## C4  -0.38  0.17  0.11  0.08 -0.07  0.08
## C6   0.37 -0.06 -0.05  0.28  0.25 -0.04
## C8   1.00 -0.13 -0.12  0.03  0.17 -0.13
## E2  -0.13  1.00  0.65  0.38 -0.53 -0.20
## E4  -0.12  0.65  1.00  0.34 -0.55 -0.22
## E6   0.03  0.38  0.34  1.00 -0.14 -0.15
## E8   0.17 -0.53 -0.55 -0.14  1.00  0.26
## E10 -0.13 -0.20 -0.22 -0.15  0.26  1.00
Hmisc::rcorr(as.matrix(raqData))
##        A2    A4    A6    A8    A9   A10    C1    C3    C5    C7    C9   C10
## A2   1.00  0.40  0.51 -0.17 -0.27 -0.08  0.00  0.20  0.04  0.03  0.02 -0.01
## A4   0.40  1.00  0.34 -0.24 -0.39 -0.18  0.06  0.11  0.08  0.06 -0.09  0.02
## A6   0.51  0.34  1.00 -0.09 -0.27 -0.07  0.15  0.36  0.19 -0.14 -0.15 -0.15
## A8  -0.17 -0.24 -0.09  1.00  0.30  0.24  0.03  0.10  0.01  0.00  0.05 -0.01
## A9  -0.27 -0.39 -0.27  0.30  1.00  0.30 -0.03 -0.03 -0.13  0.15  0.15  0.11
## A10 -0.08 -0.18 -0.07  0.24  0.30  1.00 -0.01 -0.02 -0.01  0.07  0.14  0.10
## C1   0.00  0.06  0.15  0.03 -0.03 -0.01  1.00  0.22  0.32 -0.45 -0.28 -0.26
## C3   0.20  0.11  0.36  0.10 -0.03 -0.02  0.22  1.00  0.34 -0.28 -0.30 -0.46
## C5   0.04  0.08  0.19  0.01 -0.13 -0.01  0.32  0.34  1.00 -0.35 -0.28 -0.41
## C7   0.03  0.06 -0.14  0.00  0.15  0.07 -0.45 -0.28 -0.35  1.00  0.62  0.53
## C9   0.02 -0.09 -0.15  0.05  0.15  0.14 -0.28 -0.30 -0.28  0.62  1.00  0.48
## C10 -0.01  0.02 -0.15 -0.01  0.11  0.10 -0.26 -0.46 -0.41  0.53  0.48  1.00
## E1   0.36  0.18  0.29 -0.06 -0.16 -0.03  0.17  0.34  0.15 -0.17 -0.07 -0.24
## E3   0.36  0.26  0.23  0.03 -0.14  0.08  0.10  0.14  0.07 -0.01  0.09  0.06
## E5   0.43  0.34  0.43 -0.06 -0.15 -0.05  0.06  0.24  0.11  0.03  0.03 -0.05
## E7  -0.13 -0.09 -0.08  0.14  0.24  0.17 -0.01  0.01 -0.06  0.13  0.08  0.00
## E9  -0.08 -0.15 -0.14  0.13  0.15  0.15 -0.06 -0.13 -0.12  0.10  0.14  0.25
## A1   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## A3   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## A5   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## A7   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## C2   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## C4   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## C6   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## C8   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## E2   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## E4   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## E6   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## E8   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
## E10  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
##        E1    E3    E5    E7    E9    A1   A3    A5    A7    C2    C4    C6
## A2   0.36  0.36  0.43 -0.13 -0.08  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A4   0.18  0.26  0.34 -0.09 -0.15  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A6   0.29  0.23  0.43 -0.08 -0.14  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A8  -0.06  0.03 -0.06  0.14  0.13  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A9  -0.16 -0.14 -0.15  0.24  0.15  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A10 -0.03  0.08 -0.05  0.17  0.15  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C1   0.17  0.10  0.06 -0.01 -0.06  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C3   0.34  0.14  0.24  0.01 -0.13  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C5   0.15  0.07  0.11 -0.06 -0.12  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C7  -0.17 -0.01  0.03  0.13  0.10  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C9  -0.07  0.09  0.03  0.08  0.14  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## C10 -0.24  0.06 -0.05  0.00  0.25  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## E1   1.00  0.32  0.40 -0.10 -0.07  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## E3   0.32  1.00  0.53 -0.43 -0.12  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## E5   0.40  0.53  1.00 -0.26 -0.20  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## E7  -0.10 -0.43 -0.26  1.00  0.24  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## E9  -0.07 -0.12 -0.20  0.24  1.00  0.00 0.00  0.00  0.00  0.00  0.00  0.00
## A1   0.00  0.00  0.00  0.00  0.00  1.00 0.56  0.42  0.31  0.10  0.04  0.13
## A3   0.00  0.00  0.00  0.00  0.00  0.56 1.00  0.30  0.41  0.08  0.03  0.10
## A5   0.00  0.00  0.00  0.00  0.00  0.42 0.30  1.00  0.26  0.16  0.14 -0.10
## A7   0.00  0.00  0.00  0.00  0.00  0.31 0.41  0.26  1.00  0.00  0.06 -0.03
## C2   0.00  0.00  0.00  0.00  0.00  0.10 0.08  0.16  0.00  1.00  0.44 -0.24
## C4   0.00  0.00  0.00  0.00  0.00  0.04 0.03  0.14  0.06  0.44  1.00 -0.30
## C6   0.00  0.00  0.00  0.00  0.00  0.13 0.10 -0.10 -0.03 -0.24 -0.30  1.00
## C8   0.00  0.00  0.00  0.00  0.00 -0.04 0.08 -0.13  0.01 -0.63 -0.38  0.37
## E2   0.00  0.00  0.00  0.00  0.00  0.12 0.04  0.21  0.15  0.17  0.17 -0.06
## E4   0.00  0.00  0.00  0.00  0.00  0.13 0.09  0.24  0.19  0.14  0.11 -0.05
## E6   0.00  0.00  0.00  0.00  0.00  0.15 0.17  0.18  0.12  0.06  0.08  0.28
## E8   0.00  0.00  0.00  0.00  0.00 -0.03 0.05 -0.25 -0.11 -0.05 -0.07  0.25
## E10  0.00  0.00  0.00  0.00  0.00  0.02 0.05 -0.10 -0.06  0.12  0.08 -0.04
##        C8    E2    E4    E6    E8   E10
## A2   0.00  0.00  0.00  0.00  0.00  0.00
## A4   0.00  0.00  0.00  0.00  0.00  0.00
## A6   0.00  0.00  0.00  0.00  0.00  0.00
## A8   0.00  0.00  0.00  0.00  0.00  0.00
## A9   0.00  0.00  0.00  0.00  0.00  0.00
## A10  0.00  0.00  0.00  0.00  0.00  0.00
## C1   0.00  0.00  0.00  0.00  0.00  0.00
## C3   0.00  0.00  0.00  0.00  0.00  0.00
## C5   0.00  0.00  0.00  0.00  0.00  0.00
## C7   0.00  0.00  0.00  0.00  0.00  0.00
## C9   0.00  0.00  0.00  0.00  0.00  0.00
## C10  0.00  0.00  0.00  0.00  0.00  0.00
## E1   0.00  0.00  0.00  0.00  0.00  0.00
## E3   0.00  0.00  0.00  0.00  0.00  0.00
## E5   0.00  0.00  0.00  0.00  0.00  0.00
## E7   0.00  0.00  0.00  0.00  0.00  0.00
## E9   0.00  0.00  0.00  0.00  0.00  0.00
## A1  -0.04  0.12  0.13  0.15 -0.03  0.02
## A3   0.08  0.04  0.09  0.17  0.05  0.05
## A5  -0.13  0.21  0.24  0.18 -0.25 -0.10
## A7   0.01  0.15  0.19  0.12 -0.11 -0.06
## C2  -0.63  0.17  0.14  0.06 -0.05  0.12
## C4  -0.38  0.17  0.11  0.08 -0.07  0.08
## C6   0.37 -0.06 -0.05  0.28  0.25 -0.04
## C8   1.00 -0.13 -0.12  0.03  0.17 -0.13
## E2  -0.13  1.00  0.65  0.38 -0.53 -0.20
## E4  -0.12  0.65  1.00  0.34 -0.55 -0.22
## E6   0.03  0.38  0.34  1.00 -0.14 -0.15
## E8   0.17 -0.53 -0.55 -0.14  1.00  0.26
## E10 -0.13 -0.20 -0.22 -0.15  0.26  1.00
## 
## n= 145924 
## 
## 
## P
##     A2     A4     A6     A8     A9     A10    C1     C3     C5     C7    
## A2         0.0000 0.0000 0.0000 0.0000 0.0000 0.3844 0.0000 0.0000 0.0000
## A4  0.0000        0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## A6  0.0000 0.0000        0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## A8  0.0000 0.0000 0.0000        0.0000 0.0000 0.0000 0.0000 0.0006 0.5363
## A9  0.0000 0.0000 0.0000 0.0000        0.0000 0.0000 0.0000 0.0000 0.0000
## A10 0.0000 0.0000 0.0000 0.0000 0.0000        0.0016 0.0000 0.0000 0.0000
## C1  0.3844 0.0000 0.0000 0.0000 0.0000 0.0016        0.0000 0.0000 0.0000
## C3  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000        0.0000 0.0000
## C5  0.0000 0.0000 0.0000 0.0006 0.0000 0.0000 0.0000 0.0000        0.0000
## C7  0.0000 0.0000 0.0000 0.5363 0.0000 0.0000 0.0000 0.0000 0.0000       
## C9  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## C10 0.0352 0.0000 0.0000 0.0008 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## E1  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## E3  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## E5  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## E7  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0007 0.0000 0.0000
## E9  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## A1  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## A3  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## A5  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## A7  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## C2  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## C4  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## C6  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## C8  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## E2  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## E4  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## E6  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## E8  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## E10 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
##     C9     C10    E1     E3     E5     E7     E9     A1     A3     A5    
## A2  0.0000 0.0352 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## A4  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## A6  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## A8  0.0000 0.0008 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## A9  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## A10 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## C1  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## C3  0.0000 0.0000 0.0000 0.0000 0.0000 0.0007 0.0000 1.0000 1.0000 1.0000
## C5  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## C7  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## C9         0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## C10 0.0000        0.0000 0.0000 0.0000 0.0997 0.0000 1.0000 1.0000 1.0000
## E1  0.0000 0.0000        0.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## E3  0.0000 0.0000 0.0000        0.0000 0.0000 0.0000 1.0000 1.0000 1.0000
## E5  0.0000 0.0000 0.0000 0.0000        0.0000 0.0000 1.0000 1.0000 1.0000
## E7  0.0000 0.0997 0.0000 0.0000 0.0000        0.0000 1.0000 1.0000 1.0000
## E9  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000        1.0000 1.0000 1.0000
## A1  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000        0.0000 0.0000
## A3  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000        0.0000
## A5  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000       
## A7  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
## C2  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
## C4  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
## C6  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
## C8  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
## E2  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
## E4  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
## E6  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
## E8  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
## E10 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.0000 0.0000 0.0000
##     A7     C2     C4     C6     C8     E2     E4     E6     E8     E10   
## A2  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## A4  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## A6  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## A8  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## A9  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## A10 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## C1  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## C3  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## C5  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## C7  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## C9  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## C10 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## E1  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## E3  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## E5  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## E7  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## E9  1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
## A1  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## A3  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## A5  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## A7         0.6695 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## C2  0.6695        0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## C4  0.0000 0.0000        0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## C6  0.0000 0.0000 0.0000        0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## C8  0.0000 0.0000 0.0000 0.0000        0.0000 0.0000 0.0000 0.0000 0.0000
## E2  0.0000 0.0000 0.0000 0.0000 0.0000        0.0000 0.0000 0.0000 0.0000
## E4  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000        0.0000 0.0000 0.0000
## E6  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000        0.0000 0.0000
## E8  0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000        0.0000
## E10 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000

###Using ggcorrplot

#Using ggcorrplot. Note these are examples you need to choose a style for yourself, you do not need to create multiple correlation matrices
p.mat <- ggcorrplot::cor_pmat(raqData)
ggcorrplot::ggcorrplot(raqMatrix, title = "Correlation matrix for RAQ data")

#Showing Xs for non-significant correlations
ggcorrplot::ggcorrplot(raqMatrix, title = "Correlation matrix for RAQ data", p.mat = p.mat, sig.level = .05)

#Showing lower diagonal
ggcorrplot::ggcorrplot(raqMatrix, title = "Correlation matrix for RAQ data", p.mat = p.mat, sig.level = .05, type="lower")

#Overlay plot with a white grid to space things out.
#t1.cex is the text size, pch is controlling what is shown for non-significant correlations
ggcorrplot(raqMatrix, sig.level=0.05, lab_size = 4.5, p.mat = NULL,
           insig = c("pch", "blank"), pch = 1, pch.col = "black", pch.cex =1,
           tl.cex = 10) +
  theme(axis.text.x = element_text(margin=margin(-2,0,0,0)),
        axis.text.y = element_text(margin=margin(0,-2,0,0)),
        panel.grid.minor = element_line(size=10)) + 
  geom_tile(fill="white") +
  geom_tile(height=0.8, width=0.8)
## Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
## ℹ Please use the `linewidth` argument instead.

#Showing the co-coefficients (this will be messy given the number of variables)
ggcorrplot::ggcorrplot(raqMatrix, lab=TRUE, title = "Correlation matrix for RAQ data",  type="lower")

###Using corrplot

#Visualization of correlations using circles
#corrplot parameters method = c("circle", "square", "ellipse", "number", "shade",
#"color", "pie")
#type = c("full", "lower", "upper"),
corrplot::corrplot(raqMatrix, method="circle")

corrplot::corrplot(raqMatrix, method="circle", type="upper")

#Visualization using numbers
corrplot::corrplot(raqMatrix, method="number")

#Visualization of significance levels at 0.05
res1 <- corrplot::cor.mtest(raqMatrix, conf.level = .95)
corrplot::corrplot(raqMatrix, p.mat = res1$p, type="lower", sig.level = .05)

#Showing p-value for non-significant results
corrplot::corrplot(raqMatrix, p.mat = res1$p, type="lower",insig = "p-value")

##Step 2: Check if data is suitable - look at the relevant Statistics ###Bartlett’s test

psych::cortest.bartlett(raqData)
## R was not square, finding R from data
## $chisq
## [1] 1193147
## 
## $p.value
## [1] 0
## 
## $df
## [1] 435
psych::cortest.bartlett(raqMatrix, n=nrow(raqData))
## $chisq
## [1] 1193147
## 
## $p.value
## [1] 0
## 
## $df
## [1] 435

###KMO

#KMO (execute one of these):
REdaS::KMOS(raqData)
## 
## Kaiser-Meyer-Olkin Statistics
## 
## Call: REdaS::KMOS(x = raqData)
## 
## Measures of Sampling Adequacy (MSA):
##        A2        A4        A6        A8        A9       A10        C1        C3 
## 0.8163262 0.7587018 0.7965148 0.7254769 0.7654068 0.6972584 0.7668660 0.8084286 
##        C5        C7        C9       C10        E1        E3        E5        E7 
## 0.8587635 0.7152644 0.7505997 0.7782528 0.8291699 0.6867382 0.8102849 0.6191747 
##        E9        A1        A3        A5        A7        C2        C4        C6 
## 0.7610301 0.6684919 0.6400395 0.7976396 0.7705462 0.6398434 0.7826940 0.6283490 
##        C8        E2        E4        E6        E8       E10 
## 0.6513312 0.7569315 0.7705208 0.7062560 0.7345008 0.7968214 
## 
## KMO-Criterion: 0.7436294
psych::KMO(raqData)
## Kaiser-Meyer-Olkin factor adequacy
## Call: psych::KMO(r = raqData)
## Overall MSA =  0.74
## MSA for each item = 
##   A2   A4   A6   A8   A9  A10   C1   C3   C5   C7   C9  C10   E1   E3   E5   E7 
## 0.82 0.76 0.80 0.73 0.77 0.70 0.77 0.81 0.86 0.72 0.75 0.78 0.83 0.69 0.81 0.62 
##   E9   A1   A3   A5   A7   C2   C4   C6   C8   E2   E4   E6   E8  E10 
## 0.76 0.67 0.64 0.80 0.77 0.64 0.78 0.63 0.65 0.76 0.77 0.71 0.73 0.80

###Determinant

#Determinant (execute one of these):
det(raqMatrix)
## [1] 0.0002809986
det(cor(raqData))
## [1] 0.0002809986

##Step 3: Do the Dimension Reduction (PRINCIPAL COMPONENTS ANALYSIS)

library(FactoMineR)
library(factoextra)

pc1 <-  principal(raqData, nfactors = 23, rotate = "none")
pc1 <-  principal(raqData, nfactors = length(raqData), rotate = "none")
pc1
## Principal Components Analysis
## Call: principal(r = raqData, nfactors = length(raqData), rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
##       PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8   PC9  PC10  PC11  PC12
## A2   0.54  0.00  0.49  0.00  0.00  0.11  0.29  0.00  0.03 -0.08  0.00  0.00
## A4   0.48  0.00  0.41  0.00  0.00 -0.21  0.29  0.00  0.13  0.33  0.00  0.00
## A6   0.64  0.00  0.21  0.00  0.00  0.14  0.34  0.00 -0.02  0.12  0.00  0.00
## A8  -0.20  0.00 -0.23  0.00  0.00  0.60 -0.15  0.00 -0.09  0.02  0.00  0.00
## A9  -0.47  0.00 -0.21  0.00  0.00  0.51 -0.09  0.00 -0.18  0.00  0.00  0.00
## A10 -0.24  0.00 -0.05  0.00  0.00  0.62 -0.04  0.00  0.15  0.31  0.00  0.00
## C1   0.39  0.00 -0.41  0.00  0.00  0.13 -0.08  0.00  0.48  0.25  0.00  0.00
## C3   0.57  0.00 -0.28  0.00  0.00  0.34  0.20  0.00 -0.30 -0.10  0.00  0.00
## C5   0.47  0.00 -0.40  0.00  0.00  0.10 -0.01  0.00  0.05  0.34  0.00  0.00
## C7  -0.49  0.00  0.64  0.00  0.00  0.09  0.15  0.00 -0.26  0.14  0.00  0.00
## C9  -0.45  0.00  0.58  0.00  0.00  0.23 -0.01  0.00 -0.09  0.07  0.00  0.00
## C10 -0.51  0.00  0.60  0.00  0.00  0.01 -0.02  0.00  0.30  0.10  0.00  0.00
## E1   0.57  0.00  0.12  0.00  0.00  0.31  0.08  0.00 -0.01 -0.46  0.00  0.00
## E3   0.46  0.00  0.46  0.00  0.00  0.33 -0.46  0.00  0.18  0.00  0.00  0.00
## E5   0.58  0.00  0.46  0.00  0.00  0.28 -0.12  0.00 -0.11  0.01  0.00  0.00
## E7  -0.35  0.00 -0.25  0.00  0.00  0.22  0.73  0.00 -0.07  0.13  0.00  0.00
## E9  -0.37  0.00  0.00  0.00  0.00  0.24  0.33  0.00  0.60 -0.39  0.00  0.00
## A1   0.00  0.42  0.00  0.40  0.56  0.00  0.00 -0.04  0.00  0.00 -0.09 -0.27
## A3   0.00  0.34  0.00  0.45  0.61  0.00  0.00 -0.06  0.00  0.00  0.07  0.06
## A5   0.00  0.58  0.00  0.17  0.28  0.00  0.00 -0.22  0.00  0.00 -0.33 -0.30
## A7   0.00  0.40  0.00  0.34  0.33  0.00  0.00 -0.32  0.00  0.00  0.27  0.50
## C2   0.00  0.45  0.00 -0.58  0.31  0.00  0.00  0.31  0.00  0.00 -0.14 -0.03
## C4   0.00  0.40  0.00 -0.51  0.22  0.00  0.00  0.19  0.00  0.00 -0.08  0.44
## C6   0.00 -0.22  0.00  0.62 -0.01  0.00  0.00  0.56  0.00  0.00 -0.06 -0.09
## C8   0.00 -0.41  0.00  0.69 -0.19  0.00  0.00 -0.10  0.00  0.00  0.08  0.14
## E2   0.00  0.72  0.00  0.07 -0.41  0.00  0.00  0.14  0.00  0.00  0.22 -0.02
## E4   0.00  0.72  0.00  0.12 -0.40  0.00  0.00  0.05  0.00  0.00  0.23 -0.06
## E6   0.00  0.44  0.00  0.36 -0.14  0.00  0.00  0.61  0.00  0.00 -0.08  0.14
## E8   0.00 -0.62  0.00  0.04  0.48  0.00  0.00  0.31  0.00  0.00 -0.11  0.19
## E10  0.00 -0.21  0.00 -0.26  0.46  0.00  0.00  0.21  0.00  0.00  0.69 -0.29
##      PC13  PC14  PC15  PC16  PC17  PC18  PC19  PC20  PC21  PC22  PC23  PC24
## A2  -0.09 -0.15 -0.01  0.00  0.15 -0.14  0.00 -0.13  0.00  0.47  0.00 -0.14
## A4  -0.11  0.06  0.08  0.00 -0.36  0.35  0.00  0.02  0.00  0.09  0.00  0.08
## A6  -0.24 -0.10  0.07  0.00  0.36 -0.25  0.00  0.02  0.00 -0.21  0.00  0.14
## A8  -0.52  0.32  0.10  0.00 -0.26 -0.20  0.00 -0.11  0.00  0.06  0.00  0.06
## A9   0.14 -0.09  0.29  0.00  0.30  0.36  0.00 -0.16  0.00  0.19  0.00  0.09
## A10  0.05 -0.54 -0.29  0.00 -0.15 -0.05  0.00  0.09  0.00 -0.06  0.00  0.02
## C1   0.26  0.15  0.44  0.00  0.05 -0.14  0.00  0.16  0.00  0.03  0.00 -0.05
## C3  -0.06  0.11 -0.06  0.00  0.07  0.20  0.00  0.49  0.00  0.02  0.00  0.02
## C5   0.19  0.35 -0.47  0.00  0.15  0.03  0.00 -0.22  0.00  0.09  0.00  0.14
## C7   0.10  0.20 -0.05  0.00  0.00  0.07  0.00  0.11  0.00  0.00  0.00  0.05
## C9   0.31  0.27 -0.07  0.00  0.05 -0.26  0.00  0.14  0.00  0.02  0.00 -0.15
## C10 -0.08  0.03  0.13  0.00  0.10  0.01  0.00  0.04  0.00 -0.01  0.00  0.35
## E1   0.39 -0.02  0.03  0.00 -0.30 -0.11  0.00 -0.08  0.00  0.00  0.00  0.30
## E3  -0.03  0.02 -0.03  0.00 -0.09  0.11  0.00  0.05  0.00  0.06  0.00 -0.21
## E5   0.04  0.06  0.10  0.00  0.08  0.17  0.00 -0.25  0.00 -0.38  0.00 -0.14
## E7   0.13  0.02  0.15  0.00 -0.18 -0.03  0.00 -0.15  0.00 -0.09  0.00 -0.18
## E9  -0.12  0.17 -0.23  0.00  0.12  0.20  0.00  0.02  0.00 -0.07  0.00 -0.09
## A1   0.00  0.00  0.00 -0.06  0.00  0.00  0.26  0.00  0.11  0.00 -0.30  0.00
## A3   0.00  0.00  0.00 -0.11  0.00  0.00  0.27  0.00 -0.30  0.00  0.16  0.00
## A5   0.00  0.00  0.00  0.38  0.00  0.00 -0.33  0.00  0.11  0.00  0.21  0.00
## A7   0.00  0.00  0.00 -0.19  0.00  0.00 -0.36  0.00  0.15  0.00 -0.06  0.00
## C2   0.00  0.00  0.00 -0.29  0.00  0.00 -0.03  0.00 -0.01  0.00  0.23  0.00
## C4   0.00  0.00  0.00  0.40  0.00  0.00  0.26  0.00  0.22  0.00 -0.09  0.00
## C6   0.00  0.00  0.00 -0.16  0.00  0.00 -0.06  0.00  0.39  0.00 -0.03  0.00
## C8   0.00  0.00  0.00  0.30  0.00  0.00  0.19  0.00  0.01  0.00  0.22  0.00
## E2   0.00  0.00  0.00 -0.01  0.00  0.00  0.14  0.00  0.08  0.00  0.11  0.00
## E4   0.00  0.00  0.00 -0.09  0.00  0.00  0.08  0.00  0.09  0.00  0.21  0.00
## E6   0.00  0.00  0.00  0.18  0.00  0.00 -0.23  0.00 -0.37  0.00 -0.17  0.00
## E8   0.00  0.00  0.00 -0.03  0.00  0.00 -0.03  0.00  0.04  0.00  0.27  0.00
## E10  0.00  0.00  0.00  0.24  0.00  0.00 -0.11  0.00  0.01  0.00 -0.01  0.00
##      PC25  PC26  PC27  PC28  PC29  PC30 h2       u2 com
## A2   0.00  0.01 -0.18  0.00  0.00 -0.03  1 -4.4e-16 5.0
## A4   0.00 -0.18  0.12  0.00  0.00 -0.10  1  4.4e-16 7.3
## A6   0.00 -0.08  0.24  0.00  0.00  0.09  1 -6.7e-16 4.8
## A8   0.00 -0.07 -0.04  0.00  0.00 -0.02  1  8.9e-16 4.5
## A9   0.00 -0.09  0.14  0.00  0.00 -0.02  1 -6.7e-16 6.4
## A10  0.00 -0.08 -0.08  0.00  0.00 -0.01  1  7.8e-16 3.9
## C1   0.00 -0.08 -0.13  0.00  0.00  0.08  1 -8.9e-16 6.6
## C3   0.00  0.13 -0.09  0.00  0.00 -0.10  1  3.3e-16 5.1
## C5   0.00  0.08  0.00  0.00  0.00  0.01  1 -2.0e-15 6.3
## C7   0.00 -0.09 -0.15  0.00  0.00  0.37  1  0.0e+00 4.0
## C9   0.00 -0.13  0.16  0.00  0.00 -0.24  1 -1.1e-15 5.4
## C10  0.00  0.30 -0.10  0.00  0.00 -0.13  1 -4.4e-16 4.3
## E1   0.00 -0.02  0.04  0.00  0.00  0.04  1  1.1e-16 5.1
## E3   0.00  0.26  0.24  0.00  0.00  0.16  1 -6.7e-16 6.3
## E5   0.00 -0.03 -0.24  0.00  0.00 -0.11  1 -4.4e-16 5.1
## E7   0.00  0.28  0.06  0.00  0.00  0.02  1 -4.4e-16 3.2
## E9   0.00 -0.12  0.01  0.00  0.00  0.03  1  4.4e-16 5.1
## A1   0.25  0.00  0.00 -0.05  0.14  0.00  1  2.2e-16 5.5
## A3  -0.24  0.00  0.00  0.03 -0.17  0.00  1 -1.3e-15 4.7
## A5  -0.03  0.00  0.00  0.02 -0.06  0.00  1  0.0e+00 5.7
## A7   0.03  0.00  0.00  0.04  0.06  0.00  1 -6.7e-16 6.8
## C2  -0.06  0.00  0.00  0.13  0.30  0.00  1 -4.4e-16 5.2
## C4  -0.11  0.00  0.00 -0.04 -0.03  0.00  1 -8.9e-16 6.0
## C6  -0.24  0.00  0.00  0.05 -0.07  0.00  1 -2.2e-16 3.7
## C8   0.00  0.00  0.00  0.09  0.30  0.00  1 -8.9e-16 3.5
## E2   0.25  0.00  0.00  0.34 -0.16  0.00  1 -2.2e-16 3.1
## E4   0.01  0.00  0.00 -0.42  0.03  0.00  1 -2.2e-16 3.0
## E6   0.06  0.00  0.00 -0.04  0.06  0.00  1  1.1e-16 4.6
## E8   0.36  0.00  0.00 -0.12 -0.12  0.00  1  0.0e+00 4.3
## E10 -0.03  0.00  0.00  0.01  0.03  0.00  1  0.0e+00 3.5
## 
##                        PC1  PC2  PC3  PC4  PC5  PC6  PC7  PC8  PC9 PC10 PC11
## SS loadings           3.78 3.03 2.57 2.19 1.84 1.68 1.26 1.15 0.98 0.83 0.82
## Proportion Var        0.13 0.10 0.09 0.07 0.06 0.06 0.04 0.04 0.03 0.03 0.03
## Cumulative Var        0.13 0.23 0.31 0.39 0.45 0.50 0.54 0.58 0.62 0.64 0.67
## Proportion Explained  0.13 0.10 0.09 0.07 0.06 0.06 0.04 0.04 0.03 0.03 0.03
## Cumulative Proportion 0.13 0.23 0.31 0.39 0.45 0.50 0.54 0.58 0.62 0.64 0.67
##                       PC12 PC13 PC14 PC15 PC16 PC17 PC18 PC19 PC20 PC21 PC22
## SS loadings           0.78 0.78 0.75 0.73 0.66 0.65 0.60 0.58 0.51 0.49 0.48
## Proportion Var        0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02
## Cumulative Var        0.70 0.72 0.75 0.77 0.79 0.82 0.84 0.86 0.87 0.89 0.90
## Proportion Explained  0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02
## Cumulative Proportion 0.70 0.72 0.75 0.77 0.79 0.82 0.84 0.86 0.87 0.89 0.90
##                       PC23 PC24 PC25 PC26 PC27 PC28 PC29 PC30
## SS loadings           0.44 0.42 0.39 0.36 0.34 0.34 0.29 0.29
## Proportion Var        0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01
## Cumulative Var        0.92 0.93 0.95 0.96 0.97 0.98 0.99 1.00
## Proportion Explained  0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01
## Cumulative Proportion 0.92 0.93 0.95 0.96 0.97 0.98 0.99 1.00
## 
## Mean item complexity =  4.9
## Test of the hypothesis that 30 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0 
##  with the empirical chi square  0  with prob <  NA 
## 
## Fit based upon off diagonal values = 1

##Step 4: Decide which components to retain (PRINCIPAL COMPONENTS ANALYSIS)

#Create the scree plot
plot(pc1$values, type = "b") 

#Print the variance explained by each component
pc1$Vaccounted 
##                             PC1       PC2        PC3        PC4        PC5
## SS loadings           3.7811572 3.0314434 2.56674193 2.18807980 1.84295321
## Proportion Var        0.1260386 0.1010481 0.08555806 0.07293599 0.06143177
## Cumulative Var        0.1260386 0.2270867 0.31264475 0.38558074 0.44701252
## Proportion Explained  0.1260386 0.1010481 0.08555806 0.07293599 0.06143177
## Cumulative Proportion 0.1260386 0.2270867 0.31264475 0.38558074 0.44701252
##                              PC6        PC7        PC8       PC9       PC10
## SS loadings           1.67911966 1.25559669 1.14676396 0.9840960 0.83216797
## Proportion Var        0.05597066 0.04185322 0.03822547 0.0328032 0.02773893
## Cumulative Var        0.50298317 0.54483639 0.58306186 0.6158651 0.64360399
## Proportion Explained  0.05597066 0.04185322 0.03822547 0.0328032 0.02773893
## Cumulative Proportion 0.50298317 0.54483639 0.58306186 0.6158651 0.64360399
##                             PC11       PC12       PC13       PC14       PC15
## SS loadings           0.82135862 0.78162824 0.77752237 0.74986122 0.72938034
## Proportion Var        0.02737862 0.02605427 0.02591741 0.02499537 0.02431268
## Cumulative Var        0.67098261 0.69703689 0.72295430 0.74794967 0.77226235
## Proportion Explained  0.02737862 0.02605427 0.02591741 0.02499537 0.02431268
## Cumulative Proportion 0.67098261 0.69703689 0.72295430 0.74794967 0.77226235
##                             PC16       PC17       PC18       PC19       PC20
## SS loadings           0.65975589 0.65082581 0.60036339 0.58248721 0.50672605
## Proportion Var        0.02199186 0.02169419 0.02001211 0.01941624 0.01689087
## Cumulative Var        0.79425422 0.81594841 0.83596052 0.85537676 0.87226763
## Proportion Explained  0.02199186 0.02169419 0.02001211 0.01941624 0.01689087
## Cumulative Proportion 0.79425422 0.81594841 0.83596052 0.85537676 0.87226763
##                             PC21       PC22       PC23       PC24       PC25
## SS loadings           0.49015671 0.48443053 0.43872338 0.41813928 0.39221813
## Proportion Var        0.01633856 0.01614768 0.01462411 0.01393798 0.01307394
## Cumulative Var        0.88860619 0.90475387 0.91937798 0.93331596 0.94638990
## Proportion Explained  0.01633856 0.01614768 0.01462411 0.01393798 0.01307394
## Cumulative Proportion 0.88860619 0.90475387 0.91937798 0.93331596 0.94638990
##                             PC26       PC27       PC28       PC29        PC30
## SS loadings           0.36075432 0.33724836 0.33601327 0.28841819 0.285868905
## Proportion Var        0.01202514 0.01124161 0.01120044 0.00961394 0.009528964
## Cumulative Var        0.95841504 0.96965665 0.98085710 0.99047104 1.000000000
## Proportion Explained  0.01202514 0.01124161 0.01120044 0.00961394 0.009528964
## Cumulative Proportion 0.95841504 0.96965665 0.98085710 0.99047104 1.000000000
#Print the Eigenvalues
pc1$values
##  [1] 3.7811572 3.0314434 2.5667419 2.1880798 1.8429532 1.6791197 1.2555967
##  [8] 1.1467640 0.9840960 0.8321680 0.8213586 0.7816282 0.7775224 0.7498612
## [15] 0.7293803 0.6597559 0.6508258 0.6003634 0.5824872 0.5067261 0.4901567
## [22] 0.4844305 0.4387234 0.4181393 0.3922181 0.3607543 0.3372484 0.3360133
## [29] 0.2884182 0.2858689
#Another way to look at eigen values plus variance explained (need to use princomp function of PCA to get right class for use with factoextra functions)
pcf=princomp(raqData)
factoextra::get_eigenvalue(pcf)
##        eigenvalue variance.percent cumulative.variance.percent
## Dim.1   4.5131374       11.9571129                    11.95711
## Dim.2   4.4539971       11.8004266                    23.75754
## Dim.3   3.2091308        8.5022759                    32.25982
## Dim.4   3.0518290        8.0855203                    40.34534
## Dim.5   2.3205171        6.1479815                    46.49332
## Dim.6   1.9376089        5.1335040                    51.62682
## Dim.7   1.6444247        4.3567411                    55.98356
## Dim.8   1.4317998        3.7934126                    59.77697
## Dim.9   1.1900148        3.1528270                    62.92980
## Dim.10  1.1266262        2.9848851                    65.91469
## Dim.11  1.0748000        2.8475767                    68.76226
## Dim.12  0.9950349        2.6362469                    71.39851
## Dim.13  0.9921160        2.6285135                    74.02702
## Dim.14  0.8974046        2.3775851                    76.40461
## Dim.15  0.8697062        2.3042009                    78.70881
## Dim.16  0.8121870        2.1518095                    80.86062
## Dim.17  0.6934753        1.8372944                    82.69791
## Dim.18  0.6921428        1.8337641                    84.53168
## Dim.19  0.6336039        1.6786712                    86.21035
## Dim.20  0.6088227        1.6130159                    87.82337
## Dim.21  0.5572879        1.4764794                    89.29984
## Dim.22  0.5365033        1.4214128                    90.72126
## Dim.23  0.5270572        1.3963862                    92.11764
## Dim.24  0.5028285        1.3321946                    93.44984
## Dim.25  0.4832574        1.2803429                    94.73018
## Dim.26  0.4675009        1.2385977                    95.96878
## Dim.27  0.4288483        1.1361914                    97.10497
## Dim.28  0.3930651        1.0413874                    98.14636
## Dim.29  0.3843323        1.0182505                    99.16461
## Dim.30  0.3153135        0.8353921                   100.00000
factoextra::fviz_eig(pcf, addlabels = TRUE, ylim = c(0, 50))#Visualize the Eigenvalues

factoextra::fviz_pca_var(pcf, col.var = "black")

factoextra::fviz_pca_var(pcf, col.var = "cos2",
             gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"), 
             repel = TRUE # Avoid text overlapping
             )

#Print the loadings above the level of 0.3
psych::print.psych(pc1, cut = 0.3, sort = TRUE)
## Principal Components Analysis
## Call: principal(r = raqData, nfactors = length(raqData), rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
##     item   PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8   PC9  PC10  PC11
## A6     3  0.64                                0.34                        
## E5    15  0.58        0.46                                                
## C3     8  0.57                          0.34             -0.30            
## E1    13  0.57                          0.31                   -0.46      
## A2     1  0.54        0.49                                                
## A4     2  0.48        0.41                                      0.33      
## E4    27        0.72             -0.40                                    
## E2    26        0.72             -0.41                                    
## E8    29       -0.62              0.48              0.31                  
## A5    20        0.58                                                 -0.33
## C7    10 -0.49        0.64                                                
## C10   12 -0.51        0.60                                                
## C9    11 -0.45        0.58                                                
## C8    25       -0.41        0.69                                          
## C6    24                    0.62                    0.56                  
## C2    22        0.45       -0.58  0.31              0.31                  
## C4    23        0.40       -0.51                                          
## A3    19        0.34        0.45  0.61                                    
## A1    18        0.42        0.40  0.56                                    
## A10    6                                0.62                    0.31      
## A8     4                                0.60                              
## A9     5 -0.47                          0.51                              
## E7    16 -0.35                                0.73                        
## E3    14  0.46        0.46              0.33 -0.46                        
## E6    28        0.44        0.36                    0.61                  
## E9    17 -0.37                                0.33        0.60 -0.39      
## C1     7  0.39       -0.41                                0.48            
## E10   30                          0.46                                0.69
## A7    21        0.40        0.34  0.33             -0.32                  
## C5     9  0.47       -0.40                                      0.34      
##      PC12  PC13  PC14  PC15  PC16  PC17  PC18  PC19  PC20  PC21  PC22  PC23
## A6                                 0.36                                    
## E5                                                              -0.38      
## C3                                                   0.49                  
## E1         0.39                                                            
## A2                                                               0.47      
## A4                                -0.36  0.35                              
## E4                                                                         
## E2                                                                         
## E8                                                                         
## A5                           0.38             -0.33                        
## C7                                                                         
## C10                                                                        
## C9         0.31                                                            
## C8                           0.30                                          
## C6                                                         0.39            
## C2                                                                         
## C4   0.44                    0.40                                          
## A3                                                        -0.30            
## A1                                                                    -0.30
## A10             -0.54                                                      
## A8        -0.52  0.32                                                      
## A9                                       0.36                              
## E7                                                                         
## E3                                                                         
## E6                                                        -0.37            
## E9                                                                         
## C1                     0.44                                                
## E10                                                                        
## A7   0.50                                     -0.36                        
## C5               0.35 -0.47                                                
##      PC24  PC25  PC26  PC27  PC28  PC29  PC30 h2       u2 com
## A6                                             1 -6.7e-16 4.8
## E5                                             1 -4.4e-16 5.1
## C3                                             1  3.3e-16 5.1
## E1   0.30                                      1  1.1e-16 5.1
## A2                                             1 -4.4e-16 5.0
## A4                                             1  4.4e-16 7.3
## E4                          -0.42              1 -2.2e-16 3.0
## E2                           0.34              1 -2.2e-16 3.1
## E8         0.36                                1  0.0e+00 4.3
## A5                                             1  0.0e+00 5.7
## C7                                       0.37  1  0.0e+00 4.0
## C10  0.35        0.30                          1 -4.4e-16 4.3
## C9                                             1 -1.1e-15 5.4
## C8                                 0.30        1 -8.9e-16 3.5
## C6                                             1 -2.2e-16 3.7
## C2                                             1 -4.4e-16 5.2
## C4                                             1 -8.9e-16 6.0
## A3                                             1 -1.3e-15 4.7
## A1                                             1  2.2e-16 5.5
## A10                                            1  7.8e-16 3.9
## A8                                             1  8.9e-16 4.5
## A9                                             1 -6.7e-16 6.4
## E7                                             1 -4.4e-16 3.2
## E3                                             1 -6.7e-16 6.3
## E6                                             1  1.1e-16 4.6
## E9                                             1  4.4e-16 5.1
## C1                                             1 -8.9e-16 6.6
## E10                                            1  0.0e+00 3.5
## A7                                             1 -6.7e-16 6.8
## C5                                             1 -2.0e-15 6.3
## 
##                        PC1  PC2  PC3  PC4  PC5  PC6  PC7  PC8  PC9 PC10 PC11
## SS loadings           3.78 3.03 2.57 2.19 1.84 1.68 1.26 1.15 0.98 0.83 0.82
## Proportion Var        0.13 0.10 0.09 0.07 0.06 0.06 0.04 0.04 0.03 0.03 0.03
## Cumulative Var        0.13 0.23 0.31 0.39 0.45 0.50 0.54 0.58 0.62 0.64 0.67
## Proportion Explained  0.13 0.10 0.09 0.07 0.06 0.06 0.04 0.04 0.03 0.03 0.03
## Cumulative Proportion 0.13 0.23 0.31 0.39 0.45 0.50 0.54 0.58 0.62 0.64 0.67
##                       PC12 PC13 PC14 PC15 PC16 PC17 PC18 PC19 PC20 PC21 PC22
## SS loadings           0.78 0.78 0.75 0.73 0.66 0.65 0.60 0.58 0.51 0.49 0.48
## Proportion Var        0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02
## Cumulative Var        0.70 0.72 0.75 0.77 0.79 0.82 0.84 0.86 0.87 0.89 0.90
## Proportion Explained  0.03 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02
## Cumulative Proportion 0.70 0.72 0.75 0.77 0.79 0.82 0.84 0.86 0.87 0.89 0.90
##                       PC23 PC24 PC25 PC26 PC27 PC28 PC29 PC30
## SS loadings           0.44 0.42 0.39 0.36 0.34 0.34 0.29 0.29
## Proportion Var        0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01
## Cumulative Var        0.92 0.93 0.95 0.96 0.97 0.98 0.99 1.00
## Proportion Explained  0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01
## Cumulative Proportion 0.92 0.93 0.95 0.96 0.97 0.98 0.99 1.00
## 
## Mean item complexity =  4.9
## Test of the hypothesis that 30 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0 
##  with the empirical chi square  0  with prob <  NA 
## 
## Fit based upon off diagonal values = 1
#create a diagram showing the components and how the manifest variables load
fa.diagram(pc1) 

#Show the loadings of variables on to components
fa.sort(pc1$loading)
## 
## Loadings:
##     PC1    PC2    PC3    PC4    PC5    PC6    PC7    PC8    PC9    PC10  
## A6   0.636         0.210                0.140  0.338                0.117
## E5   0.582         0.457                0.283 -0.123        -0.108       
## C3   0.569        -0.282                0.340  0.198        -0.305 -0.102
## E1   0.565         0.123                0.307                      -0.460
## A2   0.541         0.488                0.115  0.290                     
## A4   0.484         0.413               -0.208  0.287         0.132  0.328
## E4          0.724         0.124 -0.397                                   
## E2          0.722               -0.408                0.143              
## E8         -0.618                0.484                0.312              
## A5          0.576         0.167  0.281               -0.225              
## C7  -0.487         0.642                       0.149        -0.257  0.138
## C10 -0.511         0.601                                     0.300  0.104
## C9  -0.449         0.584                0.231                            
## C8         -0.407         0.695 -0.190                                   
## C6         -0.224         0.619                       0.559              
## C2          0.447        -0.582  0.308                0.309              
## C4          0.400        -0.508  0.215                0.188              
## A3          0.338         0.452  0.611                                   
## A1          0.423         0.397  0.564                                   
## A10 -0.238                              0.623                0.152  0.312
## A8  -0.203        -0.226                0.598 -0.149                     
## A9  -0.473        -0.211                0.513               -0.183       
## E7  -0.349        -0.248                0.216  0.727                0.133
## E3   0.463         0.459                0.330 -0.464         0.177       
## E6          0.442         0.361 -0.142                0.607              
## E9  -0.370                              0.245  0.330         0.602 -0.392
## C1   0.393        -0.405                0.132                0.480  0.245
## E10        -0.213        -0.263  0.458                0.213              
## A7          0.404         0.338  0.326               -0.321              
## C5   0.470        -0.401                                            0.343
##     PC11   PC12   PC13   PC14   PC15   PC16   PC17   PC18   PC19   PC20  
## A6                -0.244 -0.104                0.364 -0.245              
## E5                                                    0.170        -0.250
## C3                        0.109                       0.200         0.489
## E1                 0.386                      -0.299 -0.112              
## A2                       -0.155                0.151 -0.137        -0.131
## A4                -0.112                      -0.356  0.348              
## E4   0.232                                                               
## E2   0.219                                                   0.140       
## E8  -0.109  0.193                                                        
## A5  -0.329 -0.300                       0.381               -0.326       
## C7                        0.197                                     0.110
## C10                              0.125         0.104                     
## C9                 0.313  0.271                      -0.265         0.145
## C8          0.140                       0.303                0.191       
## C6                                     -0.156                            
## C2  -0.141                             -0.294                            
## C4          0.439                       0.402                0.264       
## A3                                     -0.106                0.274       
## A1         -0.273                                            0.265       
## A10                      -0.541 -0.291        -0.147                     
## A8                -0.523  0.323  0.105        -0.255 -0.201        -0.106
## A9                 0.141         0.292         0.297  0.359        -0.155
## E7                 0.131         0.155        -0.183               -0.152
## E3                                                    0.107              
## E6          0.137                       0.183               -0.233       
## E9                -0.118  0.170 -0.233         0.120  0.199              
## C1                 0.259  0.154  0.441               -0.136         0.164
## E10  0.689 -0.286                       0.242               -0.114       
## A7   0.266  0.501                      -0.186               -0.356       
## C5                 0.188  0.353 -0.473         0.148               -0.221
##     PC21   PC22   PC23   PC24   PC25   PC26   PC27   PC28   PC29   PC30  
## A6         -0.206         0.144                0.239                     
## E5         -0.381        -0.141               -0.236               -0.109
## C3                                      0.127                            
## E1                        0.300                                          
## A2          0.470        -0.136               -0.184                     
## A4                                     -0.183  0.125               -0.101
## E4                 0.210                             -0.416              
## E2                 0.114         0.248                0.336 -0.161       
## E8                 0.270         0.361               -0.119 -0.124       
## A5   0.114         0.209                                                 
## C7                                            -0.150                0.365
## C10                       0.349         0.303 -0.102               -0.127
## C9                       -0.146        -0.125  0.155               -0.244
## C8                 0.225                                     0.304       
## C6   0.386                      -0.243                                   
## C2                 0.234                              0.128  0.295       
## C4   0.220                      -0.106                                   
## A3  -0.305         0.163        -0.242                      -0.174       
## A1   0.114        -0.302         0.247                       0.139       
## A10                                                                      
## A8                                                                       
## A9          0.186                              0.140                     
## E7                       -0.177         0.275                            
## E3                       -0.208         0.257  0.242                0.159
## E6  -0.369        -0.169                                                 
## E9                                     -0.116                            
## C1                                            -0.131                     
## E10                                                                      
## A7   0.146                                                               
## C5                        0.140                                          
## 
##                  PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8   PC9  PC10
## SS loadings    3.781 3.031 2.567 2.188 1.843 1.679 1.256 1.147 0.984 0.832
## Proportion Var 0.126 0.101 0.086 0.073 0.061 0.056 0.042 0.038 0.033 0.028
## Cumulative Var 0.126 0.227 0.313 0.386 0.447 0.503 0.545 0.583 0.616 0.644
##                 PC11  PC12  PC13  PC14  PC15  PC16  PC17  PC18  PC19  PC20
## SS loadings    0.821 0.782 0.778 0.750 0.729 0.660 0.651 0.600 0.582 0.507
## Proportion Var 0.027 0.026 0.026 0.025 0.024 0.022 0.022 0.020 0.019 0.017
## Cumulative Var 0.671 0.697 0.723 0.748 0.772 0.794 0.816 0.836 0.855 0.872
##                 PC21  PC22  PC23  PC24  PC25  PC26  PC27  PC28  PC29  PC30
## SS loadings    0.490 0.484 0.439 0.418 0.392 0.361 0.337 0.336 0.288 0.286
## Proportion Var 0.016 0.016 0.015 0.014 0.013 0.012 0.011 0.011 0.010 0.010
## Cumulative Var 0.889 0.905 0.919 0.933 0.946 0.958 0.970 0.981 0.990 1.000
#Output the communalities of variables across components (will be one for PCA since all the variance is used)
pc1$communality 
##  A2  A4  A6  A8  A9 A10  C1  C3  C5  C7  C9 C10  E1  E3  E5  E7  E9  A1  A3  A5 
##   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1 
##  A7  C2  C4  C6  C8  E2  E4  E6  E8 E10 
##   1   1   1   1   1   1   1   1   1   1
#Visualize contribution of variables to each component
var <- factoextra::get_pca_var(pcf)
corrplot::corrplot(var$contrib, is.corr=FALSE) 

# Contributions of variables to PC1
factoextra::fviz_contrib(pcf, choice = "var", axes = 1, top = 10)

# Contributions of variables to PC2
factoextra::fviz_contrib(pcf, choice = "var", axes = 2, top = 10)

##Step 5: Apply rotation

#Apply rotation to try to refine the component structure
pc2 <-  principal(raqData, nfactors = 4, rotate = "varimax")#Extracting 4 factors
#output the components
psych::print.psych(pc2, cut = 0.3, sort = TRUE)
## Principal Components Analysis
## Call: principal(r = raqData, nfactors = 4, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
##     item   RC1   RC3   RC2   RC4    h2   u2 com
## E5    15  0.74                   0.547 0.45 1.0
## A2     1  0.73                   0.530 0.47 1.0
## E3    14  0.65                   0.425 0.58 1.0
## A4     2  0.64                   0.405 0.60 1.0
## A6     3  0.63                   0.448 0.55 1.3
## E1    13  0.52                   0.334 0.67 1.5
## A9     5 -0.50                   0.268 0.73 1.1
## E7    16 -0.43                   0.183 0.82 1.0
## A8     4                         0.092 0.91 1.1
## E9    17                         0.137 0.86 1.9
## A10    6                         0.059 0.94 1.5
## C7    10        0.81             0.649 0.35 1.0
## C10   12        0.79             0.623 0.38 1.0
## C9    11        0.74             0.542 0.46 1.0
## C5     9       -0.61             0.382 0.62 1.1
## C3     8       -0.58             0.403 0.60 1.4
## C1     7       -0.56             0.318 0.68 1.0
## E4    27              0.68       0.539 0.46 1.3
## E2    26              0.64  0.33 0.526 0.47 1.5
## A5    20              0.57       0.360 0.64 1.2
## A1    18              0.57       0.337 0.66 1.1
## E6    28              0.57       0.325 0.67 1.0
## A3    19              0.53       0.319 0.68 1.3
## A7    21              0.52       0.277 0.72 1.0
## E8    29             -0.50 -0.37 0.384 0.62 1.8
## E10   30             -0.32       0.114 0.89 1.2
## C8    25                   -0.80 0.648 0.35 1.0
## C2    22                    0.73 0.539 0.46 1.0
## C4    23                    0.64 0.418 0.58 1.0
## C6    24                   -0.64 0.433 0.57 1.1
## 
##                        RC1  RC3  RC2  RC4
## SS loadings           3.31 3.04 2.78 2.43
## Proportion Var        0.11 0.10 0.09 0.08
## Cumulative Var        0.11 0.21 0.30 0.39
## Proportion Explained  0.29 0.26 0.24 0.21
## Cumulative Proportion 0.29 0.55 0.79 1.00
## 
## Mean item complexity =  1.2
## Test of the hypothesis that 4 components are sufficient.
## 
## The root mean square of the residuals (RMSR) is  0.08 
##  with the empirical chi square  730418.6  with prob <  0 
## 
## Fit based upon off diagonal values = 0.77
#output the communalities
pc2$communality
##         A2         A4         A6         A8         A9        A10         C1 
## 0.53012409 0.40492762 0.44830621 0.09195115 0.26848736 0.05922192 0.31842729 
##         C3         C5         C7         C9        C10         E1         E3 
## 0.40344971 0.38183330 0.64938704 0.54248756 0.62253630 0.33449514 0.42455675 
##         E5         E7         E9         A1         A3         A5         A7 
## 0.54732492 0.18334598 0.13703675 0.33662626 0.31906643 0.35966898 0.27726618 
##         C2         C4         C6         C8         E2         E4         E6 
## 0.53893561 0.41779499 0.43307883 0.64813252 0.52570779 0.53938739 0.32548441 
##         E8        E10 
## 0.38389165 0.11448214
#NOTE: you can do all the other things done for the model created in pc1

##Step 6: Reliability Analysis

#If you know that variables are grouped, test each group as a separate scale
Agreeableness <- raqData[,c("A1","A2","A3","A4","A5","A6","A7","A8","A9","A10")]
Conscientiousness <- raqData[,c("C1","C2","C3","C4","C5","C6","C7","C8","C9","C10")]
Extraversion <- raqData[,c("E1","E2","E3","E4","E5","E6","E7","E8","E9","E10")]

head(raqData)
##   A2 A4 A6 A8 A9 A10 C1 C3 C5 C7 C9 C10 E1 E3 E5 E7 E9 A1 A3 A5 A7 C2 C4 C6 C8
## 1  3  2  2  5  2   3  2  4  2  5  4   2  2  4  5  1  3  2  2  2  3  5  4  2  1
## 2  4  4  4  3  2   3  4  5  3  2  1   1  4  5  5  1  1  2  2  2  3  5  4  2  1
## 3  5  5  5  2  1   2  4  4  4  2  2   3  3  5  5  1  2  2  2  2  3  5  4  2  1
## 4  5  4  5  3  1   2  2  3  2  3  4   2  3  4  4  2  1  2  2  2  3  5  4  2  1
## 5  3  4  4  3  4   4  2  2  1  4  3   2  2  3  4  5  4  2  2  2  3  5  4  2  1
## 6  4  3  3  3  3   3  3  3  3  3  2   2  3  4  4  2  2  2  2  2  3  5  4  2  1
##   E2 E4 E6 E8 E10
## 1  3  4  1  4   5
## 2  3  4  1  4   5
## 3  3  4  1  4   5
## 4  3  4  1  4   5
## 5  3  4  1  4   5
## 6  3  4  1  4   5
#Output our Cronbach Alpha values
psych::alpha(Agreeableness)
## Warning in psych::alpha(Agreeableness): Some items were negatively correlated with the total scale and probably 
## should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## Some items ( A1 A3 A5 A7 A8 A9 A10 ) were negatively correlated with the total scale and 
## probably should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## 
## Reliability analysis   
## Call: psych::alpha(x = Agreeableness)
## 
##   raw_alpha std.alpha G6(smc) average_r  S/N    ase mean   sd median_r
##       0.37      0.38    0.51     0.057 0.61 0.0025  2.7 0.39  3.2e-21
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.37  0.37  0.37
## Duhachek  0.37  0.37  0.37
## 
##  Reliability if an item is dropped:
##     raw_alpha std.alpha G6(smc) average_r  S/N alpha se var.r   med.r
## A1       0.23      0.25    0.39     0.036 0.34   0.0031 0.043 3.0e-22
## A2       0.37      0.37    0.48     0.061 0.58   0.0025 0.042 3.1e-21
## A3       0.24      0.25    0.39     0.036 0.34   0.0030 0.043 3.0e-22
## A4       0.42      0.42    0.52     0.073 0.71   0.0023 0.040 3.4e-21
## A5       0.29      0.29    0.45     0.044 0.42   0.0028 0.049 3.1e-21
## A6       0.36      0.37    0.48     0.060 0.58   0.0025 0.044 3.4e-21
## A7       0.29      0.29    0.45     0.044 0.42   0.0028 0.049 3.3e-21
## A8       0.41      0.41    0.53     0.071 0.68   0.0023 0.048 3.2e-21
## A9       0.42      0.44    0.54     0.081 0.79   0.0023 0.040 3.3e-21
## A10      0.38      0.39    0.52     0.066 0.63   0.0024 0.051 3.4e-21
## 
##  Item statistics 
##          n raw.r std.r  r.cor r.drop mean   sd
## A1  145924  0.60  0.59  0.599  0.365  2.3 1.13
## A2  145924  0.34  0.36  0.259  0.091  3.9 1.00
## A3  145924  0.59  0.58  0.592  0.367  2.2 1.08
## A4  145924  0.23  0.24  0.074 -0.035  3.8 1.02
## A5  145924  0.48  0.51  0.423  0.285  2.1 0.87
## A6  145924  0.34  0.36  0.253  0.109  3.7 0.92
## A7  145924  0.48  0.51  0.421  0.283  2.1 0.86
## A8  145924  0.31  0.26  0.059  0.010  3.0 1.16
## A9  145924  0.18  0.17 -0.028 -0.068  2.0 0.98
## A10 145924  0.33  0.31  0.120  0.067  2.4 1.05
## 
## Non missing response frequency for each item
##        0    1    2    3    4    5    6 miss
## A1  0.00 0.23 0.47 0.14 0.12 0.03 0.01    0
## A2  0.01 0.02 0.06 0.18 0.48 0.26 0.00    0
## A3  0.00 0.25 0.47 0.15 0.08 0.03 0.01    0
## A4  0.01 0.02 0.08 0.17 0.51 0.20 0.00    0
## A5  0.00 0.25 0.52 0.17 0.05 0.01 0.00    0
## A6  0.01 0.02 0.05 0.25 0.49 0.18 0.00    0
## A7  0.00 0.22 0.59 0.10 0.07 0.01 0.00    0
## A8  0.01 0.07 0.30 0.26 0.25 0.10 0.00    0
## A9  0.02 0.31 0.43 0.15 0.08 0.01 0.00    0
## A10 0.01 0.17 0.43 0.21 0.15 0.03 0.00    0
#If some items are to be reversed keyed, then either recode or get alpha to reverse code as needed by setting check.keys=TRUE (be careful with this - make sure you know it makes sense)
psych::alpha(Extraversion)
## Warning in psych::alpha(Extraversion): Some items were negatively correlated with the total scale and probably 
## should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## Some items ( E7 E8 E10 ) were negatively correlated with the total scale and 
## probably should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## 
## Reliability analysis   
## Call: psych::alpha(x = Extraversion)
## 
##   raw_alpha std.alpha G6(smc) average_r   S/N    ase mean   sd median_r
##      0.029     0.034    0.31    0.0035 0.035 0.0038  3.1 0.37 -4.7e-21
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.02  0.03  0.04
## Duhachek  0.02  0.03  0.04
## 
##  Reliability if an item is dropped:
##     raw_alpha std.alpha G6(smc) average_r    S/N alpha se var.r    med.r
## E1     -0.088    -0.109    0.22   -0.0110 -0.098   0.0042 0.060 -6.2e-21
## E2     -0.077    -0.040    0.21   -0.0042 -0.038   0.0043 0.043 -4.8e-21
## E3     -0.019    -0.036    0.22   -0.0039 -0.035   0.0040 0.051 -8.6e-21
## E4     -0.058    -0.020    0.22   -0.0021 -0.019   0.0042 0.043 -6.0e-21
## E5     -0.060    -0.085    0.20   -0.0088 -0.078   0.0041 0.052 -4.5e-21
## E6     -0.118    -0.072    0.25   -0.0075 -0.067   0.0044 0.060 -7.6e-21
## E7      0.132     0.154    0.38    0.0198  0.182   0.0034 0.058 -4.5e-21
## E8      0.256     0.223    0.41    0.0309  0.287   0.0029 0.048 -4.5e-21
## E9      0.055     0.073    0.35    0.0086  0.079   0.0037 0.065 -3.3e-21
## E10     0.109     0.104    0.37    0.0128  0.116   0.0034 0.063 -3.7e-21
## 
##  Item statistics 
##          n   raw.r std.r  r.cor r.drop mean   sd
## E1  145924  0.4570 0.483  0.411  0.158  2.6 1.17
## E2  145924  0.4699 0.407  0.453  0.127  3.1 1.33
## E3  145924  0.3514 0.404  0.387  0.078  3.9 1.04
## E4  145924  0.4367 0.384  0.411  0.113  3.3 1.25
## E5  145924  0.3960 0.458  0.464  0.152  3.9 0.95
## E6  145924  0.5021 0.444  0.337  0.176  3.2 1.30
## E7  145924  0.1451 0.138 -0.185 -0.153  2.1 1.11
## E8  145924 -0.0058 0.013 -0.328 -0.322  2.9 1.25
## E9  145924  0.2349 0.263 -0.044 -0.038  2.0 1.01
## E10 145924  0.2046 0.217 -0.124 -0.110  3.7 1.17
## 
## Non missing response frequency for each item
##        0    1    2    3    4    5    6 miss
## E1  0.01 0.20 0.31 0.27 0.15 0.06 0.00    0
## E2  0.00 0.13 0.28 0.19 0.23 0.16 0.01    0
## E3  0.01 0.02 0.07 0.15 0.45 0.31 0.00    0
## E4  0.00 0.07 0.24 0.21 0.27 0.20 0.01    0
## E5  0.02 0.01 0.04 0.13 0.54 0.25 0.00    0
## E6  0.00 0.12 0.22 0.20 0.29 0.16 0.01    0
## E7  0.01 0.35 0.37 0.12 0.12 0.03 0.00    0
## E8  0.00 0.16 0.25 0.22 0.28 0.08 0.01    0
## E9  0.01 0.29 0.46 0.14 0.07 0.03 0.00    0
## E10 0.00 0.05 0.12 0.15 0.39 0.27 0.01    0
psych::alpha(Conscientiousness)
## Warning in psych::alpha(Conscientiousness): Some items were negatively correlated with the total scale and probably 
## should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## Some items ( C1 C2 C3 C5 C6 C8 ) were negatively correlated with the total scale and 
## probably should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## 
## Reliability analysis   
## Call: psych::alpha(x = Conscientiousness)
## 
##   raw_alpha std.alpha G6(smc) average_r   S/N    ase mean   sd median_r
##      -0.37     -0.39    0.11    -0.029 -0.28 0.0055  2.9 0.32 -9.7e-21
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt    -0.38 -0.37 -0.36
## Duhachek -0.38 -0.37 -0.36
## 
##  Reliability if an item is dropped:
##     raw_alpha std.alpha G6(smc) average_r   S/N alpha se var.r    med.r
## C1      -0.23     -0.27   0.189    -0.024 -0.21   0.0048 0.079 -5.1e-21
## C2      -0.23     -0.27   0.127    -0.024 -0.21   0.0049 0.074 -1.4e-20
## C3      -0.25     -0.25   0.194    -0.023 -0.20   0.0049 0.077 -7.7e-21
## C4      -0.31     -0.35   0.140    -0.030 -0.26   0.0052 0.080 -9.2e-21
## C5      -0.25     -0.29   0.175    -0.026 -0.22   0.0049 0.076 -4.3e-21
## C6      -0.37     -0.38   0.134    -0.032 -0.28   0.0055 0.084 -7.7e-21
## C7      -0.50     -0.49  -0.025    -0.038 -0.33   0.0060 0.062 -1.1e-20
## C8      -0.18     -0.20   0.172    -0.018 -0.16   0.0047 0.074 -7.7e-21
## C9      -0.61     -0.59  -0.046    -0.043 -0.37   0.0065 0.067 -9.2e-21
## C10     -0.42     -0.39   0.071    -0.032 -0.28   0.0057 0.065 -1.4e-20
## 
##  Item statistics 
##          n raw.r std.r   r.cor  r.drop mean  sd
## C1  145924  0.18  0.20 -0.2326 -0.1822  2.8 1.2
## C2  145924  0.19  0.21  0.0129 -0.1831  2.3 1.2
## C3  145924  0.13  0.19 -0.2582 -0.1762  3.4 1.0
## C4  145924  0.25  0.28 -0.0018 -0.1047  2.6 1.1
## C5  145924  0.20  0.23 -0.1515 -0.1608  2.9 1.2
## C6  145924  0.34  0.31  0.0023 -0.0555  3.1 1.3
## C7  145924  0.42  0.39  0.6570  0.0388  2.8 1.3
## C8  145924  0.16  0.13 -0.2044 -0.2178  3.6 1.2
## C9  145924  0.48  0.46  0.7466  0.1292  2.3 1.2
## C10 145924  0.34  0.32  0.3273 -0.0087  2.5 1.1
## 
## Non missing response frequency for each item
##        0    1    2    3    4    5    6 miss
## C1  0.01 0.12 0.30 0.26 0.23 0.09 0.00    0
## C2  0.00 0.25 0.43 0.13 0.12 0.06 0.01    0
## C3  0.01 0.03 0.13 0.26 0.47 0.10 0.00    0
## C4  0.00 0.12 0.44 0.20 0.18 0.05 0.02    0
## C5  0.00 0.09 0.35 0.20 0.26 0.10 0.00    0
## C6  0.00 0.13 0.21 0.21 0.30 0.14 0.01    0
## C7  0.01 0.13 0.36 0.21 0.16 0.13 0.00    0
## C8  0.00 0.08 0.12 0.20 0.30 0.31 0.00    0
## C9  0.01 0.27 0.37 0.15 0.15 0.05 0.00    0
## C10 0.01 0.15 0.42 0.19 0.19 0.05 0.00    0
psych::alpha(Agreeableness)
## Warning in psych::alpha(Agreeableness): Some items were negatively correlated with the total scale and probably 
## should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## Some items ( A1 A3 A5 A7 A8 A9 A10 ) were negatively correlated with the total scale and 
## probably should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## 
## Reliability analysis   
## Call: psych::alpha(x = Agreeableness)
## 
##   raw_alpha std.alpha G6(smc) average_r  S/N    ase mean   sd median_r
##       0.37      0.38    0.51     0.057 0.61 0.0025  2.7 0.39  3.2e-21
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.37  0.37  0.37
## Duhachek  0.37  0.37  0.37
## 
##  Reliability if an item is dropped:
##     raw_alpha std.alpha G6(smc) average_r  S/N alpha se var.r   med.r
## A1       0.23      0.25    0.39     0.036 0.34   0.0031 0.043 3.0e-22
## A2       0.37      0.37    0.48     0.061 0.58   0.0025 0.042 3.1e-21
## A3       0.24      0.25    0.39     0.036 0.34   0.0030 0.043 3.0e-22
## A4       0.42      0.42    0.52     0.073 0.71   0.0023 0.040 3.4e-21
## A5       0.29      0.29    0.45     0.044 0.42   0.0028 0.049 3.1e-21
## A6       0.36      0.37    0.48     0.060 0.58   0.0025 0.044 3.4e-21
## A7       0.29      0.29    0.45     0.044 0.42   0.0028 0.049 3.3e-21
## A8       0.41      0.41    0.53     0.071 0.68   0.0023 0.048 3.2e-21
## A9       0.42      0.44    0.54     0.081 0.79   0.0023 0.040 3.3e-21
## A10      0.38      0.39    0.52     0.066 0.63   0.0024 0.051 3.4e-21
## 
##  Item statistics 
##          n raw.r std.r  r.cor r.drop mean   sd
## A1  145924  0.60  0.59  0.599  0.365  2.3 1.13
## A2  145924  0.34  0.36  0.259  0.091  3.9 1.00
## A3  145924  0.59  0.58  0.592  0.367  2.2 1.08
## A4  145924  0.23  0.24  0.074 -0.035  3.8 1.02
## A5  145924  0.48  0.51  0.423  0.285  2.1 0.87
## A6  145924  0.34  0.36  0.253  0.109  3.7 0.92
## A7  145924  0.48  0.51  0.421  0.283  2.1 0.86
## A8  145924  0.31  0.26  0.059  0.010  3.0 1.16
## A9  145924  0.18  0.17 -0.028 -0.068  2.0 0.98
## A10 145924  0.33  0.31  0.120  0.067  2.4 1.05
## 
## Non missing response frequency for each item
##        0    1    2    3    4    5    6 miss
## A1  0.00 0.23 0.47 0.14 0.12 0.03 0.01    0
## A2  0.01 0.02 0.06 0.18 0.48 0.26 0.00    0
## A3  0.00 0.25 0.47 0.15 0.08 0.03 0.01    0
## A4  0.01 0.02 0.08 0.17 0.51 0.20 0.00    0
## A5  0.00 0.25 0.52 0.17 0.05 0.01 0.00    0
## A6  0.01 0.02 0.05 0.25 0.49 0.18 0.00    0
## A7  0.00 0.22 0.59 0.10 0.07 0.01 0.00    0
## A8  0.01 0.07 0.30 0.26 0.25 0.10 0.00    0
## A9  0.02 0.31 0.43 0.15 0.08 0.01 0.00    0
## A10 0.01 0.17 0.43 0.21 0.15 0.03 0.00    0

A principal component analysis (PCA) was conducted on the 23 items with orthogonal rotation (varimax). Bartlett’s test of sphericity, Χ2(253) = 19334.49, p< .001, indicated that correlations between items were sufficiently large for PCA. An initial analysis was run to obtain eigenvalues for each component in the data. Four components had eigenvalues over Kaiser’s criterion of 1 and in combination explained 50.94% of the variance. The scree plot was slightly ambiguous and showed inflexions that would justify retaining either 2 or 4 factors. Given the large sample size, and the convergence of the scree plot and Kaiser’s criterion on four components, four components were retained in the final analysis. Component 1 represents a fear of computers, component 2 a fear of statistics, component 3 a fear of math, and component 4 peer evaluation concerns. The fear of computers, and fear of math subscales of the RAQ all had high reliabilities, all Cronbach’s α= .82. The fear of statistics had an acceptable reliability of Cronbach’s α= .61 of However, the fear of negative peer evaluation subscale had a relatively low reliability, Cronbach’s α= .57.