Supplement EFA: Exploratory factor analysis

Author

Pawel R. Kulawiak

last modified

November 21, 2024

1 R packages

Code
library(tidyverse)
library(ggcorrplot)
library(ggpubr)
library(psych)
library(gt)
library(readxl)
library(devtools)
library(knitr)
write_bib(file = "packages.bib")

2 Adjusting function from ggcorrplot package

Code
mycorrr <-
  function (corr, method = c("square", "circle"), type = c("full", 
    "lower", "upper"), ggtheme = ggplot2::theme_minimal, title = "", 
    show.legend = TRUE, legend.title = "Corr", show.diag = NULL, 
    colors = c("blue", "white", "red"), outline.color = "gray", 
    hc.order = FALSE, hc.method = "complete", lab = FALSE, lab_col = "black", 
    lab_size = 4, p.mat = NULL, sig.level = 0.05, insig = c("pch", 
        "blank"), pch = 4, pch.col = "black", pch.cex = 5, tl.cex = 12, 
    tl.col = "black", tl.srt = 45, digits = 2, as.is = FALSE)
  {
    type <- match.arg(type)
    method <- match.arg(method)
    insig <- match.arg(insig)
    if (is.null(show.diag)) {
        if (type == "full") {
            show.diag <- TRUE
        }
        else {
            show.diag <- FALSE
        }
    }
    if (inherits(corr, "cor_mat")) {
        cor.mat <- corr
        corr <- .tibble_to_matrix(cor.mat)
        p.mat <- .tibble_to_matrix(attr(cor.mat, "pvalue"))
    }
    if (!is.matrix(corr) & !is.data.frame(corr)) {
        stop("Need a matrix or data frame!")
    }
    corr <- as.matrix(corr)
    corr <- base::round(x = corr, digits = digits)
    if (hc.order) {
        ord <- .hc_cormat_order(corr, hc.method = hc.method)
        corr <- corr[ord, ord]
        if (!is.null(p.mat)) {
            p.mat <- p.mat[ord, ord]
            p.mat <- base::round(x = p.mat, digits = digits)
        }
    }
    if (!show.diag) {
        corr <- .remove_diag(corr)
        p.mat <- .remove_diag(p.mat)
    }
    if (type == "lower") {
        corr <- .get_lower_tri(corr, show.diag)
        p.mat <- .get_lower_tri(p.mat, show.diag)
    }
    else if (type == "upper") {
        corr <- .get_upper_tri(corr, show.diag)
        p.mat <- .get_upper_tri(p.mat, show.diag)
    }
    corr <- reshape2::melt(corr, na.rm = TRUE, as.is = as.is)
    colnames(corr) <- c("Var1", "Var2", "value")
    corr$pvalue <- rep(NA, nrow(corr))
    corr$signif <- rep(NA, nrow(corr))
    if (!is.null(p.mat)) {
        p.mat <- reshape2::melt(p.mat, na.rm = TRUE)
        corr$coef <- corr$value
        corr$pvalue <- p.mat$value
        corr$signif <- as.numeric(p.mat$value <= sig.level)
        p.mat <- subset(p.mat, p.mat$value > sig.level)
        if (insig == "blank") {
            corr$value <- corr$value * corr$signif
        }
    }
    corr$abs_corr <- abs(corr$value) * 10
    p <- ggplot2::ggplot(data = corr, mapping = ggplot2::aes_string(x = "Var1", 
        y = "Var2", fill = "value"))
    if (method == "square") {
        p <- p + ggplot2::geom_tile(color = outline.color)
    }
    else if (method == "circle") {
        p <- p + ggplot2::geom_point(color = outline.color, shape = 21, 
            ggplot2::aes_string(size = "abs_corr")) + ggplot2::scale_size(range = c(4, 
            10)) + ggplot2::guides(size = "none")
    }
    p <- p + ggplot2::scale_fill_gradient2(low = colors[1], high = colors[3], 
        mid = colors[2], midpoint = 0, limit = c(-1, 1), space = "Lab", 
        name = legend.title)
    if (class(ggtheme)[[1]] == "function") {
        p <- p + ggtheme()
    }
    else if (class(ggtheme)[[1]] == "theme") {
        p <- p + ggtheme
    }
    p <- p + ggplot2::theme(axis.text.x = ggplot2::element_text(angle = tl.srt, 
        vjust = 1, size = tl.cex, hjust = 1), axis.text.y = ggplot2::element_text(size = tl.cex)) + 
        ggplot2::coord_fixed()
    label <- round(x = corr[, "value"], digits = digits) %>%
      str_replace_all("\\b0(\\.\\d+)", "\\1") %>%
      str_replace_all("(\\.\\d)\\b", "\\10")
    if (!is.null(p.mat) & insig == "blank") {
        ns <- corr$pvalue > sig.level
        if (sum(ns) > 0) 
            label[ns] <- " "
    }
    if (lab) {
        p <- p + ggplot2::geom_text(mapping = ggplot2::aes_string(x = "Var1", 
            y = "Var2"), label = label, color = lab_col, size = lab_size)
    }
    if (!is.null(p.mat) & insig == "pch") {
        p <- p + ggplot2::geom_point(data = p.mat, mapping = ggplot2::aes_string(x = "Var1", 
            y = "Var2"), shape = pch, size = pch.cex, color = pch.col)
    }
    if (title != "") {
        p <- p + ggplot2::ggtitle(title)
    }
    if (!show.legend) {
        p <- p + ggplot2::theme(legend.position = "none")
    }
    p <- p + .no_panel()
    p
  }

.no_panel <- function() {
  ggplot2::theme(
    axis.title.x = ggplot2::element_blank(),
    axis.title.y = ggplot2::element_blank()
  )
}

3 Data import and manipulation

Code
DATA <- read_xlsx("SURVEY_DATA.xlsx")

DATA <-
  DATA %>%
  select(-where( ~ all(is.na(.)))) %>%
  filter(`teilnahme[teilnahme]` == "Y")

DATA <-
  DATA[9:81] %>%
  mutate(Nitem_CHECK = rowSums(!is.na(.))) %>%
  filter(Nitem_CHECK > 0) %>%
  filter(AB7 == 0) # exclude special education schools
Code
item_wording <- c(
  "I feel uneasy at the thought of having to supervise Student E on a trip to the museum",
  "I feel uneasy at the thought of having to supervise Student E on a school trip lasting several days",
  "I am confident that I can adequately supervise Student E during a trip to the museum",
  "I am confident that I can adequately supervise Student E during a school trip lasting several days",
  "For safety reasons, I would recommend that Student E does not take part in trips to the museum",
  "For safety reasons, I would recommend that Student E does not take part in school trips lasting several days",
  "I am uncomfortable with the idea of supervising Student E during physical activities (e.g., play, exercise, and sport)",
  "I am confident that I can adequately supervise Student E during physical activities (e.g., play, exercise, and sport)",
  "I am confident that I can create a safe play and exercise environment for Student E",
  "For safety reasons, I would make sure that student E reduces physical activities and physical exertion (e.g., sports and exercise)",
  "For safety reasons, I would recommend that Student E does not participate in ball sports (e.g., soccer, basketball, or volleyball)",
  "I am confident that I can recognize an epileptic seizure in pupil E as such",
  "I am confident that I can administer adequate first aid in the event of an epileptic seizure in Student E",
  "I am confident that I can maintain the necessary calm and composure in the event of an epileptic seizure in Student E",
  "I am confident that I can administer the emergency medication (liquid to drip into the mouth) according to the emergency plan in the event of an epileptic seizure in Student E",
  "I am confident that I can adequately supervise the other classmates in the event of an epileptic seizure in Student E",
  "I am confident that I can adequately continue the school day and lessons with the class after an epileptic seizure in Student E",
  "I am confident that I can adequately respond to the questions, fears and concerns of the other classmates after an epileptic seizure in Student E",
  "I am confident that I can respond adequately to the emotional needs of Student E after an epileptic seizure",
  "I am confident that I can provide adequate care for Student E after the end of an epileptic seizure"
)
Code
item_ID <-
  c(
    "item_1", "item_2", "item_3", "item_4", "item_5", "item_6", "item_7", "item_8",
    "item_9", "item_10", "item_11", "item_12", "item_13", "item_14", "item_15",   
    "item_16", "item_17", "item_18", "item_19", "item_20", "item_21", "item_22",
    "item_23", "item_24", "item_25", "item_26", "item_27", "item_28", "item_29",
    "item_30"
  )

4 Correlation matrix

Code
DAT <-
  DATA[
    c(paste0("SE",
             c(1:8,14,9,15,12,13,10:11,16:20)),
      paste0("VA",
             c(1:5,10,6:9)))] %>% 
  rename_with(~ item_ID)

DAT %>%
  rev() %>% 
  cor(use = "pair") %>% 
  mycorrr(lab = T, outline.color = "white") + 
  theme(legend.title= element_blank())

5 Scree plot & parallel analysis

Code
DAT <-
  DAT %>%
  select(!c("item_26", "item_7", "item_8", "item_9", "item_10", "item_11",
         "item_12", "item_13", "item_14", "item_15"))

DAT %>%
  fa.parallel(fm = "ols", fa = "fa")

Parallel analysis suggests that the number of factors =  5  and the number of components =  NA 

6 5 Factors

Code
desired_order <-
  c(
  "item_1", "item_2", "item_3", "item_4", "item_16",
  "item_17", "item_18", "item_5", "item_6", "item_19",
  "item_20", "item_21", "item_22", "item_23", "item_24",
  "item_25", "item_27", "item_28", "item_29", "item_30"
  )

rot <- "oblimin"
fam <- "ols"
COR <- "cor"

XXX <- "X"

FA <-
  fa(DAT, nfactors = 5, fm = fam, rotate = rot, cor = COR)$loadings

cbind(FA[1:ncol(DAT),],
      fa(DAT, nfactors = 5, fm = fam, rotate = rot, cor = COR)$complexity,
      fa(DAT, nfactors = 5, fm = fam, rotate = rot, cor = COR)$communality) %>%  
  data.frame() %>%
  round(2) %>% 
  mutate(item = names(DAT)) %>%
  mutate(item_wording = item_wording) %>% 
  rename_with(~str_replace_all(.x, XXX, "F")) %>%
  arrange(match(item, desired_order)) %>%
  select(F1, F5, F4, F3, F2, everything()) %>%
  rename(F1 = 1, F2 = 2, F3 = 3, F4 = 4, F5 = 5, complexity = 6, communality = 7) %>%
  gt() %>%
  tab_options(table.align = "left") %>%
  tab_footnote("highlighted in gray = factor loadings ≥ |0.30|") %>% 
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F1, rows = (F1 >= 0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F2, rows = (F2 >= 0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F3, rows = (F3 >= 0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F4, rows = (F4 >= 0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F5, rows = (F5 >= 0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F1, rows = (F1 <= -0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F2, rows = (F2 <= -0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F3, rows = (F3 <= -0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F4, rows = (F4 <= -0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F5, rows = (F5 <= -0.30)))
F1 F2 F3 F4 F5 complexity communality item item_wording
-0.80 0.06 -0.02 0.02 -0.08 1.03 0.71 item_1 I feel uneasy at the thought of having to supervise Student E on a trip to the museum
-0.80 0.18 -0.04 0.05 -0.07 1.14 0.77 item_2 I feel uneasy at the thought of having to supervise Student E on a school trip lasting several days
0.71 0.00 0.02 0.15 -0.04 1.10 0.60 item_3 I am confident that I can adequately supervise Student E during a trip to the museum
0.68 -0.15 0.10 0.18 -0.05 1.31 0.66 item_4 I am confident that I can adequately supervise Student E during a school trip lasting several days
-0.69 -0.08 0.29 -0.02 0.00 1.37 0.67 item_16 I am uncomfortable with the idea of supervising Student E during physical activities (e.g., play, exercise, and sport)
0.53 0.11 -0.33 0.16 0.00 1.99 0.61 item_17 I am confident that I can adequately supervise Student E during physical activities (e.g., play, exercise, and sport)
0.30 0.06 -0.20 0.29 0.10 3.11 0.43 item_18 I am confident that I can create a safe play and exercise environment for Student E
-0.13 0.65 0.13 -0.11 -0.04 1.22 0.68 item_5 For safety reasons, I would recommend that Student E does not take part in trips to the museum
-0.03 0.89 0.04 0.01 -0.01 1.01 0.84 item_6 For safety reasons, I would recommend that Student E does not take part in school trips lasting several days
-0.08 0.09 0.69 0.02 -0.01 1.06 0.56 item_19 For safety reasons, I would make sure that student E reduces physical activities and physical exertion (e.g., sports and exercise)
0.06 0.18 0.68 -0.04 -0.09 1.21 0.60 item_20 For safety reasons, I would recommend that Student E does not participate in ball sports (e.g., soccer, basketball, or volleyball)
0.06 0.06 0.06 0.55 0.06 1.10 0.35 item_21 I am confident that I can recognize an epileptic seizure in pupil E as such
0.00 -0.05 0.01 0.90 0.00 1.01 0.84 item_22 I am confident that I can administer adequate first aid in the event of an epileptic seizure in Student E
0.07 0.04 -0.13 0.47 0.19 1.57 0.45 item_23 I am confident that I can maintain the necessary calm and composure in the event of an epileptic seizure in Student E
0.09 0.04 -0.23 0.34 0.10 2.18 0.31 item_24 I am confident that I can administer the emergency medication (liquid to drip into the mouth) according to the emergency plan in the event of an epileptic seizure in Student E
0.45 0.14 0.04 0.00 0.38 2.17 0.42 item_25 I am confident that I can adequately supervise the other classmates in the event of an epileptic seizure in Student E
0.07 0.08 -0.08 0.02 0.58 1.11 0.41 item_27 I am confident that I can adequately continue the school day and lessons with the class after an epileptic seizure in Student E
0.00 -0.02 -0.04 -0.06 0.90 1.01 0.80 item_28 I am confident that I can adequately respond to the questions, fears and concerns of the other classmates after an epileptic seizure in Student E
-0.08 -0.07 0.01 0.14 0.71 1.12 0.57 item_29 I am confident that I can respond adequately to the emotional needs of Student E after an epileptic seizure
0.11 -0.04 0.15 0.18 0.53 1.52 0.46 item_30 I am confident that I can provide adequate care for Student E after the end of an epileptic seizure
highlighted in gray = factor loadings ≥ |0.30|
Code
PROP <-
  fa(DAT, nfactors = 5, fm = fam, rotate = rot, cor = COR)$Vaccounted %>% round(2)

PROP[, c(1, 5, 4, 3, 2)]
                      [,1] [,2] [,3] [,4] [,5]
SS loadings           3.97 1.53 1.56 2.16 2.49
Proportion Var        0.20 0.08 0.08 0.11 0.12
Cumulative Var        0.20 0.59 0.51 0.43 0.32
Proportion Explained  0.34 0.13 0.13 0.18 0.21
Cumulative Proportion 0.34 1.00 0.87 0.74 0.55

7 6 Factors

Code
FA <-
  fa(DAT, nfactors = 6, fm = fam, rotate = rot, cor = COR)$loadings

cbind(FA[1:ncol(DAT),],
      fa(DAT, nfactors = 6, fm = fam, rotate = rot, cor = COR)$complexity,
      fa(DAT, nfactors = 6, fm = fam, rotate = rot, cor = COR)$communality) %>% 
  data.frame() %>%
  round(2) %>% 
  mutate(item = names(DAT)) %>%
  mutate(item_wording = item_wording) %>% 
  rename_with(~str_replace_all(.x, XXX, "F")) %>%
  arrange(match(item, desired_order)) %>%
  select(F1, F3, F5, F6, F4, F2, everything()) %>%
  rename(F1 = 1, F2 = 2, F3 = 3, F4 = 4, F5 = 5, F6 = 6, complexity = 7, communality = 8) %>%
  gt() %>%
  tab_options(table.align = "left") %>%
  tab_footnote("highlighted in gray = factor loadings ≥ |0.30|") %>% 
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F1, rows = (F1 >= 0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F2, rows = (F2 >= 0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F3, rows = (F3 >= 0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F4, rows = (F4 >= 0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F5, rows = (F5 >= 0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F6, rows = (F6 >= 0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F1, rows = (F1 <= -0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F2, rows = (F2 <= -0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F3, rows = (F3 <= -0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F4, rows = (F4 <= -0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F5, rows = (F5 <= -0.30))) %>%
  tab_style(style = cell_fill(color = "gray"),
            locations = cells_body(columns = F6, rows = (F6 <= -0.30)))
F1 F2 F3 F4 F5 F6 complexity communality item item_wording
0.70 -0.14 0.01 0.03 -0.02 -0.06 1.11 0.73 item_1 I feel uneasy at the thought of having to supervise Student E on a trip to the museum
0.90 0.06 0.08 0.07 -0.01 -0.04 1.04 0.90 item_2 I feel uneasy at the thought of having to supervise Student E on a school trip lasting several days
-0.47 0.31 -0.03 0.06 0.15 -0.04 2.05 0.59 item_3 I am confident that I can adequately supervise Student E during a trip to the museum
-0.55 0.15 -0.14 0.07 0.21 -0.06 1.66 0.65 item_4 I am confident that I can adequately supervise Student E during a school trip lasting several days
0.28 -0.58 0.01 0.12 0.05 -0.02 1.57 0.69 item_16 I am uncomfortable with the idea of supervising Student E during physical activities (e.g., play, exercise, and sport)
0.00 0.79 -0.04 -0.08 0.04 0.02 1.03 0.75 item_17 I am confident that I can adequately supervise Student E during physical activities (e.g., play, exercise, and sport)
0.08 0.54 -0.07 0.00 0.20 0.12 1.47 0.50 item_18 I am confident that I can create a safe play and exercise environment for Student E
0.03 -0.11 0.72 0.05 -0.07 -0.03 1.09 0.70 item_5 For safety reasons, I would recommend that Student E does not take part in trips to the museum
0.04 0.04 0.93 0.00 0.04 -0.01 1.01 0.85 item_6 For safety reasons, I would recommend that Student E does not take part in school trips lasting several days
0.07 -0.01 -0.02 0.83 -0.01 0.03 1.02 0.72 item_19 For safety reasons, I would make sure that student E reduces physical activities and physical exertion (e.g., sports and exercise)
-0.10 -0.09 0.16 0.63 -0.04 -0.08 1.27 0.56 item_20 For safety reasons, I would recommend that Student E does not participate in ball sports (e.g., soccer, basketball, or volleyball)
-0.08 -0.01 0.08 0.02 0.56 0.05 1.09 0.35 item_21 I am confident that I can recognize an epileptic seizure in pupil E as such
-0.01 0.03 -0.05 0.00 0.88 -0.01 1.01 0.82 item_22 I am confident that I can administer adequate first aid in the event of an epileptic seizure in Student E
-0.10 -0.01 0.08 -0.18 0.50 0.18 1.66 0.47 item_23 I am confident that I can maintain the necessary calm and composure in the event of an epileptic seizure in Student E
-0.01 0.15 0.03 -0.19 0.32 0.10 2.35 0.30 item_24 I am confident that I can administer the emergency medication (liquid to drip into the mouth) according to the emergency plan in the event of an epileptic seizure in Student E
-0.25 0.27 0.09 0.10 -0.01 0.39 2.91 0.42 item_25 I am confident that I can adequately supervise the other classmates in the event of an epileptic seizure in Student E
-0.09 -0.01 0.10 -0.11 0.04 0.58 1.19 0.41 item_27 I am confident that I can adequately continue the school day and lessons with the class after an epileptic seizure in Student E
0.00 0.02 -0.03 -0.03 -0.07 0.90 1.02 0.80 item_28 I am confident that I can adequately respond to the questions, fears and concerns of the other classmates after an epileptic seizure in Student E
0.07 0.00 -0.09 0.02 0.12 0.70 1.11 0.57 item_29 I am confident that I can respond adequately to the emotional needs of Student E after an epileptic seizure
-0.16 -0.06 -0.01 0.10 0.20 0.52 1.61 0.46 item_30 I am confident that I can provide adequate care for Student E after the end of an epileptic seizure
highlighted in gray = factor loadings ≥ |0.30|
Code
PROP <-
  fa(DAT, nfactors = 6, fm = fam, rotate = rot, cor = COR)$Vaccounted %>% round(2)

PROP[, c(1, 3, 5, 6, 4, 2)]
                      [,1] [,2] [,3] [,4] [,5] [,6]
SS loadings           2.62 2.10 1.64 1.39 2.07 2.44
Proportion Var        0.13 0.10 0.08 0.07 0.10 0.12
Cumulative Var        0.13 0.36 0.54 0.61 0.46 0.25
Proportion Explained  0.21 0.17 0.13 0.11 0.17 0.20
Cumulative Proportion 0.21 0.58 0.89 1.00 0.75 0.41

8 BIC for factor solutions

Code
data.frame(
  c(fa(DAT, nfactors = 5, fm = fam, rotate = rot)$BIC,
    fa(DAT, nfactors = 6, fm = fam, rotate = rot)$BIC)
  ) %>%
  rename("BIC" = 1) %>% 
  round(2) %>%
  add_column(Factors = 5:6, .before = "BIC") %>%
  gt() %>%
  tab_options(table.align = "left")
Factors BIC
5 -247.99
6 -246.97

9 Mean scale scores (6 Factors): correlation matrix

Code
DAT_COR <-
  DAT %>%
  rowwise() %>%
  mutate(
    `NAI-ST` = mean(c(item_1, item_2, abs(item_3 - 5), abs(item_4 - 5)), na.rm = TRUE),
    `IRP-ST` = mean(c(item_5, item_6), na.rm = TRUE),
    `NAI-PA` = mean(c(item_16, abs(item_17 - 5), abs(item_18 - 5)), na.rm = TRUE),
    `IRP-PA` = mean(c(item_19, item_20), na.rm = TRUE),
    CSFAS = mean(c(item_21, item_22, item_23, item_24), na.rm = TRUE),
    CCMESS = mean(c(item_25, item_27, item_28, item_29, item_30), na.rm = TRUE)
  ) %>%
  ungroup()
Code
FIG <- DAT_COR[c("NAI-ST", "IRP-ST", "NAI-PA", "IRP-PA", "CSFAS", "CCMESS")] %>%
  rev() %>% 
  cor(use = "pair") %>% 
  mycorrr(lab = T, outline.color = "white") + 
  theme(legend.title= element_blank()) 

annotate_figure(FIG, bottom = text_grob("
NAI-ST: Negative affect and insecurity (school trips)
NAI-PA: Negative affect and insecurity (physical activities)
IRP-ST: Intention to restrict participation (school trips)
IRP-PA: Intention to restrict participation (physical activities)
CSFAS: Confidence in seizure first aid skills
CCMESS: Confidence in classroom management and emotional\nsupport skills", size = 10, x = 0.08, hjust = 0)
)

10 Mean scale scores (6 Factors): reliability (Cronbach’s alpha)

Code
rbind(
  alpha(DAT_COR[c("item_1", "item_2", "item_3", "item_4")], check.keys = TRUE)$total,
  alpha(DAT_COR[c("item_5", "item_6")], check.keys = TRUE)$total,
  alpha(DAT_COR[c("item_16", "item_17", "item_18")], check.keys = TRUE)$total,
  alpha(DAT_COR[c("item_19", "item_20")], check.keys = TRUE)$total,
  alpha(DAT_COR[c("item_21", "item_22", "item_23", "item_24")], check.keys = TRUE)$total,
  alpha(DAT_COR[c("item_25", "item_27", "item_28", "item_29", "item_30")], check.keys = TRUE)$total
) %>%
  round(2) %>% 
  cbind(c("NAI-ST", "IRP-ST", "NAI-PA", "IRP-PA", "CSFAS", "CCMESS"), .) %>%
  rename("Scale" = 1) %>%
  remove_rownames() %>%
  select(c("Scale", "raw_alpha", "mean", "sd")) %>%
  gt() %>%
  tab_options(table.align = "left") 
Scale raw_alpha mean sd
NAI-ST 0.90 2.49 0.75
IRP-ST 0.82 1.62 0.72
NAI-PA 0.82 2.83 0.64
IRP-PA 0.78 1.83 0.67
CSFAS 0.75 2.97 0.54
CCMESS 0.81 2.96 0.58

11 R session info

Code
session_info()
## ─ Session info ───────────────────────────────────────────────────────────────
##  setting  value
##  version  R version 4.4.2 (2024-10-31 ucrt)
##  os       Windows 11 x64 (build 22631)
##  system   x86_64, mingw32
##  ui       RTerm
##  language (EN)
##  collate  German_Germany.utf8
##  ctype    German_Germany.utf8
##  tz       Europe/Berlin
##  date     2024-11-21
##  pandoc   3.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
## 
## ─ Packages ───────────────────────────────────────────────────────────────────
##  package     * version  date (UTC) lib source
##  abind         1.4-8    2024-09-12 [1] CRAN (R 4.4.1)
##  backports     1.5.0    2024-05-23 [1] CRAN (R 4.4.0)
##  broom         1.0.7    2024-09-26 [1] CRAN (R 4.4.2)
##  cachem        1.1.0    2024-05-16 [1] CRAN (R 4.4.2)
##  car           3.1-3    2024-09-27 [1] CRAN (R 4.4.2)
##  carData       3.0-5    2022-01-06 [1] CRAN (R 4.4.2)
##  cellranger    1.1.0    2016-07-27 [1] CRAN (R 4.4.2)
##  cli           3.6.3    2024-06-21 [1] CRAN (R 4.4.2)
##  colorspace    2.1-1    2024-07-26 [1] CRAN (R 4.4.2)
##  cowplot       1.1.3    2024-01-22 [1] CRAN (R 4.4.2)
##  devtools    * 2.4.5    2022-10-11 [1] CRAN (R 4.4.2)
##  digest        0.6.37   2024-08-19 [1] CRAN (R 4.4.2)
##  dplyr       * 1.1.4    2023-11-17 [1] CRAN (R 4.4.2)
##  ellipsis      0.3.2    2021-04-29 [1] CRAN (R 4.4.2)
##  evaluate      1.0.1    2024-10-10 [1] CRAN (R 4.4.2)
##  fansi         1.0.6    2023-12-08 [1] CRAN (R 4.4.2)
##  farver        2.1.2    2024-05-13 [1] CRAN (R 4.4.2)
##  fastmap       1.2.0    2024-05-15 [1] CRAN (R 4.4.2)
##  forcats     * 1.0.0    2023-01-29 [1] CRAN (R 4.4.2)
##  Formula       1.2-5    2023-02-24 [1] CRAN (R 4.4.0)
##  fs            1.6.5    2024-10-30 [1] CRAN (R 4.4.2)
##  generics      0.1.3    2022-07-05 [1] CRAN (R 4.4.2)
##  ggcorrplot  * 0.1.4.1  2023-09-05 [1] CRAN (R 4.4.2)
##  ggplot2     * 3.5.1    2024-04-23 [1] CRAN (R 4.4.2)
##  ggpubr      * 0.6.0    2023-02-10 [1] CRAN (R 4.4.2)
##  ggsignif      0.6.4    2022-10-13 [1] CRAN (R 4.4.2)
##  glue          1.8.0    2024-09-30 [1] CRAN (R 4.4.2)
##  GPArotation   2024.3-1 2024-03-02 [1] CRAN (R 4.4.0)
##  gridExtra     2.3      2017-09-09 [1] CRAN (R 4.4.2)
##  gt          * 0.11.1   2024-10-04 [1] CRAN (R 4.4.2)
##  gtable        0.3.6    2024-10-25 [1] CRAN (R 4.4.2)
##  hms           1.1.3    2023-03-21 [1] CRAN (R 4.4.2)
##  htmltools     0.5.8.1  2024-04-04 [1] CRAN (R 4.4.2)
##  htmlwidgets   1.6.4    2023-12-06 [1] CRAN (R 4.4.2)
##  httpuv        1.6.15   2024-03-26 [1] CRAN (R 4.4.2)
##  jsonlite      1.8.9    2024-09-20 [1] CRAN (R 4.4.2)
##  knitr       * 1.49     2024-11-08 [1] CRAN (R 4.4.2)
##  labeling      0.4.3    2023-08-29 [1] CRAN (R 4.4.0)
##  later         1.3.2    2023-12-06 [1] CRAN (R 4.4.2)
##  lattice       0.22-6   2024-03-20 [1] CRAN (R 4.4.2)
##  lifecycle     1.0.4    2023-11-07 [1] CRAN (R 4.4.2)
##  lubridate   * 1.9.3    2023-09-27 [1] CRAN (R 4.4.2)
##  magrittr      2.0.3    2022-03-30 [1] CRAN (R 4.4.2)
##  memoise       2.0.1    2021-11-26 [1] CRAN (R 4.4.2)
##  mime          0.12     2021-09-28 [1] CRAN (R 4.4.0)
##  miniUI        0.1.1.1  2018-05-18 [1] CRAN (R 4.4.2)
##  mnormt        2.1.1    2022-09-26 [1] CRAN (R 4.4.0)
##  munsell       0.5.1    2024-04-01 [1] CRAN (R 4.4.2)
##  nlme          3.1-166  2024-08-14 [1] CRAN (R 4.4.2)
##  pillar        1.9.0    2023-03-22 [1] CRAN (R 4.4.2)
##  pkgbuild      1.4.5    2024-10-28 [1] CRAN (R 4.4.2)
##  pkgconfig     2.0.3    2019-09-22 [1] CRAN (R 4.4.2)
##  pkgload       1.4.0    2024-06-28 [1] CRAN (R 4.4.2)
##  plyr          1.8.9    2023-10-02 [1] CRAN (R 4.4.2)
##  profvis       0.4.0    2024-09-20 [1] CRAN (R 4.4.2)
##  promises      1.3.0    2024-04-05 [1] CRAN (R 4.4.2)
##  psych       * 2.4.6.26 2024-06-27 [1] CRAN (R 4.4.2)
##  purrr       * 1.0.2    2023-08-10 [1] CRAN (R 4.4.2)
##  R6            2.5.1    2021-08-19 [1] CRAN (R 4.4.2)
##  Rcpp          1.0.13-1 2024-11-02 [1] CRAN (R 4.4.2)
##  readr       * 2.1.5    2024-01-10 [1] CRAN (R 4.4.2)
##  readxl      * 1.4.3    2023-07-06 [1] CRAN (R 4.4.2)
##  remotes       2.5.0    2024-03-17 [1] CRAN (R 4.4.2)
##  reshape2      1.4.4    2020-04-09 [1] CRAN (R 4.4.2)
##  rlang         1.1.4    2024-06-04 [1] CRAN (R 4.4.2)
##  rmarkdown     2.29     2024-11-04 [1] CRAN (R 4.4.2)
##  rstatix       0.7.2    2023-02-01 [1] CRAN (R 4.4.2)
##  rstudioapi    0.17.1   2024-10-22 [1] CRAN (R 4.4.2)
##  sass          0.4.9    2024-03-15 [1] CRAN (R 4.4.2)
##  scales        1.3.0    2023-11-28 [1] CRAN (R 4.4.2)
##  sessioninfo   1.2.2    2021-12-06 [1] CRAN (R 4.4.2)
##  shiny         1.9.1    2024-08-01 [1] CRAN (R 4.4.2)
##  stringi       1.8.4    2024-05-06 [1] CRAN (R 4.4.0)
##  stringr     * 1.5.1    2023-11-14 [1] CRAN (R 4.4.2)
##  tibble      * 3.2.1    2023-03-20 [1] CRAN (R 4.4.2)
##  tidyr       * 1.3.1    2024-01-24 [1] CRAN (R 4.4.2)
##  tidyselect    1.2.1    2024-03-11 [1] CRAN (R 4.4.2)
##  tidyverse   * 2.0.0    2023-02-22 [1] CRAN (R 4.4.2)
##  timechange    0.3.0    2024-01-18 [1] CRAN (R 4.4.2)
##  tzdb          0.4.0    2023-05-12 [1] CRAN (R 4.4.2)
##  urlchecker    1.0.1    2021-11-30 [1] CRAN (R 4.4.2)
##  usethis     * 3.0.0    2024-07-29 [1] CRAN (R 4.4.1)
##  utf8          1.2.4    2023-10-22 [1] CRAN (R 4.4.2)
##  vctrs         0.6.5    2023-12-01 [1] CRAN (R 4.4.2)
##  withr         3.0.2    2024-10-28 [1] CRAN (R 4.4.2)
##  xfun          0.49     2024-10-31 [1] CRAN (R 4.4.2)
##  xml2          1.3.6    2023-12-04 [1] CRAN (R 4.4.2)
##  xtable        1.8-4    2019-04-21 [1] CRAN (R 4.4.2)
##  yaml          2.3.10   2024-07-26 [1] CRAN (R 4.4.1)
## 
##  [1] C:/Users/Pawel Kulawiak/AppData/Local/Programs/R/R-4.4.2/library
## 
## ──────────────────────────────────────────────────────────────────────────────

12 References

Iannone, Richard, Joe Cheng, Barret Schloerke, Ellis Hughes, Alexandra Lauer, JooYoung Seo, Ken Brevoort, and Olivier Roy. 2024. Gt: Easily Create Presentation-Ready Display Tables. https://gt.rstudio.com.
Kassambara, Alboukadel. 2023a. Ggcorrplot: Visualization of a Correlation Matrix Using Ggplot2. http://www.sthda.com/english/wiki/ggcorrplot-visualization-of-a-correlation-matrix-using-ggplot2.
———. 2023b. Ggpubr: Ggplot2 Based Publication Ready Plots. https://rpkgs.datanovia.com/ggpubr/.
R Core Team. 2024. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Revelle, William. 2024. Psych: Procedures for Psychological, Psychometric, and Personality Research. https://personality-project.org/r/psych/.
Wickham, Hadley. 2023. Tidyverse: Easily Install and Load the Tidyverse. https://tidyverse.tidyverse.org.
Wickham, Hadley, and Jennifer Bryan. 2023. Readxl: Read Excel Files. https://readxl.tidyverse.org.
Wickham, Hadley, Jim Hester, Winston Chang, and Jennifer Bryan. 2022. Devtools: Tools to Make Developing r Packages Easier. https://devtools.r-lib.org/.
Xie, Yihui. 2024. Knitr: A General-Purpose Package for Dynamic Report Generation in r. https://yihui.org/knitr/.