First analyses of weight bias scales

Author

Katja Pollak, Julius Fenn

Published

August 15, 2025

Background Information

This is an R Markdown document, whereby I am using the Quarto framework. Instructions for writing these documents and background information can be found in the book written by Xie, Allaire, and Grolemund (2018). When you execute code within the document, the results appear beneath the code.

This file contains the pre-processing step (clean, transform data), and the analysis step (test hypotheses and exploratory analyses). In larger projects you would split this file into multiple subfiles like data processing and data analyses steps, which follows the classical data-analysis pipeline (see Peng and Matsui 2016; Wickham and Grolemund 2017).

Notes

Global variables to control output:

## global variables
runMplusLCA <- FALSE
## set to lower values to reduce compilation time: 
nRep_def = 100 # 100
n.lambda_def = 40 # 40
LCArunsDef = 6 # 10

get packages

### install and load packages
#  if packages are not already installed, the function will install and activate them
usePackage <- function(p) {
  if (!is.element(p, installed.packages()[,1]))
    install.packages(p, dep = TRUE, repos = "http://cran.us.r-project.org")
  require(p, character.only = TRUE)
}

usePackage("readxl") # read .xlsx files
usePackage("writexl") # write .xlsx files

usePackage("tidyverse") # data cleaning and summarizing

## psychometric analysis
usePackage("moments") # skewness, kurtosis
usePackage("psych") # psychometric analysis (EFA), reliability measures

usePackage("lavaan") # for CFA, SEM
usePackage("regsem") # for regularizations -> local item dependencies

usePackage("mirt") # for IRT

usePackage("MplusAutomation") # to apply statistical software Mplus (LCA)


## outputs
usePackage("stargazer") # create tables
usePackage("report") # get reports of statistical tests in APA7


rm(usePackage)

raw data, functions

### load functions
# print(getwd())
setwd("functions")
for(i in 1:length(dir())){
  # print(dir()[i])
  source(dir()[i], encoding = "utf-8")
}


### load data files
## change working directory
setwd("../../dataPreperation/outputs/questionnaire")
## load data
dat <- readRDS(file = "ques_combined.rds")

rm(i)

compute mean variables

However, multiple scales are not undimensional!

dat$mean_pair <- rowMeans(x = dat[,str_subset(string = colnames(dat), pattern = "^pair")])
dat$mean_PathogenDisgus <- rowMeans(x = dat[,str_subset(string = colnames(dat), pattern = "^PathogenDisgus")])
dat$mean_GermAversion <- rowMeans(x = dat[,str_subset(string = colnames(dat), pattern = "^GermAversion")])
dat$mean_BeliefsAboutObesePersons <- rowMeans(x = dat[,str_subset(string = colnames(dat), pattern = "^BeliefsAboutObesePersons")])
dat$mean_AttitudeTowardsObesePeople <- rowMeans(x = dat[,str_subset(string = colnames(dat), pattern = "^AttitudeTowardsObesePeople")])
dat$mean_PerceivedCausesofObesity <- rowMeans(x = dat[,str_subset(string = colnames(dat), pattern = "^PerceivedCausesofObesity")])

Descriptive Statistics

sample

table(dat$sociodemo_gender)

  female intersex     male 
     178        3      182 
psych::describe(dat[, c("sociodemo_age", "sociodemo_BMI", "weight_avatar_choice2")])
                      vars   n  mean    sd median trimmed   mad   min  max
sociodemo_age            1 363 35.87 12.95  32.00   34.25 10.38 18.00 77.0
sociodemo_BMI            2 268 27.10  7.09  25.06   26.23  5.07 14.04 61.5
weight_avatar_choice2    3 123 10.33  3.79   9.00   10.03  2.97  2.00 20.0
                      range skew kurtosis   se
sociodemo_age         59.00 1.05     0.31 0.68
sociodemo_BMI         47.45 1.40     2.56 0.43
weight_avatar_choice2 18.00 0.57    -0.25 0.34

mean variables

Using the stargazer package you can create nice tables:

# Descriptive stats for all mean_* variables
mean_vars <- str_subset(names(dat), "^mean_")

tmp_desc <- dat %>%
  summarise(
    N = n(),
    across(all_of(mean_vars), list(mean = ~mean(.x, na.rm = TRUE),
                                   sd = ~sd(.x, na.rm = TRUE)),
           .names = "{.col}_{.fn}")
  ) %>%
  pivot_longer(
    cols = -N,
    names_to = c("variable", ".value"),
    names_pattern = "(.*)_(mean|sd)"
)


tmp_desc
# A tibble: 6 × 4
      N variable                         mean    sd
  <int> <chr>                           <dbl> <dbl>
1   363 mean_pair                        3.95 0.711
2   363 mean_PathogenDisgus              4.67 1.16 
3   363 mean_GermAversion                4.36 1.12 
4   363 mean_BeliefsAboutObesePersons    2.52 0.722
5   363 mean_AttitudeTowardsObesePeople  3.38 0.666
6   363 mean_PerceivedCausesofObesity    3.58 0.587
# Save descriptive table as HTML
setwd("outputs")
tmp_desc$mean <- round(x = tmp_desc$mean, digits = 2)
tmp_desc$sd <- round(x = tmp_desc$sd, digits = 2)
stargazer(tmp_desc, type = "html", summary = FALSE, out = "summaryTable_meansSDs.html")

<table style="text-align:center"><tr><td colspan="5" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"></td><td>N</td><td>variable</td><td>mean</td><td>sd</td></tr>
<tr><td colspan="5" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">1</td><td>363</td><td>mean_pair</td><td>3.95</td><td>0.71</td></tr>
<tr><td style="text-align:left">2</td><td>363</td><td>mean_PathogenDisgus</td><td>4.67</td><td>1.16</td></tr>
<tr><td style="text-align:left">3</td><td>363</td><td>mean_GermAversion</td><td>4.36</td><td>1.12</td></tr>
<tr><td style="text-align:left">4</td><td>363</td><td>mean_BeliefsAboutObesePersons</td><td>2.52</td><td>0.72</td></tr>
<tr><td style="text-align:left">5</td><td>363</td><td>mean_AttitudeTowardsObesePeople</td><td>3.38</td><td>0.67</td></tr>
<tr><td style="text-align:left">6</td><td>363</td><td>mean_PerceivedCausesofObesity</td><td>3.58</td><td>0.59</td></tr>
<tr><td colspan="5" style="border-bottom: 1px solid black"></td></tr></table>
# Correlation plot of mean variables
psych::cor.plot(
  r = cor(dat[, c(mean_vars, "sociodemo_BMI")], use = "pairwise.complete.obs"),
  main = "Correlation Plot of Mean Scales"
)

mean_PathogenDisgus between sources

tmp_desc <- dat %>%
  group_by(source) %>%
  summarise(N = n(),
            mean = mean(mean_PathogenDisgus, na.rm = TRUE),
            sd = sd(mean_PathogenDisgus, na.rm = TRUE))
tmp_desc
# A tibble: 3 × 4
  source               N  mean    sd
  <chr>            <int> <dbl> <dbl>
1 study1             240  4.54  1.15
2 study2_BMI_high     23  4.77  1.40
3 study2_BMI_mixed   100  4.97  1.06
# ! Individualism-Communitarianism is not unidimensional, as such not show here
ggstatsplot::ggbetweenstats(data = dat, x = source, y = mean_PathogenDisgus, type = "parametric")

#> output to html
setwd("outputs")
tmp_desc$mean <- round(x = tmp_desc$mean, digits = 2)
tmp_desc$sd <- round(x = tmp_desc$sd, digits = 2)
stargazer(tmp_desc, type = "html", summary = FALSE, out = "summaryTable_between.html")

<table style="text-align:center"><tr><td colspan="5" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"></td><td>source</td><td>N</td><td>mean</td><td>sd</td></tr>
<tr><td colspan="5" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">1</td><td>study1</td><td>240</td><td>4.54</td><td>1.15</td></tr>
<tr><td style="text-align:left">2</td><td>study2_BMI_high</td><td>23</td><td>4.77</td><td>1.4</td></tr>
<tr><td style="text-align:left">3</td><td>study2_BMI_mixed</td><td>100</td><td>4.97</td><td>1.06</td></tr>
<tr><td colspan="5" style="border-bottom: 1px solid black"></td></tr></table>

Inferential Statistics

Overall EFA

#### Overall EFA
regExOverall <- "^pair|^PathogenDisgus|^GermAversion|^BeliefsAboutObesePersons|^AttitudeTowardsObesePeople|^PerceivedCausesofObesity"


psych::cor.plot(r = cor(dat[, str_detect(string = colnames(dat),
                                                   pattern = regExOverall)]
                        , use = "pairwise.complete.obs"),
                upper = FALSE, xlas = 2, main = "Overall")

#> parallel analysis
tmp_parallelAnalysis <- dimensionalityTest(label = "Overall",
                             regEx = regExOverall, dataset = dat)

Parallel analysis suggests that the number of factors =  9  and the number of components =  7 
Overall 
Number of components:  7 

Remark: factors scores were computed using “tenBerge”, which preserves correlation structure, but not as widely used in applied psych research (often “regression” used).

#> EFA (# of factors=5)
tmp_EFA_overall <- explorativeFactorAnalysis(label = "Overall",
                                 regEx = regExOverall,
                                 dataset = dat, nfac = 8)
Warning in fa.stats(r = r, f = f, phi = phi, n.obs = n.obs, np.obs = np.obs, :
The estimated weights for the factor scores are probably incorrect.  Try a
different factor score estimation method.
tmp_EFA_overall[[1]]
Factor Analysis using method =  minres
Call: fa(r = tmp_dat, nfactors = nfac, rotate = "promax", cor = "cor")
Standardized loadings (pattern matrix) based upon correlation matrix
                                 MR1   MR3   MR8   MR2   MR6   MR5   MR7   MR4
pair01                          0.69 -0.12 -0.07  0.02 -0.10  0.01  0.06 -0.05
pair02                          0.51 -0.01 -0.09  0.04 -0.02 -0.15 -0.23 -0.03
pair03                          0.63 -0.27 -0.01 -0.03  0.08  0.01 -0.05 -0.05
pair04                          0.78 -0.10  0.07 -0.11  0.09  0.11  0.01  0.08
pair05                          0.85 -0.04  0.04 -0.03  0.02  0.16  0.10  0.03
pair06                          0.61 -0.09  0.02  0.00 -0.03  0.05 -0.08  0.05
pair07                          0.82 -0.02  0.05 -0.07 -0.06  0.13  0.05  0.07
pair08                          0.68  0.00  0.03  0.09  0.03  0.17 -0.13 -0.04
pair09                          0.52  0.11  0.01  0.00  0.04 -0.06 -0.08  0.00
pair10                          0.40  0.02 -0.02  0.12 -0.29  0.06 -0.03 -0.15
pair11                          0.53 -0.04 -0.12  0.06  0.03  0.03  0.10  0.05
pair12                          0.54  0.12  0.08 -0.03 -0.11 -0.06 -0.03  0.02
pair13                          0.64  0.04  0.03 -0.07  0.01 -0.30  0.19  0.10
pair14                          0.69  0.09  0.05 -0.06  0.02 -0.27  0.19  0.06
PathogenDisgust-1              -0.08  0.06  0.04  0.64 -0.13 -0.05  0.00 -0.02
PathogenDisgust-2               0.06 -0.06  0.03  0.66 -0.05 -0.01  0.04 -0.07
PathogenDisgust-3              -0.04 -0.13 -0.01  0.66  0.00 -0.03  0.03  0.03
PathogenDisgust-4               0.04  0.11  0.11  0.40 -0.10 -0.12  0.00  0.08
PathogenDisgust-5              -0.03  0.08 -0.01  0.59 -0.03  0.12 -0.06  0.13
PathogenDisgust-6               0.04  0.00  0.04  0.49  0.12 -0.04 -0.08  0.05
PathogenDisgust-7              -0.03 -0.09 -0.11  0.75 -0.04  0.10 -0.04 -0.07
GermAversion-1                  0.03 -0.11 -0.09  0.14  0.01  0.12  0.16  0.59
GermAversion-2                  0.00 -0.21  0.02  0.11  0.13  0.11  0.06  0.64
GermAversion-3                  0.06  0.02  0.11  0.16 -0.10  0.04 -0.10  0.37
GermAversion-4                 -0.09 -0.22 -0.03  0.26 -0.22  0.17  0.00  0.20
GermAversion-5r                 0.04  0.04 -0.04  0.02 -0.06 -0.18  0.12  0.48
GermAversion-6                  0.05  0.07  0.07  0.22 -0.04 -0.03 -0.15  0.33
GermAversion-7r                -0.03  0.03 -0.13  0.31  0.14 -0.23 -0.16  0.33
GermAversion-8r                 0.02  0.12 -0.01 -0.10  0.11 -0.06 -0.02  0.63
BeliefsAboutObesePersons-1r    -0.07  0.12 -0.15  0.07  0.39  0.16 -0.15 -0.03
BeliefsAboutObesePersons-2      0.01  0.00  0.04 -0.02 -0.06  0.10  0.55  0.01
BeliefsAboutObesePersons-3r    -0.09  0.07  0.00 -0.02  0.65  0.10  0.01  0.06
BeliefsAboutObesePersons-4r     0.10  0.22  0.13  0.00  0.66 -0.07 -0.08 -0.04
BeliefsAboutObesePersons-5r    -0.13  0.06  0.08 -0.06  0.63  0.15 -0.07  0.18
BeliefsAboutObesePersons-6r     0.00 -0.06  0.11 -0.10  0.76  0.06  0.04  0.07
BeliefsAboutObesePersons-7      0.04 -0.09 -0.01 -0.07  0.00  0.13  0.53  0.06
BeliefsAboutObesePersons-8r     0.01 -0.17 -0.19  0.02  0.44  0.12  0.04 -0.11
AttitudeTowardsObesePeople-1    0.00  0.20  0.07 -0.07  0.03  0.51  0.13  0.06
AttitudeTowardsObesePeople-10r -0.07  0.68 -0.16  0.04 -0.15  0.08 -0.11 -0.04
AttitudeTowardsObesePeople-11r  0.08  0.31  0.00  0.11  0.14 -0.07 -0.26 -0.09
AttitudeTowardsObesePeople-12r -0.06  0.53  0.07 -0.03  0.15 -0.13 -0.19 -0.01
AttitudeTowardsObesePeople-13   0.09 -0.23 -0.01  0.08  0.11  0.52  0.07  0.00
AttitudeTowardsObesePeople-14r -0.08  0.54  0.03 -0.01 -0.14 -0.03  0.07 -0.10
AttitudeTowardsObesePeople-15r  0.02  0.44  0.00 -0.06  0.13 -0.02 -0.22 -0.02
AttitudeTowardsObesePeople-16r  0.10  0.47 -0.02  0.03 -0.05  0.11  0.30  0.03
AttitudeTowardsObesePeople-17  -0.12 -0.13 -0.04  0.04  0.25  0.39  0.24  0.04
AttitudeTowardsObesePeople-18  -0.09  0.08  0.13 -0.09  0.18  0.30  0.32  0.15
AttitudeTowardsObesePeople-19r -0.03  0.58 -0.04 -0.03 -0.08  0.14 -0.06  0.01
AttitudeTowardsObesePeople-20r -0.06  0.47  0.04 -0.15  0.11  0.04  0.02  0.19
AttitudeTowardsObesePeople-2r  -0.03  0.47 -0.13  0.13  0.06  0.45 -0.19 -0.09
AttitudeTowardsObesePeople-3r   0.08  0.12  0.01 -0.06  0.01  0.29 -0.03 -0.10
AttitudeTowardsObesePeople-4r  -0.06  0.63  0.04  0.05 -0.07 -0.15  0.26  0.06
AttitudeTowardsObesePeople-5r  -0.01  0.54  0.05  0.03  0.05  0.09  0.24  0.03
AttitudeTowardsObesePeople-6r   0.03  0.49  0.08 -0.04  0.30  0.08  0.00  0.05
AttitudeTowardsObesePeople-7   -0.07  0.25 -0.04  0.02 -0.22  0.38  0.21  0.08
AttitudeTowardsObesePeople-8    0.03 -0.11  0.03 -0.01  0.12  0.61  0.05 -0.07
AttitudeTowardsObesePeople-9   -0.04  0.19  0.01  0.01  0.05  0.50  0.17 -0.03
PerceivedCausesofObesity-1     -0.03 -0.01  0.53 -0.05 -0.16  0.18 -0.36  0.05
PerceivedCausesofObesity-10     0.08  0.13  0.54  0.16  0.08  0.06  0.15 -0.10
PerceivedCausesofObesity-11     0.16  0.06  0.66  0.04  0.11  0.10  0.22  0.04
PerceivedCausesofObesity-12    -0.09  0.02  0.35  0.11  0.17 -0.12  0.02 -0.04
PerceivedCausesofObesity-13    -0.02 -0.02  0.52 -0.08  0.03 -0.11  0.11 -0.07
PerceivedCausesofObesity-14     0.03  0.03  0.56 -0.08 -0.17 -0.02 -0.09  0.05
PerceivedCausesofObesity-2      0.02 -0.02  0.53 -0.01 -0.20  0.03 -0.29 -0.07
PerceivedCausesofObesity-3     -0.08 -0.11  0.45 -0.06 -0.07  0.05 -0.19  0.01
PerceivedCausesofObesity-4      0.00  0.01  0.46  0.25  0.06  0.10  0.35 -0.21
PerceivedCausesofObesity-5     -0.02  0.01  0.63 -0.08 -0.06  0.06  0.01  0.11
PerceivedCausesofObesity-6      0.07  0.01  0.69 -0.04  0.14 -0.09 -0.07  0.07
PerceivedCausesofObesity-7     -0.02  0.00  0.43  0.13  0.07  0.06  0.03 -0.08
PerceivedCausesofObesity-8     -0.07 -0.20  0.26  0.06 -0.02  0.00  0.10 -0.06
PerceivedCausesofObesity-9      0.04 -0.10  0.43 -0.09 -0.09  0.05 -0.31  0.12
                                 h2   u2 com
pair01                         0.54 0.46 1.1
pair02                         0.52 0.48 1.7
pair03                         0.49 0.51 1.4
pair04                         0.55 0.45 1.2
pair05                         0.60 0.40 1.1
pair06                         0.44 0.56 1.1
pair07                         0.65 0.35 1.1
pair08                         0.46 0.54 1.3
pair09                         0.33 0.67 1.2
pair10                         0.33 0.67 2.5
pair11                         0.25 0.75 1.3
pair12                         0.40 0.60 1.3
pair13                         0.57 0.43 1.7
pair14                         0.60 0.40 1.6
PathogenDisgust-1              0.44 0.56 1.2
PathogenDisgust-2              0.46 0.54 1.1
PathogenDisgust-3              0.50 0.50 1.1
PathogenDisgust-4              0.27 0.73 1.8
PathogenDisgust-5              0.43 0.57 1.3
PathogenDisgust-6              0.27 0.73 1.2
PathogenDisgust-7              0.54 0.46 1.1
GermAversion-1                 0.49 0.51 1.5
GermAversion-2                 0.52 0.48 1.5
GermAversion-3                 0.30 0.70 2.1
GermAversion-4                 0.34 0.66 5.0
GermAversion-5r                0.28 0.72 1.5
GermAversion-6                 0.28 0.72 2.6
GermAversion-7r                0.34 0.66 4.2
GermAversion-8r                0.37 0.63 1.2
BeliefsAboutObesePersons-1r    0.30 0.70 2.4
BeliefsAboutObesePersons-2     0.32 0.68 1.1
BeliefsAboutObesePersons-3r    0.56 0.44 1.1
BeliefsAboutObesePersons-4r    0.50 0.50 1.4
BeliefsAboutObesePersons-5r    0.52 0.48 1.5
BeliefsAboutObesePersons-6r    0.56 0.44 1.1
BeliefsAboutObesePersons-7     0.32 0.68 1.3
BeliefsAboutObesePersons-8r    0.31 0.69 2.1
AttitudeTowardsObesePeople-1   0.40 0.60 1.6
AttitudeTowardsObesePeople-10r 0.44 0.56 1.3
AttitudeTowardsObesePeople-11r 0.19 0.81 3.2
AttitudeTowardsObesePeople-12r 0.40 0.60 1.7
AttitudeTowardsObesePeople-13  0.32 0.68 1.6
AttitudeTowardsObesePeople-14r 0.28 0.72 1.3
AttitudeTowardsObesePeople-15r 0.29 0.71 1.8
AttitudeTowardsObesePeople-16r 0.31 0.69 2.0
AttitudeTowardsObesePeople-17  0.48 0.52 3.1
AttitudeTowardsObesePeople-18  0.44 0.56 4.0
AttitudeTowardsObesePeople-19r 0.35 0.65 1.2
AttitudeTowardsObesePeople-20r 0.36 0.64 1.8
AttitudeTowardsObesePeople-2r  0.49 0.51 2.8
AttitudeTowardsObesePeople-3r  0.11 0.89 1.9
AttitudeTowardsObesePeople-4r  0.44 0.56 1.6
AttitudeTowardsObesePeople-5r  0.43 0.57 1.5
AttitudeTowardsObesePeople-6r  0.46 0.54 1.8
AttitudeTowardsObesePeople-7   0.31 0.69 3.4
AttitudeTowardsObesePeople-8   0.41 0.59 1.2
AttitudeTowardsObesePeople-9   0.44 0.56 1.6
PerceivedCausesofObesity-1     0.49 0.51 2.3
PerceivedCausesofObesity-10    0.39 0.61 1.7
PerceivedCausesofObesity-11    0.51 0.49 1.5
PerceivedCausesofObesity-12    0.16 0.84 2.1
PerceivedCausesofObesity-13    0.27 0.73 1.3
PerceivedCausesofObesity-14    0.41 0.59 1.3
PerceivedCausesofObesity-2     0.51 0.49 2.0
PerceivedCausesofObesity-3     0.25 0.75 1.7
PerceivedCausesofObesity-4     0.50 0.50 3.1
PerceivedCausesofObesity-5     0.41 0.59 1.1
PerceivedCausesofObesity-6     0.47 0.53 1.2
PerceivedCausesofObesity-7     0.22 0.78 1.4
PerceivedCausesofObesity-8     0.14 0.86 2.8
PerceivedCausesofObesity-9     0.36 0.64 2.4

                       MR1  MR3  MR8  MR2  MR6  MR5  MR7  MR4
SS loadings           6.22 4.19 4.00 3.32 3.27 2.87 2.29 2.21
Proportion Var        0.09 0.06 0.06 0.05 0.05 0.04 0.03 0.03
Cumulative Var        0.09 0.15 0.20 0.25 0.30 0.34 0.37 0.40
Proportion Explained  0.22 0.15 0.14 0.12 0.12 0.10 0.08 0.08
Cumulative Proportion 0.22 0.37 0.51 0.62 0.74 0.84 0.92 1.00

 With factor correlations of 
      MR1   MR3   MR8   MR2   MR6   MR5   MR7   MR4
MR1  1.00 -0.16  0.11  0.00 -0.40 -0.41 -0.38  0.05
MR3 -0.16  1.00  0.01 -0.22  0.38  0.11  0.04 -0.01
MR8  0.11  0.01  1.00  0.28 -0.27 -0.05 -0.01  0.09
MR2  0.00 -0.22  0.28  1.00 -0.17 -0.01  0.11  0.43
MR6 -0.40  0.38 -0.27 -0.17  1.00  0.18  0.35 -0.16
MR5 -0.41  0.11 -0.05 -0.01  0.18  1.00  0.30 -0.03
MR7 -0.38  0.04 -0.01  0.11  0.35  0.30  1.00 -0.05
MR4  0.05 -0.01  0.09  0.43 -0.16 -0.03 -0.05  1.00

Mean item complexity =  1.8
Test of the hypothesis that 8 factors are sufficient.

df null model =  2485  with the objective function =  31.9 with Chi Square =  10765.74
df of  the model are 1945  and the objective function was  8.72 

The root mean square of the residuals (RMSR) is  0.04 
The df corrected root mean square of the residuals is  0.04 

The harmonic n.obs is  363 with the empirical chi square  2269.73  with prob <  3.7e-07 
The total n.obs was  363  with Likelihood Chi Square =  2895.16  with prob <  1.2e-40 

Tucker Lewis Index of factoring reliability =  0.85
RMSEA index =  0.037  and the 90 % confidence intervals are  0.034 0.039
BIC =  -8569.46
Fit based upon off diagonal values = 0.96
Measures of factor score adequacy             
                                                   MR1  MR3  MR8  MR2  MR6  MR5
Correlation of (regression) scores with factors   0.96 0.93 0.94 0.93 0.93 0.91
Multiple R square of scores with factors          0.93 0.87 0.88 0.86 0.86 0.82
Minimum correlation of possible factor scores     0.86 0.75 0.75 0.72 0.72 0.64
                                                   MR7  MR4
Correlation of (regression) scores with factors   0.89 0.89
Multiple R square of scores with factors          0.80 0.80
Minimum correlation of possible factor scores     0.59 0.59
tmp_EFA_overall[[1]]$loadings

Loadings:
                               MR1    MR3    MR8    MR2    MR6    MR5    MR7   
pair01                          0.689 -0.116                                   
pair02                          0.511                             -0.147 -0.232
pair03                          0.631 -0.268                                   
pair04                          0.783 -0.104        -0.107         0.112       
pair05                          0.848                              0.157       
pair06                          0.605                                          
pair07                          0.824                              0.133       
pair08                          0.684                              0.175 -0.130
pair09                          0.524  0.115                                   
pair10                          0.399                0.120 -0.286              
pair11                          0.527        -0.123                            
pair12                          0.538  0.118               -0.107              
pair13                          0.645                             -0.296  0.190
pair14                          0.690                             -0.275  0.188
PathogenDisgust-1                                    0.637 -0.135              
PathogenDisgust-2                                    0.659                     
PathogenDisgust-3                     -0.126         0.656                     
PathogenDisgust-4                      0.110  0.109  0.397        -0.119       
PathogenDisgust-5                                    0.592         0.123       
PathogenDisgust-6                                    0.493  0.120              
PathogenDisgust-7                            -0.105  0.746                     
GermAversion-1                        -0.110         0.139         0.119  0.161
GermAversion-2                        -0.207         0.111  0.130  0.113       
GermAversion-3                                0.107  0.161               -0.102
GermAversion-4                        -0.222         0.258 -0.218  0.173       
GermAversion-5r                                                   -0.178  0.121
GermAversion-6                                       0.219               -0.152
GermAversion-7r                              -0.132  0.309  0.144 -0.234 -0.159
GermAversion-8r                        0.122        -0.105  0.110              
BeliefsAboutObesePersons-1r            0.120 -0.153         0.394  0.156 -0.150
BeliefsAboutObesePersons-2                                                0.555
BeliefsAboutObesePersons-3r                                 0.647  0.102       
BeliefsAboutObesePersons-4r     0.105  0.218  0.128         0.663              
BeliefsAboutObesePersons-5r    -0.129                       0.629  0.147       
BeliefsAboutObesePersons-6r                   0.112 -0.102  0.759              
BeliefsAboutObesePersons-7                                         0.132  0.534
BeliefsAboutObesePersons-8r           -0.174 -0.188         0.438  0.121       
AttitudeTowardsObesePeople-1           0.198                       0.511  0.129
AttitudeTowardsObesePeople-10r         0.679 -0.162        -0.148        -0.105
AttitudeTowardsObesePeople-11r         0.308         0.110  0.141        -0.258
AttitudeTowardsObesePeople-12r         0.529                0.154 -0.133 -0.191
AttitudeTowardsObesePeople-13         -0.226                0.110  0.524       
AttitudeTowardsObesePeople-14r         0.539               -0.140              
AttitudeTowardsObesePeople-15r         0.436                0.128        -0.224
AttitudeTowardsObesePeople-16r         0.474                       0.107  0.298
AttitudeTowardsObesePeople-17  -0.121 -0.127                0.249  0.389  0.240
AttitudeTowardsObesePeople-18                 0.130         0.180  0.304  0.319
AttitudeTowardsObesePeople-19r         0.579                       0.140       
AttitudeTowardsObesePeople-20r         0.466        -0.151  0.115              
AttitudeTowardsObesePeople-2r          0.465 -0.128  0.132         0.451 -0.188
AttitudeTowardsObesePeople-3r          0.119                       0.290       
AttitudeTowardsObesePeople-4r          0.628                      -0.148  0.261
AttitudeTowardsObesePeople-5r          0.538                              0.239
AttitudeTowardsObesePeople-6r          0.491                0.299              
AttitudeTowardsObesePeople-7           0.254               -0.216  0.378  0.212
AttitudeTowardsObesePeople-8          -0.111                0.115  0.613       
AttitudeTowardsObesePeople-9           0.190                       0.496  0.166
PerceivedCausesofObesity-1                    0.526        -0.163  0.177 -0.359
PerceivedCausesofObesity-10            0.130  0.539  0.156                0.151
PerceivedCausesofObesity-11     0.161         0.657         0.113  0.102  0.216
PerceivedCausesofObesity-12                   0.349  0.112  0.166 -0.115       
PerceivedCausesofObesity-13                   0.522               -0.114  0.114
PerceivedCausesofObesity-14                   0.559        -0.167              
PerceivedCausesofObesity-2                    0.531        -0.205        -0.294
PerceivedCausesofObesity-3            -0.108  0.449                      -0.188
PerceivedCausesofObesity-4                    0.464  0.249         0.100  0.346
PerceivedCausesofObesity-5                    0.626                            
PerceivedCausesofObesity-6                    0.689         0.141              
PerceivedCausesofObesity-7                    0.426  0.131                     
PerceivedCausesofObesity-8            -0.202  0.257                       0.102
PerceivedCausesofObesity-9                    0.430                      -0.311
                               MR4   
pair01                               
pair02                               
pair03                               
pair04                               
pair05                               
pair06                               
pair07                               
pair08                               
pair09                               
pair10                         -0.150
pair11                               
pair12                               
pair13                               
pair14                               
PathogenDisgust-1                    
PathogenDisgust-2                    
PathogenDisgust-3                    
PathogenDisgust-4                    
PathogenDisgust-5               0.132
PathogenDisgust-6                    
PathogenDisgust-7                    
GermAversion-1                  0.593
GermAversion-2                  0.641
GermAversion-3                  0.366
GermAversion-4                  0.202
GermAversion-5r                 0.477
GermAversion-6                  0.329
GermAversion-7r                 0.329
GermAversion-8r                 0.625
BeliefsAboutObesePersons-1r          
BeliefsAboutObesePersons-2           
BeliefsAboutObesePersons-3r          
BeliefsAboutObesePersons-4r          
BeliefsAboutObesePersons-5r     0.181
BeliefsAboutObesePersons-6r          
BeliefsAboutObesePersons-7           
BeliefsAboutObesePersons-8r    -0.107
AttitudeTowardsObesePeople-1         
AttitudeTowardsObesePeople-10r       
AttitudeTowardsObesePeople-11r       
AttitudeTowardsObesePeople-12r       
AttitudeTowardsObesePeople-13        
AttitudeTowardsObesePeople-14r -0.103
AttitudeTowardsObesePeople-15r       
AttitudeTowardsObesePeople-16r       
AttitudeTowardsObesePeople-17        
AttitudeTowardsObesePeople-18   0.153
AttitudeTowardsObesePeople-19r       
AttitudeTowardsObesePeople-20r  0.190
AttitudeTowardsObesePeople-2r        
AttitudeTowardsObesePeople-3r        
AttitudeTowardsObesePeople-4r        
AttitudeTowardsObesePeople-5r        
AttitudeTowardsObesePeople-6r        
AttitudeTowardsObesePeople-7         
AttitudeTowardsObesePeople-8         
AttitudeTowardsObesePeople-9         
PerceivedCausesofObesity-1           
PerceivedCausesofObesity-10          
PerceivedCausesofObesity-11          
PerceivedCausesofObesity-12          
PerceivedCausesofObesity-13          
PerceivedCausesofObesity-14          
PerceivedCausesofObesity-2           
PerceivedCausesofObesity-3           
PerceivedCausesofObesity-4     -0.212
PerceivedCausesofObesity-5      0.109
PerceivedCausesofObesity-6           
PerceivedCausesofObesity-7           
PerceivedCausesofObesity-8           
PerceivedCausesofObesity-9      0.115

                 MR1   MR3   MR8   MR2   MR6   MR5   MR7   MR4
SS loadings    6.100 3.998 4.009 3.192 3.047 2.616 2.185 2.163
Proportion Var 0.086 0.056 0.056 0.045 0.043 0.037 0.031 0.030
Cumulative Var 0.086 0.142 0.199 0.244 0.287 0.323 0.354 0.385
## correlation factor scores
psych::cor.plot(tmp_EFA_overall[[1]]$scores)

Descriptives, correlation plot, EFA, CFA

Here we could apply a self-written function for example to check the reliability and amount of explained variance for the first factor:

Fat Phobia Scale

regEx <- "^pair"
nameVariable <- "FatPhobia"

sum(str_detect(string = colnames(dat), pattern = regEx))
[1] 14
tmp_dat <- na.omit(dat[,str_detect(string = colnames(dat), pattern = regEx)])


tmp <- CFAstats(dataset = tmp_dat, regularExp = regEx, labelLatent = str_remove(string = nameVariable, pattern = "mean_"), 
                showPlots = TRUE, 
                computeEFA = TRUE, 
                computeCFA = TRUE, 
                computeCFAMplus = FALSE)



descriptive statistics: 
       Mean   SD Median CoeffofVariation Minimum Maximun Lower Quantile
pair01 3.83 1.05      4             0.27       1       5              1
pair02 3.75 1.11      4             0.30       1       5              1
pair03 3.68 1.12      4             0.31       1       5              1
pair04 4.08 1.09      4             0.27       1       5              1
pair05 4.23 1.00      5             0.24       1       5              1
pair06 3.93 1.05      4             0.27       1       5              1
pair07 4.16 1.04      4             0.25       1       5              1
pair08 3.52 1.08      4             0.31       1       5              1
pair09 3.85 1.17      4             0.30       1       5              1
pair10 4.51 0.67      5             0.15       2       5              2
pair11 3.52 1.35      4             0.38       1       5              1
pair12 4.41 0.91      5             0.21       1       5              1
pair13 3.92 1.00      4             0.26       1       5              1
pair14 3.98 1.00      4             0.25       1       5              1
       Upper Quantile Skewness Kurtosis(-3) KS-Test
pair01              5    -0.71         0.02       0
pair02              5    -0.78        -0.06       0
pair03              5    -0.62        -0.20       0
pair04              5    -1.28         0.96       0
pair05              5    -1.52         2.07       0
pair06              5    -0.81         0.01       0
pair07              5    -1.36         1.29       0
pair08              5    -0.35        -0.43       0
pair09              5    -0.99         0.22       0
pair10              5    -1.15         0.50       0
pair11              5    -0.51        -0.95       0
pair12              5    -1.83         3.41       0
pair13              5    -0.93         0.55       0
pair14              5    -1.07         0.85       0


variables under investigation:  pair01 pair02 pair03 pair04 pair05 pair06 pair07 pair08 pair09 pair10 pair11 pair12 pair13 pair14 

Cronbachs Alpha: 0.91 

Parallel analysis suggests that the number of factors =  3  and the number of components =  1 
FatPhobia 
Number of components:  1 


EFA factor loadings (1 factor solution): 

Loadings:
       MR1  
pair01 0.766
pair02 0.715
pair03 0.692
pair04 0.808
pair05 0.820
pair06 0.726
pair07 0.850
pair08 0.691
pair09 0.633
pair10 0.625
pair11 0.530
pair12 0.744
pair13 0.719
pair14 0.731

                 MR1
SS loadings    7.304
Proportion Var 0.522
CFA summary and fit statistics: 
lavaan 0.6-19 ended normally after 25 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                        28

  Number of observations                           363

Model Test User Model:
                                              Standard      Scaled
  Test Statistic                               248.324     191.672
  Degrees of freedom                                77          77
  P-value (Chi-square)                           0.000       0.000
  Scaling correction factor                                  1.296
    Yuan-Bentler correction (Mplus variant)                       

Model Test Baseline Model:

  Test statistic                              2279.126    1552.255
  Degrees of freedom                                91          91
  P-value                                        0.000       0.000
  Scaling correction factor                                  1.468

User Model versus Baseline Model:

  Comparative Fit Index (CFI)                    0.922       0.922
  Tucker-Lewis Index (TLI)                       0.907       0.907
                                                                  
  Robust Comparative Fit Index (CFI)                         0.931
  Robust Tucker-Lewis Index (TLI)                            0.918

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)              -6372.609   -6372.609
  Scaling correction factor                                  1.857
      for the MLR correction                                      
  Loglikelihood unrestricted model (H1)      -6248.447   -6248.447
  Scaling correction factor                                  1.445
      for the MLR correction                                      
                                                                  
  Akaike (AIC)                               12801.219   12801.219
  Bayesian (BIC)                             12910.262   12910.262
  Sample-size adjusted Bayesian (SABIC)      12821.431   12821.431

Root Mean Square Error of Approximation:

  RMSEA                                          0.078       0.064
  90 Percent confidence interval - lower         0.068       0.054
  90 Percent confidence interval - upper         0.089       0.074
  P-value H_0: RMSEA <= 0.050                    0.000       0.011
  P-value H_0: RMSEA >= 0.080                    0.410       0.004
                                                                  
  Robust RMSEA                                               0.073
  90 Percent confidence interval - lower                     0.060
  90 Percent confidence interval - upper                     0.086
  P-value H_0: Robust RMSEA <= 0.050                         0.002
  P-value H_0: Robust RMSEA >= 0.080                         0.191

Standardized Root Mean Square Residual:

  SRMR                                           0.043       0.043

Parameter Estimates:

  Standard errors                             Sandwich
  Information bread                           Observed
  Observed information based on                Hessian

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  FatPhobia =~                                                          
    pair01            1.000                               0.751    0.715
    pair02            0.952    0.093   10.269    0.000    0.715    0.644
    pair03            0.969    0.084   11.606    0.000    0.728    0.649
    pair04            1.061    0.091   11.698    0.000    0.797    0.732
    pair05            1.003    0.081   12.397    0.000    0.753    0.757
    pair06            0.929    0.093   10.022    0.000    0.697    0.664
    pair07            1.097    0.102   10.781    0.000    0.824    0.790
    pair08            0.928    0.084   11.060    0.000    0.697    0.644
    pair09            0.840    0.089    9.399    0.000    0.631    0.540
    pair10            0.443    0.068    6.547    0.000    0.333    0.494
    pair11            0.806    0.101    8.009    0.000    0.605    0.449
    pair12            0.734    0.074    9.925    0.000    0.551    0.607
    pair13            0.912    0.076   11.950    0.000    0.685    0.683
    pair14            0.933    0.086   10.813    0.000    0.701    0.700

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .pair01            0.538    0.063    8.537    0.000    0.538    0.488
   .pair02            0.723    0.094    7.731    0.000    0.723    0.586
   .pair03            0.729    0.075    9.689    0.000    0.729    0.579
   .pair04            0.551    0.085    6.460    0.000    0.551    0.464
   .pair05            0.422    0.076    5.569    0.000    0.422    0.427
   .pair06            0.618    0.073    8.466    0.000    0.618    0.560
   .pair07            0.409    0.073    5.575    0.000    0.409    0.376
   .pair08            0.684    0.068   10.115    0.000    0.684    0.585
   .pair09            0.968    0.123    7.883    0.000    0.968    0.708
   .pair10            0.343    0.033   10.514    0.000    0.343    0.756
   .pair11            1.448    0.116   12.515    0.000    1.448    0.798
   .pair12            0.522    0.085    6.114    0.000    0.522    0.632
   .pair13            0.538    0.057    9.476    0.000    0.538    0.534
   .pair14            0.511    0.055    9.215    0.000    0.511    0.510
    FatPhobia         0.564    0.084    6.705    0.000    1.000    1.000



CFA first 6 Modification Indices: 
       lhs op    rhs      mi    epc sepc.lv sepc.all sepc.nox
120 pair13 ~~ pair14 105.216  0.310   0.310    0.592    0.592
77  pair05 ~~ pair07  20.694  0.118   0.118    0.284    0.284
67  pair04 ~~ pair06  16.106  0.136   0.136    0.233    0.233
35  pair01 ~~ pair07   7.875 -0.080  -0.080   -0.172   -0.172
83  pair05 ~~ pair13   7.636 -0.078  -0.078   -0.163   -0.163
49  pair02 ~~ pair09   7.210  0.124   0.124    0.149    0.149

check modification indices - one strong local item dependency

Subscale Pathogen Disgust

regEx <- "^PathogenDisgus"
nameVariable <- "PatDis"

sum(str_detect(string = colnames(dat), pattern = regEx))
[1] 7
tmp_dat <- na.omit(dat[,str_detect(string = colnames(dat), pattern = regEx)])


tmp <- CFAstats(dataset = tmp_dat, regularExp = regEx, labelLatent = str_remove(string = nameVariable, pattern = "mean_"), 
                showPlots = TRUE, 
                computeEFA = TRUE, 
                computeCFA = TRUE, 
                computeCFAMplus = FALSE)



descriptive statistics: 
                  Mean   SD Median CoeffofVariation Minimum Maximun
PathogenDisgust-1 4.60 1.75      5             0.38       1       7
PathogenDisgust-2 4.99 1.54      5             0.31       1       7
PathogenDisgust-3 4.10 1.61      4             0.39       1       7
PathogenDisgust-4 5.75 1.31      6             0.23       1       7
PathogenDisgust-5 4.97 1.78      5             0.36       1       7
PathogenDisgust-6 4.40 1.88      5             0.43       1       7
PathogenDisgust-7 3.91 1.88      4             0.48       1       7
                  Lower Quantile Upper Quantile Skewness Kurtosis(-3) KS-Test
PathogenDisgust-1              1              7    -0.32        -0.93       0
PathogenDisgust-2              1              7    -0.40        -0.73       0
PathogenDisgust-3              1              7     0.14        -0.95       0
PathogenDisgust-4              1              7    -0.89         0.07       0
PathogenDisgust-5              1              7    -0.56        -0.70       0
PathogenDisgust-6              1              7    -0.17        -1.10       0
PathogenDisgust-7              1              7     0.11        -1.07       0


variables under investigation:  PathogenDisgust1 PathogenDisgust2 PathogenDisgust3 PathogenDisgust4 PathogenDisgust5 PathogenDisgust6 PathogenDisgust7 

Cronbachs Alpha: 0.81 

Parallel analysis suggests that the number of factors =  3  and the number of components =  1 
PatDis 
Number of components:  1 



EFA factor loadings (1 factor solution): 

Loadings:
                 MR1  
PathogenDisgust1 0.668
PathogenDisgust2 0.706
PathogenDisgust3 0.728
PathogenDisgust4 0.541
PathogenDisgust5 0.677
PathogenDisgust6 0.523
PathogenDisgust7 0.697

                 MR1
SS loadings    2.985
Proportion Var 0.426
CFA summary and fit statistics: 
lavaan 0.6-19 ended normally after 27 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                        14

  Number of observations                           363

Model Test User Model:
                                              Standard      Scaled
  Test Statistic                                68.287      56.975
  Degrees of freedom                                14          14
  P-value (Chi-square)                           0.000       0.000
  Scaling correction factor                                  1.199
    Yuan-Bentler correction (Mplus variant)                       

Model Test Baseline Model:

  Test statistic                               734.814     599.414
  Degrees of freedom                                21          21
  P-value                                        0.000       0.000
  Scaling correction factor                                  1.226

User Model versus Baseline Model:

  Comparative Fit Index (CFI)                    0.924       0.926
  Tucker-Lewis Index (TLI)                       0.886       0.889
                                                                  
  Robust Comparative Fit Index (CFI)                         0.927
  Robust Tucker-Lewis Index (TLI)                            0.891

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)              -4566.704   -4566.704
  Scaling correction factor                                  0.947
      for the MLR correction                                      
  Loglikelihood unrestricted model (H1)      -4532.561   -4532.561
  Scaling correction factor                                  1.073
      for the MLR correction                                      
                                                                  
  Akaike (AIC)                                9161.409    9161.409
  Bayesian (BIC)                              9215.930    9215.930
  Sample-size adjusted Bayesian (SABIC)       9171.515    9171.515

Root Mean Square Error of Approximation:

  RMSEA                                          0.103       0.092
  90 Percent confidence interval - lower         0.080       0.070
  90 Percent confidence interval - upper         0.128       0.115
  P-value H_0: RMSEA <= 0.050                    0.000       0.001
  P-value H_0: RMSEA >= 0.080                    0.947       0.822
                                                                  
  Robust RMSEA                                               0.101
  90 Percent confidence interval - lower                     0.074
  90 Percent confidence interval - upper                     0.129
  P-value H_0: Robust RMSEA <= 0.050                         0.001
  P-value H_0: Robust RMSEA >= 0.080                         0.905

Standardized Root Mean Square Residual:

  SRMR                                           0.052       0.052

Parameter Estimates:

  Standard errors                             Sandwich
  Information bread                           Observed
  Observed information based on                Hessian

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  PatDis =~                                                             
    PathogenDsgst1    1.000                               1.092    0.626
    PathogenDsgst2    0.972    0.092   10.592    0.000    1.061    0.690
    PathogenDsgst3    1.079    0.108   10.004    0.000    1.178    0.733
    PathogenDsgst4    0.567    0.073    7.770    0.000    0.618    0.471
    PathogenDsgst5    1.043    0.101   10.284    0.000    1.139    0.642
    PathogenDsgst6    0.825    0.092    8.956    0.000    0.900    0.479
    PathogenDsgst7    1.194    0.120    9.913    0.000    1.303    0.696

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .PathogenDsgst1    1.848    0.163   11.350    0.000    1.848    0.608
   .PathogenDsgst2    1.241    0.128    9.682    0.000    1.241    0.525
   .PathogenDsgst3    1.197    0.139    8.619    0.000    1.197    0.463
   .PathogenDsgst4    1.341    0.107   12.590    0.000    1.341    0.778
   .PathogenDsgst5    1.854    0.168   11.030    0.000    1.854    0.588
   .PathogenDsgst6    2.724    0.192   14.185    0.000    2.724    0.771
   .PathogenDsgst7    1.808    0.198    9.139    0.000    1.808    0.516
    PatDis            1.191    0.189    6.294    0.000    1.000    1.000



CFA first 6 Modification Indices: 
                lhs op              rhs     mi    epc sepc.lv sepc.all sepc.nox
24 PathogenDisgust2 ~~ PathogenDisgust5 18.698 -0.441  -0.441   -0.291   -0.291
22 PathogenDisgust2 ~~ PathogenDisgust3 18.652  0.397   0.397    0.325    0.325
32 PathogenDisgust4 ~~ PathogenDisgust6 13.850  0.400   0.400    0.209    0.209
35 PathogenDisgust5 ~~ PathogenDisgust7 13.463  0.455   0.455    0.248    0.248
29 PathogenDisgust3 ~~ PathogenDisgust6  9.379 -0.355  -0.355   -0.196   -0.196
20 PathogenDisgust1 ~~ PathogenDisgust6  8.496  0.386   0.386    0.172    0.172

Subscale Germ Aversion

regEx <- "^GermAversion"
nameVariable <- "GermAv"

sum(str_detect(string = colnames(dat), pattern = regEx))
[1] 8
tmp_dat <- na.omit(dat[,str_detect(string = colnames(dat), pattern = regEx)])


tmp <- CFAstats(dataset = tmp_dat, regularExp = regEx, labelLatent = str_remove(string = nameVariable, pattern = "mean_"), 
                showPlots = TRUE, 
                computeEFA = TRUE, 
                computeCFA = TRUE, 
                computeCFAMplus = FALSE)



descriptive statistics: 
                Mean   SD Median CoeffofVariation Minimum Maximun
GermAversion-1  4.28 1.85      4             0.43       1       7
GermAversion-2  3.51 1.92      4             0.55       1       7
GermAversion-3  5.04 1.77      5             0.35       1       7
GermAversion-4  3.89 2.12      4             0.54       1       7
GermAversion-5r 3.90 2.05      4             0.52       1       7
GermAversion-6  5.98 1.36      6             0.23       1       7
GermAversion-7r 4.23 1.84      5             0.44       1       7
GermAversion-8r 4.03 2.07      4             0.51       1       7
                Lower Quantile Upper Quantile Skewness Kurtosis(-3) KS-Test
GermAversion-1               1              7    -0.21        -1.02       0
GermAversion-2               1              7     0.24        -1.08       0
GermAversion-3               1              7    -0.69        -0.50       0
GermAversion-4               1              7     0.10        -1.40       0
GermAversion-5r              1              7     0.22        -1.33       0
GermAversion-6               1              7    -1.63         2.43       0
GermAversion-7r              1              7    -0.14        -1.15       0
GermAversion-8r              1              7    -0.03        -1.37       0


variables under investigation:  GermAversion1 GermAversion2 GermAversion3 GermAversion4 GermAversion5r GermAversion6 GermAversion7r GermAversion8r 

Cronbachs Alpha: 0.74 

Parallel analysis suggests that the number of factors =  3  and the number of components =  1 
GermAv 
Number of components:  1 



EFA factor loadings (1 factor solution): 

Loadings:
               MR1  
GermAversion1  0.705
GermAversion2  0.737
GermAversion3  0.518
GermAversion4  0.412
GermAversion5r 0.496
GermAversion6  0.563
GermAversion7r 0.466
GermAversion8r 0.537

                 MR1
SS loadings    2.548
Proportion Var 0.319
CFA summary and fit statistics: 
lavaan 0.6-19 ended normally after 32 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                        16

  Number of observations                           363

Model Test User Model:
                                              Standard      Scaled
  Test Statistic                                73.743      66.968
  Degrees of freedom                                20          20
  P-value (Chi-square)                           0.000       0.000
  Scaling correction factor                                  1.101
    Yuan-Bentler correction (Mplus variant)                       

Model Test Baseline Model:

  Test statistic                               527.189     461.027
  Degrees of freedom                                28          28
  P-value                                        0.000       0.000
  Scaling correction factor                                  1.144

User Model versus Baseline Model:

  Comparative Fit Index (CFI)                    0.892       0.892
  Tucker-Lewis Index (TLI)                       0.849       0.848
                                                                  
  Robust Comparative Fit Index (CFI)                         0.896
  Robust Tucker-Lewis Index (TLI)                            0.854

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)              -5686.341   -5686.341
  Scaling correction factor                                  0.955
      for the MLR correction                                      
  Loglikelihood unrestricted model (H1)      -5649.469   -5649.469
  Scaling correction factor                                  1.036
      for the MLR correction                                      
                                                                  
  Akaike (AIC)                               11404.682   11404.682
  Bayesian (BIC)                             11466.992   11466.992
  Sample-size adjusted Bayesian (SABIC)      11416.231   11416.231

Root Mean Square Error of Approximation:

  RMSEA                                          0.086       0.080
  90 Percent confidence interval - lower         0.066       0.061
  90 Percent confidence interval - upper         0.107       0.101
  P-value H_0: RMSEA <= 0.050                    0.003       0.007
  P-value H_0: RMSEA >= 0.080                    0.703       0.538
                                                                  
  Robust RMSEA                                               0.084
  90 Percent confidence interval - lower                     0.063
  90 Percent confidence interval - upper                     0.107
  P-value H_0: Robust RMSEA <= 0.050                         0.006
  P-value H_0: Robust RMSEA >= 0.080                         0.651

Standardized Root Mean Square Residual:

  SRMR                                           0.058       0.058

Parameter Estimates:

  Standard errors                             Sandwich
  Information bread                           Observed
  Observed information based on                Hessian

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  GermAv =~                                                             
    GermAversion1     1.000                               1.272    0.690
    GermAversion2     1.098    0.085   12.958    0.000    1.397    0.729
    GermAversion3     0.642    0.090    7.154    0.000    0.817    0.461
    GermAversion4     0.707    0.105    6.712    0.000    0.899    0.425
    GermAversion5r    0.711    0.112    6.319    0.000    0.904    0.442
    GermAversion6     0.496    0.068    7.330    0.000    0.631    0.464
    GermAversion7r    0.601    0.103    5.831    0.000    0.764    0.416
    GermAversion8r    0.801    0.106    7.571    0.000    1.019    0.494

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .GermAversion1     1.784    0.184    9.695    0.000    1.784    0.525
   .GermAversion2     1.721    0.192    8.976    0.000    1.721    0.469
   .GermAversion3     2.469    0.200   12.357    0.000    2.469    0.787
   .GermAversion4     3.663    0.269   13.637    0.000    3.663    0.819
   .GermAversion5r    3.370    0.254   13.277    0.000    3.370    0.805
   .GermAversion6     1.447    0.163    8.856    0.000    1.447    0.784
   .GermAversion7r    2.792    0.208   13.415    0.000    2.792    0.827
   .GermAversion8r    3.223    0.253   12.763    0.000    3.223    0.756
    GermAv            1.617    0.230    7.027    0.000    1.000    1.000



CFA first 6 Modification Indices: 
              lhs op            rhs     mi    epc sepc.lv sepc.all sepc.nox
39  GermAversion4 ~~ GermAversion8r 15.625 -0.781  -0.781   -0.227   -0.227
27  GermAversion2 ~~ GermAversion5r  9.777 -0.527  -0.527   -0.219   -0.219
23  GermAversion1 ~~ GermAversion7r  8.630 -0.428  -0.428   -0.192   -0.192
45 GermAversion7r ~~ GermAversion8r  8.214  0.493   0.493    0.164    0.164
18  GermAversion1 ~~  GermAversion2  7.753  0.470   0.470    0.268    0.268
31  GermAversion3 ~~  GermAversion4  7.114  0.457   0.457    0.152    0.152

item 4

Beliefs About Obese Persons Scale

regEx <- "^BeliefsAboutObesePersons"
nameVariable <- "BelAbObPe"

sum(str_detect(string = colnames(dat), pattern = regEx))
[1] 8
tmp_dat <- na.omit(dat[,str_detect(string = colnames(dat), pattern = regEx)])


tmp <- CFAstats(dataset = tmp_dat, regularExp = regEx, labelLatent = str_remove(string = nameVariable, pattern = "mean_"), 
                showPlots = TRUE, 
                computeEFA = TRUE, 
                computeCFA = TRUE, 
                computeCFAMplus = FALSE)



descriptive statistics: 
                            Mean   SD Median CoeffofVariation Minimum Maximun
BeliefsAboutObesePersons-1r 2.64 1.26      2             0.47       1       6
BeliefsAboutObesePersons-2  3.55 1.30      4             0.36       1       6
BeliefsAboutObesePersons-3r 2.20 1.19      2             0.54       1       6
BeliefsAboutObesePersons-4r 2.70 1.33      2             0.49       1       6
BeliefsAboutObesePersons-5r 2.09 1.22      2             0.58       1       6
BeliefsAboutObesePersons-6r 2.12 1.11      2             0.53       1       6
BeliefsAboutObesePersons-7  3.03 1.37      3             0.45       1       6
BeliefsAboutObesePersons-8r 1.85 0.94      2             0.51       1       5
                            Lower Quantile Upper Quantile Skewness Kurtosis(-3)
BeliefsAboutObesePersons-1r              1              6     0.70         0.12
BeliefsAboutObesePersons-2               1              6    -0.21        -0.60
BeliefsAboutObesePersons-3r              1              6     1.26         1.61
BeliefsAboutObesePersons-4r              1              6     0.75        -0.03
BeliefsAboutObesePersons-5r              1              6     1.33         1.39
BeliefsAboutObesePersons-6r              1              6     1.09         1.14
BeliefsAboutObesePersons-7               1              6     0.33        -0.78
BeliefsAboutObesePersons-8r              1              5     1.13         1.10
                            KS-Test
BeliefsAboutObesePersons-1r       0
BeliefsAboutObesePersons-2        0
BeliefsAboutObesePersons-3r       0
BeliefsAboutObesePersons-4r       0
BeliefsAboutObesePersons-5r       0
BeliefsAboutObesePersons-6r       0
BeliefsAboutObesePersons-7        0
BeliefsAboutObesePersons-8r       0


variables under investigation:  BeliefsAboutObesePersons1r BeliefsAboutObesePersons2 BeliefsAboutObesePersons3r BeliefsAboutObesePersons4r BeliefsAboutObesePersons5r BeliefsAboutObesePersons6r BeliefsAboutObesePersons7 BeliefsAboutObesePersons8r 

Cronbachs Alpha: 0.74 
Error in if (any(lower > upper)) stop("lower>upper integration limits") : 
  Fehlender Wert, wo TRUE/FALSE nötig ist
[1] "use instead of polychoric correlations pearson correlations"

Parallel analysis suggests that the number of factors =  2  and the number of components =  2 
BelAbObPe 
Number of components:  2 
KMO criteria is to low (< .6) for: 
 BeliefsAboutObesePersons2 
 mean KMO: 0.84 


EFA factor loadings (1 factor solution): 

Loadings:
                           MR1  
BeliefsAboutObesePersons1r 0.587
BeliefsAboutObesePersons2  0.168
BeliefsAboutObesePersons3r 0.831
BeliefsAboutObesePersons4r 0.587
BeliefsAboutObesePersons5r 0.767
BeliefsAboutObesePersons6r 0.807
BeliefsAboutObesePersons7  0.235
BeliefsAboutObesePersons8r 0.484

                 MR1
SS loadings    2.936
Proportion Var 0.367
CFA summary and fit statistics: 
lavaan 0.6-19 ended normally after 27 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                        16

  Number of observations                           363

Model Test User Model:
                                              Standard      Scaled
  Test Statistic                                81.590      62.545
  Degrees of freedom                                20          20
  P-value (Chi-square)                           0.000       0.000
  Scaling correction factor                                  1.305
    Yuan-Bentler correction (Mplus variant)                       

Model Test Baseline Model:

  Test statistic                               707.340     486.290
  Degrees of freedom                                28          28
  P-value                                        0.000       0.000
  Scaling correction factor                                  1.455

User Model versus Baseline Model:

  Comparative Fit Index (CFI)                    0.909       0.907
  Tucker-Lewis Index (TLI)                       0.873       0.870
                                                                  
  Robust Comparative Fit Index (CFI)                         0.917
  Robust Tucker-Lewis Index (TLI)                            0.883

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)              -4348.755   -4348.755
  Scaling correction factor                                  1.538
      for the MLR correction                                      
  Loglikelihood unrestricted model (H1)      -4307.960   -4307.960
  Scaling correction factor                                  1.408
      for the MLR correction                                      
                                                                  
  Akaike (AIC)                                8729.510    8729.510
  Bayesian (BIC)                              8791.820    8791.820
  Sample-size adjusted Bayesian (SABIC)       8741.059    8741.059

Root Mean Square Error of Approximation:

  RMSEA                                          0.092       0.077
  90 Percent confidence interval - lower         0.072       0.058
  90 Percent confidence interval - upper         0.113       0.096
  P-value H_0: RMSEA <= 0.050                    0.001       0.010
  P-value H_0: RMSEA >= 0.080                    0.844       0.402
                                                                  
  Robust RMSEA                                               0.087
  90 Percent confidence interval - lower                     0.063
  90 Percent confidence interval - upper                     0.112
  P-value H_0: Robust RMSEA <= 0.050                         0.006
  P-value H_0: Robust RMSEA >= 0.080                         0.713

Standardized Root Mean Square Residual:

  SRMR                                           0.069       0.069

Parameter Estimates:

  Standard errors                             Sandwich
  Information bread                           Observed
  Observed information based on                Hessian

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  BelAbObPe =~                                                          
    BlfsAbtObsPrs1    1.000                               0.681    0.543
    BlfsAbtObsPrs2    0.269    0.120    2.244    0.025    0.183    0.142
    BlfsAbtObsPrs3    1.392    0.160    8.703    0.000    0.947    0.795
    BlfsAbtObsPrs4    1.157    0.154    7.494    0.000    0.788    0.594
    BlfsAbtObsPrs5    1.254    0.159    7.884    0.000    0.854    0.701
    BlfsAbtObsPrs6    1.226    0.168    7.296    0.000    0.834    0.750
    BlfsAbtObsPrs7    0.367    0.133    2.756    0.006    0.249    0.183
    BlfsAbtObsPrs8    0.602    0.115    5.245    0.000    0.410    0.437

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .BlfsAbtObsPrs1    1.110    0.106   10.495    0.000    1.110    0.706
   .BlfsAbtObsPrs2    1.640    0.105   15.666    0.000    1.640    0.980
   .BlfsAbtObsPrs3    0.523    0.087    5.983    0.000    0.523    0.368
   .BlfsAbtObsPrs4    1.137    0.123    9.225    0.000    1.137    0.647
   .BlfsAbtObsPrs5    0.755    0.128    5.888    0.000    0.755    0.509
   .BlfsAbtObsPrs6    0.542    0.085    6.335    0.000    0.542    0.438
   .BlfsAbtObsPrs7    1.796    0.117   15.300    0.000    1.796    0.967
   .BlfsAbtObsPrs8    0.710    0.067   10.614    0.000    0.710    0.809
    BelAbObPe         0.463    0.094    4.929    0.000    1.000    1.000



CFA first 6 Modification Indices: 
                          lhs op                        rhs     mi    epc
29  BeliefsAboutObesePersons2 ~~  BeliefsAboutObesePersons7 47.115  0.622
38 BeliefsAboutObesePersons4r ~~  BeliefsAboutObesePersons7  5.861 -0.193
23 BeliefsAboutObesePersons1r ~~  BeliefsAboutObesePersons7  5.405 -0.180
22 BeliefsAboutObesePersons1r ~~ BeliefsAboutObesePersons6r  5.108 -0.117
26  BeliefsAboutObesePersons2 ~~ BeliefsAboutObesePersons4r  3.610 -0.144
43 BeliefsAboutObesePersons6r ~~  BeliefsAboutObesePersons7  3.477  0.112
   sepc.lv sepc.all sepc.nox
29   0.622    0.362    0.362
38  -0.193   -0.135   -0.135
23  -0.180   -0.128   -0.128
22  -0.117   -0.151   -0.151
26  -0.144   -0.106   -0.106
43   0.112    0.114    0.114

item 2

Attitude Towards Obese People Scale

regEx <- "^AttitudeTowardsObesePeople"
nameVariable <- "AttTowObPe"

sum(str_detect(string = colnames(dat), pattern = regEx))
[1] 20
tmp_dat <- na.omit(dat[,str_detect(string = colnames(dat), pattern = regEx)])


tmp <- CFAstats(dataset = tmp_dat, regularExp = regEx, labelLatent = str_remove(string = nameVariable, pattern = "mean_"), 
                showPlots = TRUE, 
                computeEFA = TRUE, 
                computeCFA = TRUE, 
                computeCFAMplus = FALSE)



descriptive statistics: 
                               Mean   SD Median CoeffofVariation Minimum
AttitudeTowardsObesePeople-1   3.37 1.35      3             0.40       1
AttitudeTowardsObesePeople-10r 3.76 1.37      4             0.37       1
AttitudeTowardsObesePeople-11r 3.81 1.34      4             0.35       1
AttitudeTowardsObesePeople-12r 3.90 1.35      4             0.34       1
AttitudeTowardsObesePeople-13  2.78 1.37      3             0.49       1
AttitudeTowardsObesePeople-14r 3.93 1.36      4             0.35       1
AttitudeTowardsObesePeople-15r 3.77 1.35      4             0.36       1
AttitudeTowardsObesePeople-16r 4.09 1.50      4             0.37       1
AttitudeTowardsObesePeople-17  2.20 1.31      2             0.60       1
AttitudeTowardsObesePeople-18  2.73 1.49      3             0.55       1
AttitudeTowardsObesePeople-19r 3.75 1.27      4             0.34       1
AttitudeTowardsObesePeople-20r 3.48 1.53      3             0.44       1
AttitudeTowardsObesePeople-2r  2.92 1.25      3             0.43       1
AttitudeTowardsObesePeople-3r  2.79 1.30      3             0.47       1
AttitudeTowardsObesePeople-4r  4.02 1.51      4             0.38       1
AttitudeTowardsObesePeople-5r  3.11 1.46      3             0.47       1
AttitudeTowardsObesePeople-6r  3.35 1.53      3             0.46       1
AttitudeTowardsObesePeople-7   3.76 1.25      4             0.33       1
AttitudeTowardsObesePeople-8   2.89 1.31      3             0.45       1
AttitudeTowardsObesePeople-9   3.20 1.31      3             0.41       1
                               Maximun Lower Quantile Upper Quantile Skewness
AttitudeTowardsObesePeople-1         6              1              6    -0.02
AttitudeTowardsObesePeople-10r       6              1              6    -0.02
AttitudeTowardsObesePeople-11r       6              1              6    -0.14
AttitudeTowardsObesePeople-12r       6              1              6    -0.10
AttitudeTowardsObesePeople-13        6              1              6     0.58
AttitudeTowardsObesePeople-14r       6              1              6    -0.16
AttitudeTowardsObesePeople-15r       6              1              6    -0.05
AttitudeTowardsObesePeople-16r       6              1              6    -0.26
AttitudeTowardsObesePeople-17        6              1              6     1.02
AttitudeTowardsObesePeople-18        6              1              6     0.46
AttitudeTowardsObesePeople-19r       6              1              6    -0.02
AttitudeTowardsObesePeople-20r       6              1              6     0.10
AttitudeTowardsObesePeople-2r        6              1              6     0.44
AttitudeTowardsObesePeople-3r        6              1              6     0.52
AttitudeTowardsObesePeople-4r        6              1              6    -0.34
AttitudeTowardsObesePeople-5r        6              1              6     0.30
AttitudeTowardsObesePeople-6r        6              1              6     0.19
AttitudeTowardsObesePeople-7         6              1              6    -0.21
AttitudeTowardsObesePeople-8         6              1              6     0.35
AttitudeTowardsObesePeople-9         6              1              6     0.19
                               Kurtosis(-3) KS-Test
AttitudeTowardsObesePeople-1          -0.70       0
AttitudeTowardsObesePeople-10r        -0.82       0
AttitudeTowardsObesePeople-11r        -0.68       0
AttitudeTowardsObesePeople-12r        -0.78       0
AttitudeTowardsObesePeople-13         -0.44       0
AttitudeTowardsObesePeople-14r        -0.86       0
AttitudeTowardsObesePeople-15r        -0.65       0
AttitudeTowardsObesePeople-16r        -1.06       0
AttitudeTowardsObesePeople-17          0.28       0
AttitudeTowardsObesePeople-18         -0.80       0
AttitudeTowardsObesePeople-19r        -0.60       0
AttitudeTowardsObesePeople-20r        -1.00       0
AttitudeTowardsObesePeople-2r         -0.23       0
AttitudeTowardsObesePeople-3r         -0.42       0
AttitudeTowardsObesePeople-4r         -0.92       0
AttitudeTowardsObesePeople-5r         -0.77       0
AttitudeTowardsObesePeople-6r         -1.05       0
AttitudeTowardsObesePeople-7          -0.48       0
AttitudeTowardsObesePeople-8          -0.66       0
AttitudeTowardsObesePeople-9          -0.51       0


variables under investigation:  AttitudeTowardsObesePeople1 AttitudeTowardsObesePeople10r AttitudeTowardsObesePeople11r AttitudeTowardsObesePeople12r AttitudeTowardsObesePeople13 AttitudeTowardsObesePeople14r AttitudeTowardsObesePeople15r AttitudeTowardsObesePeople16r AttitudeTowardsObesePeople17 AttitudeTowardsObesePeople18 AttitudeTowardsObesePeople19r AttitudeTowardsObesePeople20r AttitudeTowardsObesePeople2r AttitudeTowardsObesePeople3r AttitudeTowardsObesePeople4r AttitudeTowardsObesePeople5r AttitudeTowardsObesePeople6r AttitudeTowardsObesePeople7 AttitudeTowardsObesePeople8 AttitudeTowardsObesePeople9 

Cronbachs Alpha: 0.83 

Parallel analysis suggests that the number of factors =  4  and the number of components =  3 
AttTowObPe 
Number of components:  3 



EFA factor loadings (1 factor solution): 

Loadings:
                              MR1  
AttitudeTowardsObesePeople1   0.556
AttitudeTowardsObesePeople10r 0.546
AttitudeTowardsObesePeople11r 0.174
AttitudeTowardsObesePeople12r 0.409
AttitudeTowardsObesePeople13  0.185
AttitudeTowardsObesePeople14r 0.425
AttitudeTowardsObesePeople15r 0.385
AttitudeTowardsObesePeople16r 0.529
AttitudeTowardsObesePeople17  0.419
AttitudeTowardsObesePeople18  0.539
AttitudeTowardsObesePeople19r 0.548
AttitudeTowardsObesePeople20r 0.577
AttitudeTowardsObesePeople2r  0.625
AttitudeTowardsObesePeople3r  0.265
AttitudeTowardsObesePeople4r  0.515
AttitudeTowardsObesePeople5r  0.671
AttitudeTowardsObesePeople6r  0.645
AttitudeTowardsObesePeople7   0.427
AttitudeTowardsObesePeople8   0.336
AttitudeTowardsObesePeople9   0.564

                 MR1
SS loadings    4.751
Proportion Var 0.238
CFA summary and fit statistics: 
lavaan 0.6-19 ended normally after 39 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                        40

  Number of observations                           363

Model Test User Model:
                                              Standard      Scaled
  Test Statistic                               904.749     776.411
  Degrees of freedom                               170         170
  P-value (Chi-square)                           0.000       0.000
  Scaling correction factor                                  1.165
    Yuan-Bentler correction (Mplus variant)                       

Model Test Baseline Model:

  Test statistic                              2012.252    1657.521
  Degrees of freedom                               190         190
  P-value                                        0.000       0.000
  Scaling correction factor                                  1.214

User Model versus Baseline Model:

  Comparative Fit Index (CFI)                    0.597       0.587
  Tucker-Lewis Index (TLI)                       0.549       0.538
                                                                  
  Robust Comparative Fit Index (CFI)                         0.603
  Robust Tucker-Lewis Index (TLI)                            0.557

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)             -12035.010  -12035.010
  Scaling correction factor                                  1.149
      for the MLR correction                                      
  Loglikelihood unrestricted model (H1)     -11582.636  -11582.636
  Scaling correction factor                                  1.162
      for the MLR correction                                      
                                                                  
  Akaike (AIC)                               24150.021   24150.021
  Bayesian (BIC)                             24305.797   24305.797
  Sample-size adjusted Bayesian (SABIC)      24178.894   24178.894

Root Mean Square Error of Approximation:

  RMSEA                                          0.109       0.099
  90 Percent confidence interval - lower         0.102       0.093
  90 Percent confidence interval - upper         0.116       0.106
  P-value H_0: RMSEA <= 0.050                    0.000       0.000
  P-value H_0: RMSEA >= 0.080                    1.000       1.000
                                                                  
  Robust RMSEA                                               0.107
  90 Percent confidence interval - lower                     0.099
  90 Percent confidence interval - upper                     0.115
  P-value H_0: Robust RMSEA <= 0.050                         0.000
  P-value H_0: Robust RMSEA >= 0.080                         1.000

Standardized Root Mean Square Residual:

  SRMR                                           0.113       0.113

Parameter Estimates:

  Standard errors                             Sandwich
  Information bread                           Observed
  Observed information based on                Hessian

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  AttTowObPe =~                                                         
    AtttdTwrdsObP1    1.000                               0.667    0.495
    AtttdTwrdsOP10    1.129    0.254    4.453    0.000    0.753    0.549
    AtttdTwrdsOP11    0.403    0.208    1.934    0.053    0.269    0.201
    AtttdTwrdsOP12    0.870    0.249    3.498    0.000    0.580    0.432
    AtttdTwrdsOP13    0.187    0.167    1.121    0.262    0.125    0.092
    AtttdTwrdsOP14    0.883    0.213    4.142    0.000    0.589    0.434
    AtttdTwrdsOP15    0.802    0.227    3.537    0.000    0.535    0.397
    AtttdTwrdsOP16    1.135    0.230    4.942    0.000    0.757    0.507
    AtttdTwrdsOP17    0.635    0.121    5.230    0.000    0.424    0.324
    AtttdTwrdsOP18    1.037    0.129    8.016    0.000    0.692    0.466
    AtttdTwrdsOP19    1.034    0.218    4.740    0.000    0.690    0.542
    AtttdTwrdsOP20    1.271    0.247    5.146    0.000    0.848    0.557
    AtttdTwrdsObP2    1.080    0.162    6.651    0.000    0.720    0.576
    AtttdTwrdsObP3    0.427    0.128    3.327    0.001    0.285    0.219
    AtttdTwrdsObP4    1.170    0.280    4.182    0.000    0.781    0.517
    AtttdTwrdsObP5    1.429    0.240    5.965    0.000    0.954    0.652
    AtttdTwrdsObP6    1.445    0.289    4.998    0.000    0.964    0.633
    AtttdTwrdsObP7    0.722    0.114    6.316    0.000    0.481    0.387
    AtttdTwrdsObP8    0.517    0.136    3.815    0.000    0.345    0.263
    AtttdTwrdsObP9    0.971    0.110    8.795    0.000    0.648    0.493

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .AtttdTwrdsObP1    1.368    0.148    9.219    0.000    1.368    0.755
   .AtttdTwrdsOP10    1.313    0.124   10.582    0.000    1.313    0.698
   .AtttdTwrdsOP11    1.707    0.116   14.700    0.000    1.707    0.959
   .AtttdTwrdsOP12    1.469    0.127   11.537    0.000    1.469    0.814
   .AtttdTwrdsOP13    1.848    0.132   14.010    0.000    1.848    0.992
   .AtttdTwrdsOP14    1.494    0.107   13.963    0.000    1.494    0.811
   .AtttdTwrdsOP15    1.528    0.129   11.857    0.000    1.528    0.842
   .AtttdTwrdsOP16    1.661    0.145   11.491    0.000    1.661    0.743
   .AtttdTwrdsOP17    1.532    0.165    9.261    0.000    1.532    0.895
   .AtttdTwrdsOP18    1.729    0.193    8.973    0.000    1.729    0.783
   .AtttdTwrdsOP19    1.142    0.100   11.452    0.000    1.142    0.706
   .AtttdTwrdsOP20    1.602    0.132   12.131    0.000    1.602    0.690
   .AtttdTwrdsObP2    1.045    0.090   11.625    0.000    1.045    0.668
   .AtttdTwrdsObP3    1.614    0.113   14.257    0.000    1.614    0.952
   .AtttdTwrdsObP4    1.671    0.173    9.687    0.000    1.671    0.733
   .AtttdTwrdsObP5    1.229    0.104   11.867    0.000    1.229    0.575
   .AtttdTwrdsObP6    1.391    0.143    9.705    0.000    1.391    0.599
   .AtttdTwrdsObP7    1.317    0.115   11.479    0.000    1.317    0.850
   .AtttdTwrdsObP8    1.597    0.135   11.839    0.000    1.597    0.931
   .AtttdTwrdsObP9    1.304    0.147    8.879    0.000    1.304    0.756
    AttTowObPe        0.445    0.141    3.156    0.002    1.000    1.000



CFA first 6 Modification Indices: 
                              lhs op                           rhs     mi   epc
166  AttitudeTowardsObesePeople17 ~~  AttitudeTowardsObesePeople18 70.741 0.744
125  AttitudeTowardsObesePeople13 ~~   AttitudeTowardsObesePeople8 64.390 0.728
231   AttitudeTowardsObesePeople8 ~~   AttitudeTowardsObesePeople9 48.891 0.549
58    AttitudeTowardsObesePeople1 ~~   AttitudeTowardsObesePeople7 47.464 0.508
82  AttitudeTowardsObesePeople11r ~~ AttitudeTowardsObesePeople15r 40.876 0.553
175  AttitudeTowardsObesePeople17 ~~   AttitudeTowardsObesePeople8 34.677 0.491
    sepc.lv sepc.all sepc.nox
166   0.744    0.457    0.457
125   0.728    0.424    0.424
231   0.549    0.380    0.380
58    0.508    0.379    0.379
82    0.553    0.342    0.342
175   0.491    0.314    0.314

Perceived Causes of Obesity Questionnaires

regEx <- "^PerceivedCausesofObesity"
nameVariable <- "PerCaOb"

sum(str_detect(string = colnames(dat), pattern = regEx))
[1] 14
tmp_dat <- na.omit(dat[,str_detect(string = colnames(dat), pattern = regEx)])


tmp <- CFAstats(dataset = tmp_dat, regularExp = regEx, labelLatent = str_remove(string = nameVariable, pattern = "mean_"), 
                showPlots = TRUE, 
                computeEFA = TRUE, 
                computeCFA = TRUE, 
                computeCFAMplus = FALSE)



descriptive statistics: 
                            Mean   SD Median CoeffofVariation Minimum Maximun
PerceivedCausesofObesity-1  4.19 0.92      4             0.22       1       5
PerceivedCausesofObesity-10 3.45 1.02      3             0.30       1       5
PerceivedCausesofObesity-11 3.20 1.08      3             0.34       1       5
PerceivedCausesofObesity-12 3.08 1.25      3             0.41       1       5
PerceivedCausesofObesity-13 3.32 1.22      3             0.37       1       5
PerceivedCausesofObesity-14 4.01 1.01      4             0.25       1       5
PerceivedCausesofObesity-2  4.20 0.95      4             0.23       1       5
PerceivedCausesofObesity-3  3.83 1.15      4             0.30       1       5
PerceivedCausesofObesity-4  3.52 1.08      4             0.31       1       5
PerceivedCausesofObesity-5  3.90 1.07      4             0.27       1       5
PerceivedCausesofObesity-6  3.80 1.00      4             0.26       1       5
PerceivedCausesofObesity-7  3.28 1.03      3             0.31       1       5
PerceivedCausesofObesity-8  2.61 1.13      2             0.43       1       5
PerceivedCausesofObesity-9  3.69 1.04      4             0.28       1       5
                            Lower Quantile Upper Quantile Skewness Kurtosis(-3)
PerceivedCausesofObesity-1               1              5    -1.16         1.10
PerceivedCausesofObesity-10              1              5    -0.26        -0.43
PerceivedCausesofObesity-11              1              5    -0.05        -0.58
PerceivedCausesofObesity-12              1              5    -0.05        -1.05
PerceivedCausesofObesity-13              1              5    -0.35        -0.79
PerceivedCausesofObesity-14              1              5    -0.94         0.37
PerceivedCausesofObesity-2               1              5    -1.26         1.29
PerceivedCausesofObesity-3               1              5    -0.96         0.17
PerceivedCausesofObesity-4               1              5    -0.21        -0.85
PerceivedCausesofObesity-5               1              5    -0.82        -0.06
PerceivedCausesofObesity-6               1              5    -0.54        -0.27
PerceivedCausesofObesity-7               1              5    -0.21        -0.49
PerceivedCausesofObesity-8               1              5     0.40        -0.60
PerceivedCausesofObesity-9               1              5    -0.54        -0.29
                            KS-Test
PerceivedCausesofObesity-1        0
PerceivedCausesofObesity-10       0
PerceivedCausesofObesity-11       0
PerceivedCausesofObesity-12       0
PerceivedCausesofObesity-13       0
PerceivedCausesofObesity-14       0
PerceivedCausesofObesity-2        0
PerceivedCausesofObesity-3        0
PerceivedCausesofObesity-4        0
PerceivedCausesofObesity-5        0
PerceivedCausesofObesity-6        0
PerceivedCausesofObesity-7        0
PerceivedCausesofObesity-8        0
PerceivedCausesofObesity-9        0


variables under investigation:  PerceivedCausesofObesity1 PerceivedCausesofObesity10 PerceivedCausesofObesity11 PerceivedCausesofObesity12 PerceivedCausesofObesity13 PerceivedCausesofObesity14 PerceivedCausesofObesity2 PerceivedCausesofObesity3 PerceivedCausesofObesity4 PerceivedCausesofObesity5 PerceivedCausesofObesity6 PerceivedCausesofObesity7 PerceivedCausesofObesity8 PerceivedCausesofObesity9 

Cronbachs Alpha: 0.83 

Parallel analysis suggests that the number of factors =  3  and the number of components =  3 
PerCaOb 
Number of components:  3 



EFA factor loadings (1 factor solution): 

Loadings:
                           MR1  
PerceivedCausesofObesity1  0.618
PerceivedCausesofObesity10 0.567
PerceivedCausesofObesity11 0.648
PerceivedCausesofObesity12 0.325
PerceivedCausesofObesity13 0.487
PerceivedCausesofObesity14 0.652
PerceivedCausesofObesity2  0.654
PerceivedCausesofObesity3  0.521
PerceivedCausesofObesity4  0.476
PerceivedCausesofObesity5  0.698
PerceivedCausesofObesity6  0.685
PerceivedCausesofObesity7  0.460
PerceivedCausesofObesity8  0.278
PerceivedCausesofObesity9  0.481

                 MR1
SS loadings    4.293
Proportion Var 0.307
CFA summary and fit statistics: 
lavaan 0.6-19 ended normally after 32 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                        28

  Number of observations                           363

Model Test User Model:
                                              Standard      Scaled
  Test Statistic                               409.044     356.998
  Degrees of freedom                                77          77
  P-value (Chi-square)                           0.000       0.000
  Scaling correction factor                                  1.146
    Yuan-Bentler correction (Mplus variant)                       

Model Test Baseline Model:

  Test statistic                              1361.134    1149.916
  Degrees of freedom                                91          91
  P-value                                        0.000       0.000
  Scaling correction factor                                  1.184

User Model versus Baseline Model:

  Comparative Fit Index (CFI)                    0.739       0.736
  Tucker-Lewis Index (TLI)                       0.691       0.688
                                                                  
  Robust Comparative Fit Index (CFI)                         0.744
  Robust Tucker-Lewis Index (TLI)                            0.698

Loglikelihood and Information Criteria:

  Loglikelihood user model (H0)              -7044.793   -7044.793
  Scaling correction factor                                  1.152
      for the MLR correction                                      
  Loglikelihood unrestricted model (H1)      -6840.271   -6840.271
  Scaling correction factor                                  1.147
      for the MLR correction                                      
                                                                  
  Akaike (AIC)                               14145.585   14145.585
  Bayesian (BIC)                             14254.628   14254.628
  Sample-size adjusted Bayesian (SABIC)      14165.797   14165.797

Root Mean Square Error of Approximation:

  RMSEA                                          0.109       0.100
  90 Percent confidence interval - lower         0.099       0.090
  90 Percent confidence interval - upper         0.120       0.110
  P-value H_0: RMSEA <= 0.050                    0.000       0.000
  P-value H_0: RMSEA >= 0.080                    1.000       1.000
                                                                  
  Robust RMSEA                                               0.107
  90 Percent confidence interval - lower                     0.096
  90 Percent confidence interval - upper                     0.118
  P-value H_0: Robust RMSEA <= 0.050                         0.000
  P-value H_0: Robust RMSEA >= 0.080                         1.000

Standardized Root Mean Square Residual:

  SRMR                                           0.086       0.086

Parameter Estimates:

  Standard errors                             Sandwich
  Information bread                           Observed
  Observed information based on                Hessian

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  PerCaOb =~                                                            
    PrcvdCssfObst1    1.000                               0.535    0.582
    PrcvdCssfObs10    1.028    0.218    4.720    0.000    0.550    0.541
    PrcvdCssfObs11    1.230    0.222    5.534    0.000    0.658    0.612
    PrcvdCssfObs12    0.694    0.189    3.670    0.000    0.371    0.297
    PrcvdCssfObs13    1.051    0.168    6.249    0.000    0.563    0.462
    PrcvdCssfObs14    1.142    0.138    8.279    0.000    0.611    0.609
    PrcvdCssfObst2    1.084    0.114    9.476    0.000    0.580    0.610
    PrcvdCssfObst3    0.997    0.117    8.491    0.000    0.533    0.465
    PrcvdCssfObst4    0.888    0.236    3.763    0.000    0.475    0.441
    PrcvdCssfObst5    1.288    0.169    7.632    0.000    0.689    0.644
    PrcvdCssfObst6    1.195    0.172    6.954    0.000    0.640    0.640
    PrcvdCssfObst7    0.810    0.176    4.592    0.000    0.433    0.421
    PrcvdCssfObst8    0.499    0.159    3.144    0.002    0.267    0.237
    PrcvdCssfObst9    0.895    0.095    9.411    0.000    0.479    0.460

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .PrcvdCssfObst1    0.560    0.058    9.731    0.000    0.560    0.662
   .PrcvdCssfObs10    0.733    0.072   10.192    0.000    0.733    0.708
   .PrcvdCssfObs11    0.725    0.070   10.284    0.000    0.725    0.626
   .PrcvdCssfObs12    1.429    0.085   16.791    0.000    1.429    0.912
   .PrcvdCssfObs13    1.169    0.089   13.132    0.000    1.169    0.787
   .PrcvdCssfObs14    0.635    0.065    9.741    0.000    0.635    0.629
   .PrcvdCssfObst2    0.569    0.065    8.718    0.000    0.569    0.628
   .PrcvdCssfObst3    1.031    0.104    9.879    0.000    1.031    0.784
   .PrcvdCssfObst4    0.933    0.079   11.776    0.000    0.933    0.805
   .PrcvdCssfObst5    0.669    0.072    9.259    0.000    0.669    0.585
   .PrcvdCssfObst6    0.591    0.054   10.930    0.000    0.591    0.591
   .PrcvdCssfObst7    0.871    0.067   12.938    0.000    0.871    0.823
   .PrcvdCssfObst8    1.203    0.074   16.359    0.000    1.203    0.944
   .PrcvdCssfObst9    0.856    0.076   11.340    0.000    0.856    0.789
    PerCaOb           0.286    0.080    3.586    0.000    1.000    1.000



CFA first 6 Modification Indices: 
                           lhs op                        rhs     mi    epc
49  PerceivedCausesofObesity10 ~~  PerceivedCausesofObesity4 68.894  0.385
43  PerceivedCausesofObesity10 ~~ PerceivedCausesofObesity11 45.571  0.289
110  PerceivedCausesofObesity4 ~~  PerceivedCausesofObesity9 34.651 -0.291
60  PerceivedCausesofObesity11 ~~  PerceivedCausesofObesity4 29.961  0.258
35   PerceivedCausesofObesity1 ~~  PerceivedCausesofObesity2 25.994  0.171
66  PerceivedCausesofObesity12 ~~ PerceivedCausesofObesity13 21.731  0.328
    sepc.lv sepc.all sepc.nox
49    0.385    0.466    0.466
43    0.289    0.396    0.396
110  -0.291   -0.325   -0.325
60    0.258    0.314    0.314
35    0.171    0.303    0.303
66    0.328    0.253    0.253

Item Response Theory for “Attitude Towards Obese People Scale”

Factor Loadings (F1) indicate how strongly each item is associated with the latent trait, rule of thumb:

  • 0.70 = strong
  • 0.40–0.69 = moderate
  • < 0.40 = weak

Communality (h²) is the proportion of variance in each item explained by the factor, rule of thumb: + h² > 0.40 → item is well represented + h² < 0.30 → potentially problematic item

# regular expression
regEx <- "^AttitudeTowardsObesePeople"

# Filter variables matching the pattern
irt_items <- dat[, str_detect(colnames(dat), pattern = regEx)]

# Drop rows with missing data (mirt requires complete cases)
irt_items <- na.omit(irt_items)

# Ensure all items are treated as ordered factors
irt_items[] <- lapply(irt_items, function(x) as.numeric(as.character(x)))
# Fit Graded Response Model (1-factor)
mod_grm_1f <- mirt(data = irt_items, model = 1, itemtype = "graded", verbose = FALSE)

# Summarize model
summary(mod_grm_1f)
                                  F1     h2
AttitudeTowardsObesePeople-1   0.573 0.3287
AttitudeTowardsObesePeople-10r 0.595 0.3545
AttitudeTowardsObesePeople-11r 0.246 0.0604
AttitudeTowardsObesePeople-12r 0.475 0.2260
AttitudeTowardsObesePeople-13  0.196 0.0383
AttitudeTowardsObesePeople-14r 0.472 0.2223
AttitudeTowardsObesePeople-15r 0.451 0.2034
AttitudeTowardsObesePeople-16r 0.566 0.3209
AttitudeTowardsObesePeople-17  0.423 0.1790
AttitudeTowardsObesePeople-18  0.564 0.3177
AttitudeTowardsObesePeople-19r 0.592 0.3503
AttitudeTowardsObesePeople-20r 0.623 0.3877
AttitudeTowardsObesePeople-2r  0.642 0.4119
AttitudeTowardsObesePeople-3r  0.294 0.0862
AttitudeTowardsObesePeople-4r  0.582 0.3391
AttitudeTowardsObesePeople-5r  0.697 0.4864
AttitudeTowardsObesePeople-6r  0.685 0.4693
AttitudeTowardsObesePeople-7   0.449 0.2017
AttitudeTowardsObesePeople-8   0.351 0.1230
AttitudeTowardsObesePeople-9   0.587 0.3450

SS loadings:  5.451 
Proportion Var:  0.273 

Factor correlations: 

   F1
F1  1
# Plot Item Characteristic Curves (ICCs) for all items
plot(mod_grm_1f, type = "trace", facet_items = TRUE, main = "Item Characteristic Curves")

# Plot Test Information Curve
plot(mod_grm_1f, type = "info", main = "Test Information Curve: Individualism–Communitarianism")

### compare results to:
cor.plot(r = cor(irt_items))

some items are uninformative (see ICCs)

Compare 1-Factor vs. 2-Factor Models vs. 3-Factor Models:

# mod_grm_2f <- mirt(data = irt_items, model = 2, itemtype = "graded", verbose = FALSE)
# mod_grm_3f <- mirt(data = irt_items, model = 2, itemtype = "graded", verbose = FALSE)
# anova(mod_grm_1f, mod_grm_2f, mod_grm_3f)
# summary(mod_grm_3f)

significant p-value (e.g., < .05) supports the X-factor model.

latent class analysis for factor scores

Remark: after scale purification (setting up final CFAs), we could rerun this analyses to get interpretable results

tmp_EFA_overall[[1]]$scores

# options(Mplus_command = "C:/Program Files/Mplus/Mplus.exe")
# getOption("Mplus_command")

## run LCA
setwd("outputs/LCA_factorScores")

if(runMplusLCA){
  ## add factor scores
  dat_with_scores <- cbind(
    dat,
    tmp_EFA_overall[[1]]$scores
  )

  LCA_dat <- dat_with_scores[, c("PROLIFIC_PID",
                                      str_subset(string = colnames(dat_with_scores), pattern = "^MR"))]
  tmp <- str_subset(string = colnames(LCA_dat), pattern = "^MR")
  # tmp <- str_remove_all(string = tmp, pattern = "^A_")
  # cat(tmp)
  # cat(paste0(tmp, "(", 1:length(tmp), ")"))

  colnames(LCA_dat) <- c("ID", tmp)

  # prepareMplusData(df = LCA_dat, filename = "LCA_dat.dat")


  l = 1
  list_lca <- list()
  for(i in 2:LCArunsDef){
    print(i)

    numClasses <- i

    LCA_mplus  <- mplusObject(

      TITLE = paste0("Latent Class Analysis Factor Scores", " c=", numClasses),

      VARIABLE =paste0("
  usevariables = MR1 MR3 MR8 MR2 MR6 MR5 MR7 MR4;

  classes      = c(", numClasses, ")"),

  ANALYSIS =
    "
    Type=mixture; ! LCA analysis
    STARTS= 500 100;
    !LRTstarts=0 0 300 20;
  ",

  PLOT =
    "
    type = plot3;
    series is MR1(1) MR3(2) MR8(3) MR2(4) MR6(5) MR5(6) MR7(7) MR4(8);
  ",

  SAVEDATA = paste0("file = lca_", numClasses, ".txt ;
    save = cprob;
    format = free;
  "),

  OUTPUT = "tech11 tech14;", rdata = LCA_dat)

  list_lca[[l]] <- mplusModeler(LCA_mplus,
                                modelout = paste0("lca_FCs", numClasses, ".inp"),
                                run = 1L)

    l = l + 1
  }

  # comment out to avoid overwriting LCA outputs
  saveRDS(list_lca, file="list_lca.rds")

}else{
  list_lca <- readRDS("list_lca.rds" )
}

get fit statistics LCA:

getLCAfitstatistics(listMplusOutput = list_lca)

  Classes        LL      AIC      BIC    SABIC     CAIC BLRTp VLMRLRTp Entropy
1       2 -3740.371 7530.742 7628.102 7548.788 7653.102     0   0.0000   0.719
2       3 -3673.231 7414.463 7546.872 7439.005 7580.872     0   0.0177   0.812
3       4 -3630.904 7347.809 7515.268 7378.848 7558.267     0   0.4933   0.757
4       5 -3584.367 7272.733 7475.242 7310.269 7527.243     0   0.1766   0.802
5       6 -3553.187 7228.374 7465.933 7272.406 7526.933     0   0.1083   0.832

get profile plot:

### number of classes
num_classes <- 5 # index - 1

# Step 1: Extract means
params <- list_lca[[num_classes]]$results$parameters$unstandardized

means_df <- params %>%
  filter(paramHeader == "Means" & !grepl("^C#\\d$", param))

# Step 2: Get class proportions
class_counts <- table(list_lca[[num_classes]]$results$savedata$C)
total_n <- sum(class_counts)
class_props <- round(100 * class_counts / total_n, 1)

# Create descriptive labels
class_labels <- paste0("Class ", names(class_counts), " (", class_props, "%)")

# Map class numbers to labels
class_label_map <- setNames(class_labels, paste0("Class ", names(class_counts)))

# Step 3: Prepare data for plotting
means_long <- means_df %>%
  mutate(Indicator = param,
         Class = paste0("Class ", LatentClass)) %>%
  select(Indicator, Class, est) %>%
  pivot_wider(names_from = Class, values_from = est) %>%
  pivot_longer(cols = starts_with("Class"), names_to = "Class", values_to = "Mean")

# Apply the new labels
means_long$Class <- class_label_map[means_long$Class]

# Optional: Set indicator order
means_long$Indicator <- factor(means_long$Indicator)

# Step 4: Plot
ggplot(means_long, aes(x = Indicator, y = Mean, group = Class, color = Class)) +
  geom_line(size = 1) +
  geom_point(size = 2) +
  theme_minimal() +
  labs(title = "Latent Class Profile Plot",
       x = "Items",
       y = "Estimated Means") +
  theme(text = element_text(size = 14),
        axis.text.x = element_text(angle = 45, hjust = 1),
        legend.title = element_blank())
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.

class_counts

  1   2   3   4   5   6 
 17  24 139 104  43  36 

References

Peng, Roger D., and Elizabeth Matsui. 2016. The Art of Data Science: A Guide for Anyone Who Works with Data. Lulu.com. https://bookdown.org/rdpeng/artofdatascience/.
Wickham, Hadley, and Garrett Grolemund. 2017. R for Data Science: Import, Tidy, Transform, Visualize, and Model Data. "O’Reilly Media, Inc.". https://r4ds.had.co.nz/.
Xie, Yihui, J. J. Allaire, and Garrett Grolemund. 2018. R Markdown: The Definitive Guide. New York: Chapman; Hall/CRC. https://doi.org/10.1201/9781138359444.