Hypothesis 1

A zero-sum mindset (generalized zero-sum belief) is psychologically distinct from economic-domain zero-sum beliefs.

Analysis Strategy

Across the datasets, we adopted a two-fold approach to test our prediction that general zero-sum beliefs are psychologically distinct from economic zero-sum beliefs (Hypothesis 1): First, we ran confirmatory factor analyses comparing a unidimensional solution to a two-factor solution where generalized belief items are assigned to one factor and the economic items to a second factor. Second, we conducted paired samples t-tests to compare mean levels of agreement with the different types of beliefs.

Loading Libraries

library(here)
library(tidyverse)
library(readr)
library(lavaan)
library(psych)
library(ggplot2)


here()
## [1] "/Users/patricia/Desktop/JPJP R&R 2 /The_Zero-Sum_Mindset"

Factor Analysis (US) - Sample 1a (pre-registered)

Loading Dataset

s1 <- read_csv(here("data", "s1a.csv"))

Creating dataframe with items

zs_df <- select(s1, zsm_1, zsm_2, zsm_3, zsm_4, zsm_5, zs_econ_1 , zs_econ_2 , zs_econ_3) 

Examining Data Fitness for Factor Analysis

Kaiser-Meyer Test – “The test measures sampling adequacy for each variable in the model and the complete model. The statistic is a measure of the proportion of variance among variables that might be common variance. The higher the proportion, the higher the KMO-value, the more suited the data is to factor analysis”

Values above .60 considered adequate, above .9 considered “marvelous” :)

psych::KMO(zs_df) 
## Kaiser-Meyer-Olkin factor adequacy
## Call: psych::KMO(r = zs_df)
## Overall MSA =  0.87
## MSA for each item = 
##     zsm_1     zsm_2     zsm_3     zsm_4     zsm_5 zs_econ_1 zs_econ_2 zs_econ_3 
##      0.90      0.87      0.94      0.91      0.87      0.88      0.78      0.80

Scree Plot

A scree plot is a visualization of the analysis performed to evaluate how many factors or dimensions best account for the data – the rule of thumb here is to look for the “elbow” – essentially where you are no longer gaining much in explanatory strength with an additional dimension or where eigenvalues fall below a certain threshold

ncol(zs_df)
## [1] 8
fafitfree <- fa(zs_df,nfactors = ncol(zs_df), rotate = "none")
n_factors <- length(fafitfree$e.values)
scree     <- data.frame(
  Factor_n =  as.factor(1:n_factors), 
  Eigenvalue = fafitfree$e.values)
ggplot(scree, aes(x = Factor_n, y = Eigenvalue, group = 1)) + 
  geom_point() + geom_line() +
  xlab("Number of factors") +
  ylab("Initial eigenvalue") +
  labs( title = "Scree Plot", 
        subtitle = "(Based on the unreduced correlation matrix)")

Parellel Analysis

parallel <- fa.parallel(zs_df)

## Parallel analysis suggests that the number of factors =  2  and the number of components =  2

Parallel analysis suggests 2 factors and two components

Descriptive Statistics

zs_df_clean <- filter(zs_df, complete.cases(zs_df))


# Calculate means and standard deviations
means <- colMeans(zs_df_clean)
std_deviations <- apply(zs_df_clean, 2, sd)

# Create a data frame with the results
summary_table <- data.frame(Column = colnames(zs_df_clean),
                            Mean = means,
                            StandardDeviation = std_deviations)

# Print the summary table
print(summary_table)
##              Column     Mean StandardDeviation
## zsm_1         zsm_1 3.074300          1.629180
## zsm_2         zsm_2 3.153471          1.655244
## zsm_3         zsm_3 3.467722          1.503003
## zsm_4         zsm_4 2.724726          1.600224
## zsm_5         zsm_5 2.840438          1.607186
## zs_econ_1 zs_econ_1 4.909866          1.601573
## zs_econ_2 zs_econ_2 4.043849          1.626916
## zs_econ_3 zs_econ_3 4.009744          1.669644

Factor Analysis

Now we examine the item loadings

# Fitting data to 2 factors


factanal.2 <- factanal(zs_df_clean, factors=2, scores = c("regression"), rotation = "promax")
print(factanal.2, cutoff=0.2)
## 
## Call:
## factanal(x = zs_df_clean, factors = 2, scores = c("regression"),     rotation = "promax")
## 
## Uniquenesses:
##     zsm_1     zsm_2     zsm_3     zsm_4     zsm_5 zs_econ_1 zs_econ_2 zs_econ_3 
##     0.274     0.207     0.595     0.457     0.195     0.566     0.129     0.302 
## 
## Loadings:
##           Factor1 Factor2
## zsm_1      0.819         
## zsm_2      0.874         
## zsm_3      0.646         
## zsm_4      0.732         
## zsm_5      0.923         
## zs_econ_1          0.667 
## zs_econ_2          0.934 
## zs_econ_3          0.816 
## 
##                Factor1 Factor2
## SS loadings      3.241   1.990
## Proportion Var   0.405   0.249
## Cumulative Var   0.405   0.654
## 
## Factor Correlations:
##         Factor1 Factor2
## Factor1   1.000   0.525
## Factor2   0.525   1.000
## 
## Test of the hypothesis that 2 factors are sufficient.
## The chi square statistic is 71.12 on 13 degrees of freedom.
## The p-value is 4.99e-10
factanal.2b <- factanal(zs_df_clean, factors=2, scores = c("regression"), rotation = "promax")
print(factanal.2b, cutoff=0)
## 
## Call:
## factanal(x = zs_df_clean, factors = 2, scores = c("regression"),     rotation = "promax")
## 
## Uniquenesses:
##     zsm_1     zsm_2     zsm_3     zsm_4     zsm_5 zs_econ_1 zs_econ_2 zs_econ_3 
##     0.274     0.207     0.595     0.457     0.195     0.566     0.129     0.302 
## 
## Loadings:
##           Factor1 Factor2
## zsm_1      0.819   0.059 
## zsm_2      0.874   0.031 
## zsm_3      0.646  -0.019 
## zsm_4      0.732   0.011 
## zsm_5      0.923  -0.051 
## zs_econ_1 -0.016   0.667 
## zs_econ_2 -0.001   0.934 
## zs_econ_3  0.037   0.816 
## 
##                Factor1 Factor2
## SS loadings      3.241   1.990
## Proportion Var   0.405   0.249
## Cumulative Var   0.405   0.654
## 
## Factor Correlations:
##         Factor1 Factor2
## Factor1   1.000   0.525
## Factor2   0.525   1.000
## 
## Test of the hypothesis that 2 factors are sufficient.
## The chi square statistic is 71.12 on 13 degrees of freedom.
## The p-value is 4.99e-10
factanal.1 <- factanal(zs_df_clean, factors=1, scores = c("regression"), rotation = "promax")
print(factanal.1, cutoff=0.2)
## 
## Call:
## factanal(x = zs_df_clean, factors = 1, scores = c("regression"),     rotation = "promax")
## 
## Uniquenesses:
##     zsm_1     zsm_2     zsm_3     zsm_4     zsm_5 zs_econ_1 zs_econ_2 zs_econ_3 
##     0.267     0.204     0.602     0.466     0.231     0.849     0.703     0.730 
## 
## Loadings:
##           Factor1
## zsm_1     0.856  
## zsm_2     0.892  
## zsm_3     0.631  
## zsm_4     0.731  
## zsm_5     0.877  
## zs_econ_1 0.389  
## zs_econ_2 0.545  
## zs_econ_3 0.520  
## 
##                Factor1
## SS loadings      3.948
## Proportion Var   0.494
## 
## Test of the hypothesis that 1 factor is sufficient.
## The chi square statistic is 932.16 on 20 degrees of freedom.
## The p-value is 1.12e-184

CFA for Zero-Sum Mindset and Economic Zero-Sum Beliefs

Unidimensional CFA

zero.sum.cfa.model.1<-' zero.sum.mindset.latent.variable =~ zsm_1 + zsm_2 + zsm_3 + zsm_4 + zsm_5 + zs_econ_1 + zs_econ_2 + zs_econ_3 '

fit.1<-cfa(zero.sum.cfa.model.1, data = zs_df_clean)

summary(fit.1, fit.measures=TRUE)
## lavaan 0.6.17 ended normally after 28 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        16
## 
##   Number of observations                           821
## 
## Model Test User Model:
##                                                       
##   Test statistic                               938.067
##   Degrees of freedom                                20
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              4103.815
##   Degrees of freedom                                28
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.775
##   Tucker-Lewis Index (TLI)                       0.685
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -10864.336
##   Loglikelihood unrestricted model (H1)     -10395.302
##                                                       
##   Akaike (AIC)                               21760.671
##   Bayesian (BIC)                             21836.040
##   Sample-size adjusted Bayesian (SABIC)      21785.230
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.236
##   90 Percent confidence interval - lower         0.224
##   90 Percent confidence interval - upper         0.249
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    1.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.126
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                                       Estimate  Std.Err  z-value  P(>|z|)
##   zero.sum.mindset.latent.variable =~                                    
##     zsm_1                                1.000                           
##     zsm_2                                1.059    0.031   33.754    0.000
##     zsm_3                                0.680    0.034   19.963    0.000
##     zsm_4                                0.838    0.034   24.487    0.000
##     zsm_5                                1.010    0.031   32.773    0.000
##     zs_econ_1                            0.447    0.040   11.268    0.000
##     zs_econ_2                            0.635    0.038   16.593    0.000
##     zs_econ_3                            0.622    0.040   15.673    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .zsm_1             0.708    0.045   15.726    0.000
##    .zsm_2             0.558    0.040   13.786    0.000
##    .zsm_3             1.359    0.071   19.202    0.000
##    .zsm_4             1.191    0.065   18.410    0.000
##    .zsm_5             0.597    0.040   14.746    0.000
##    .zs_econ_1         2.174    0.109   19.977    0.000
##    .zs_econ_2         1.859    0.095   19.587    0.000
##    .zs_econ_3         2.033    0.103   19.670    0.000
##     zr.sm.mndst.l.    1.943    0.129   15.036    0.000

Two Dimension CFA

zero.sum.cfa.model.2 <-' zero.sum.mindset.latent.variable =~ zsm_1 + zsm_2 + zsm_3 + zsm_4 + zsm_5
econ.latent.variable =~ zs_econ_1 + zs_econ_2 + zs_econ_3 '


fit.2 <-cfa(zero.sum.cfa.model.2, data = zs_df_clean)



zero.sum.cfa.model.2 <-' zero.sum.mindset.latent.variable =~ zsm_1 + zsm_2 + zsm_3 + zsm_4 + zsm_5
econ.latent.variable =~ zs_econ_1 + zs_econ_2 + zs_econ_3 '

summary(fit.2, fit.measures=TRUE)
## lavaan 0.6.17 ended normally after 34 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        17
## 
##   Number of observations                           821
## 
## Model Test User Model:
##                                                       
##   Test statistic                                87.630
##   Degrees of freedom                                19
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              4103.815
##   Degrees of freedom                                28
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.983
##   Tucker-Lewis Index (TLI)                       0.975
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -10439.117
##   Loglikelihood unrestricted model (H1)     -10395.302
##                                                       
##   Akaike (AIC)                               20912.234
##   Bayesian (BIC)                             20992.313
##   Sample-size adjusted Bayesian (SABIC)      20938.327
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.066
##   90 Percent confidence interval - lower         0.053
##   90 Percent confidence interval - upper         0.081
##   P-value H_0: RMSEA <= 0.050                    0.026
##   P-value H_0: RMSEA >= 0.080                    0.059
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.024
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                                       Estimate  Std.Err  z-value  P(>|z|)
##   zero.sum.mindset.latent.variable =~                                    
##     zsm_1                                1.000                           
##     zsm_2                                1.063    0.031   33.849    0.000
##     zsm_3                                0.684    0.034   20.102    0.000
##     zsm_4                                0.843    0.034   24.620    0.000
##     zsm_5                                1.024    0.031   33.420    0.000
##   econ.latent.variable =~                                                
##     zs_econ_1                            1.000                           
##     zs_econ_2                            1.428    0.069   20.708    0.000
##     zs_econ_3                            1.332    0.065   20.406    0.000
## 
## Covariances:
##                                       Estimate  Std.Err  z-value  P(>|z|)
##   zero.sum.mindset.latent.variable ~~                                    
##     econ.ltnt.vrbl                       0.792    0.073   10.919    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .zsm_1             0.710    0.045   15.698    0.000
##    .zsm_2             0.544    0.040   13.474    0.000
##    .zsm_3             1.348    0.070   19.174    0.000
##    .zsm_4             1.179    0.064   18.360    0.000
##    .zsm_5             0.545    0.039   13.963    0.000
##    .zs_econ_1         1.450    0.079   18.400    0.000
##    .zs_econ_2         0.374    0.062    6.048    0.000
##    .zs_econ_3         0.811    0.066   12.364    0.000
##     zr.sm.mndst.l.    1.941    0.129   15.013    0.000
##     econ.ltnt.vrbl    1.112    0.109   10.171    0.000

Comparing Model Fit

anova_model <- anova(fit.1, fit.2) ## significantly better fit with two factors


print(anova_model)
## 
## Chi-Squared Difference Test
## 
##       Df   AIC   BIC  Chisq Chisq diff  RMSEA Df diff Pr(>Chisq)    
## fit.2 19 20912 20992  87.63                                         
## fit.1 20 21761 21836 938.07     850.44 1.0172       1  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Comparing Means

zsm_df <- select(zs_df_clean, zsm_1,zsm_2, zsm_3, zsm_4, zsm_5)
psych::alpha(zsm_df)
## 
## Reliability analysis   
## Call: psych::alpha(x = zsm_df)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean  sd median_r
##        0.9       0.9    0.89      0.64   9 0.0055  3.1 1.4     0.61
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.89   0.9  0.91
## Duhachek  0.89   0.9  0.91
## 
##  Reliability if an item is dropped:
##       raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r med.r
## zsm_1      0.87      0.87    0.85      0.63 6.8   0.0072 0.0092  0.59
## zsm_2      0.86      0.86    0.84      0.61 6.3   0.0078 0.0084  0.58
## zsm_3      0.91      0.91    0.89      0.71 9.6   0.0054 0.0073  0.72
## zsm_4      0.89      0.89    0.87      0.66 7.8   0.0064 0.0166  0.66
## zsm_5      0.86      0.86    0.84      0.60 6.1   0.0080 0.0098  0.58
## 
##  Item statistics 
##         n raw.r std.r r.cor r.drop mean  sd
## zsm_1 821  0.87  0.86  0.83   0.78  3.1 1.6
## zsm_2 821  0.89  0.89  0.87   0.82  3.2 1.7
## zsm_3 821  0.75  0.75  0.65   0.62  3.5 1.5
## zsm_4 821  0.82  0.82  0.75   0.71  2.7 1.6
## zsm_5 821  0.90  0.90  0.89   0.84  2.8 1.6
## 
## Non missing response frequency for each item
##          1    2    3    4    5    6    7 miss
## zsm_1 0.15 0.32 0.20 0.08 0.15 0.07 0.03    0
## zsm_2 0.15 0.29 0.21 0.08 0.16 0.07 0.03    0
## zsm_3 0.07 0.25 0.22 0.18 0.17 0.09 0.02    0
## zsm_4 0.23 0.34 0.19 0.06 0.11 0.05 0.03    0
## zsm_5 0.19 0.36 0.18 0.07 0.12 0.06 0.03    0
zs_df_clean$zsm_mean <- rowMeans(zsm_df)

zs_econ_df <- select(zs_df_clean, contains("ec"))
psych::alpha(zs_econ_df)
## 
## Reliability analysis   
## Call: psych::alpha(x = zs_econ_df)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean  sd median_r
##       0.85      0.85    0.81      0.65 5.5 0.0094  4.3 1.4     0.61
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.83  0.85  0.86
## Duhachek  0.83  0.85  0.87
## 
##  Reliability if an item is dropped:
##           raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## zs_econ_1      0.88      0.88    0.78      0.78 7.1   0.0087    NA  0.78
## zs_econ_2      0.71      0.71    0.55      0.55 2.4   0.0203    NA  0.55
## zs_econ_3      0.76      0.76    0.61      0.61 3.2   0.0167    NA  0.61
## 
##  Item statistics 
##             n raw.r std.r r.cor r.drop mean  sd
## zs_econ_1 821  0.82  0.82  0.66   0.62  4.9 1.6
## zs_econ_2 821  0.91  0.91  0.87   0.79  4.0 1.6
## zs_econ_3 821  0.89  0.89  0.82   0.74  4.0 1.7
## 
## Non missing response frequency for each item
##              1    2    3    4    5    6    7 miss
## zs_econ_1 0.03 0.09 0.09 0.10 0.31 0.24 0.16    0
## zs_econ_2 0.06 0.15 0.20 0.12 0.29 0.12 0.06    0
## zs_econ_3 0.06 0.18 0.17 0.13 0.26 0.14 0.06    0
zs_df_clean$zs_econ_mean <- rowMeans(zs_econ_df)

t.test(zs_df_clean$zsm_mean, zs_df_clean$zs_econ_mean, paired = T)
## 
##  Paired t-test
## 
## data:  zs_df_clean$zsm_mean and zs_df_clean$zs_econ_mean
## t = -25.437, df = 820, p-value < 2.2e-16
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
##  -1.366945 -1.171099
## sample estimates:
## mean difference 
##       -1.269022

Factor Analysis Replication (Italy) - Sample 7

s7 <- read_csv(here( "data","s7.csv"))

Creating dataframe with items

zs_it_df <- select(s7, zsm_1, zsm_2, zsm_3, zsm_4, zsm_5, zs_econ_1 , zs_econ_2 , zs_econ_3) 

Examining Data Fitness for Factor Analysis

Kaiser-Meyer Test – “The test measures sampling adequacy for each variable in the model and the complete model. The statistic is a measure of the proportion of variance among variables that might be common variance. The higher the proportion, the higher the KMO-value, the more suited the data is to factor analysis”

Values above .60 considered adequate, above .9 considered “marvelous” :)

psych::KMO(zs_it_df) 
## Kaiser-Meyer-Olkin factor adequacy
## Call: psych::KMO(r = zs_it_df)
## Overall MSA =  0.79
## MSA for each item = 
##     zsm_1     zsm_2     zsm_3     zsm_4     zsm_5 zs_econ_1 zs_econ_2 zs_econ_3 
##      0.78      0.77      0.83      0.88      0.86      0.74      0.77      0.74

Scree Plot

A scree plot is a visualization of the analysis performed to evaluate how many factors or dimensions best account for the data – the rule of thumb here is to look for the “elbow” – essentially where you are no longer gaining much in explanatory strength with an additional dimension or where eigenvalues fall below a certain threshold

ncol(zs_it_df)
## [1] 8
fafitfree <- fa(zs_it_df,nfactors = ncol(zs_it_df), rotate = "none")
n_factors <- length(fafitfree$e.values)
scree     <- data.frame(
  Factor_n =  as.factor(1:n_factors), 
  Eigenvalue = fafitfree$e.values)
ggplot(scree, aes(x = Factor_n, y = Eigenvalue, group = 1)) + 
  geom_point() + geom_line() +
  xlab("Number of factors") +
  ylab("Initial eigenvalue") +
  labs( title = "Scree Plot", 
        subtitle = "(Based on the unreduced correlation matrix)")

Parellel Analysis

parallel <- fa.parallel(zs_it_df)

## Parallel analysis suggests that the number of factors =  2  and the number of components =  2

Parallel analysis suggests 2 factors and two components

Factor Analysis

Now we examine the item loadings

zs_it_df_clean <- filter(zs_it_df, complete.cases(zs_it_df))

# Fitting data to 2 factors


factanal.2 <- factanal(zs_it_df_clean, factors=2, scores = c("regression"), rotation = "promax")
print(factanal.2, cutoff=0.2)
## 
## Call:
## factanal(x = zs_it_df_clean, factors = 2, scores = c("regression"),     rotation = "promax")
## 
## Uniquenesses:
##     zsm_1     zsm_2     zsm_3     zsm_4     zsm_5 zs_econ_1 zs_econ_2 zs_econ_3 
##     0.426     0.264     0.685     0.679     0.442     0.250     0.532     0.344 
## 
## Loadings:
##           Factor1 Factor2
## zsm_1      0.775         
## zsm_2      0.863         
## zsm_3      0.522         
## zsm_4      0.534         
## zsm_5      0.742         
## zs_econ_1          0.841 
## zs_econ_2          0.719 
## zs_econ_3          0.814 
## 
##                Factor1 Factor2
## SS loadings      2.475   1.906
## Proportion Var   0.309   0.238
## Cumulative Var   0.309   0.548
## 
## Factor Correlations:
##         Factor1 Factor2
## Factor1    1.00    0.35
## Factor2    0.35    1.00
## 
## Test of the hypothesis that 2 factors are sufficient.
## The chi square statistic is 35.8 on 13 degrees of freedom.
## The p-value is 0.000637
factanal.2b <- factanal(zs_it_df_clean, factors=2, scores = c("regression"), rotation = "promax")
print(factanal.2b, cutoff=0)
## 
## Call:
## factanal(x = zs_it_df_clean, factors = 2, scores = c("regression"),     rotation = "promax")
## 
## Uniquenesses:
##     zsm_1     zsm_2     zsm_3     zsm_4     zsm_5 zs_econ_1 zs_econ_2 zs_econ_3 
##     0.426     0.264     0.685     0.679     0.442     0.250     0.532     0.344 
## 
## Loadings:
##           Factor1 Factor2
## zsm_1      0.775  -0.057 
## zsm_2      0.863  -0.014 
## zsm_3      0.522   0.093 
## zsm_4      0.534   0.079 
## zsm_5      0.742   0.016 
## zs_econ_1  0.065   0.841 
## zs_econ_2 -0.134   0.719 
## zs_econ_3 -0.012   0.814 
## 
##                Factor1 Factor2
## SS loadings      2.475   1.906
## Proportion Var   0.309   0.238
## Cumulative Var   0.309   0.548
## 
## Factor Correlations:
##         Factor1 Factor2
## Factor1    1.00    0.35
## Factor2    0.35    1.00
## 
## Test of the hypothesis that 2 factors are sufficient.
## The chi square statistic is 35.8 on 13 degrees of freedom.
## The p-value is 0.000637
factanal.1 <- factanal(zs_it_df_clean, factors=1, scores = c("regression"), rotation = "promax")
print(factanal.1, cutoff=0.2)
## 
## Call:
## factanal(x = zs_it_df_clean, factors = 1, scores = c("regression"),     rotation = "promax")
## 
## Uniquenesses:
##     zsm_1     zsm_2     zsm_3     zsm_4     zsm_5 zs_econ_1 zs_econ_2 zs_econ_3 
##     0.462     0.296     0.676     0.671     0.439     0.821     0.962     0.878 
## 
## Loadings:
##           Factor1
## zsm_1     0.734  
## zsm_2     0.839  
## zsm_3     0.569  
## zsm_4     0.573  
## zsm_5     0.749  
## zs_econ_1 0.423  
## zs_econ_2        
## zs_econ_3 0.349  
## 
##                Factor1
## SS loadings      2.794
## Proportion Var   0.349
## 
## Test of the hypothesis that 1 factor is sufficient.
## The chi square statistic is 318.56 on 20 degrees of freedom.
## The p-value is 1.29e-55
library(knitr)

# Perform factor analysis
factanal.2b <- factanal(zs_it_df_clean, factors = 2, scores = "regression", rotation = "promax")

# Calculate means and standard deviations rounded to two decimal places
var_means <- round(colMeans(zs_it_df_clean), 2)
var_sds <- round(apply(zs_it_df_clean, 2, sd), 2)

# Create a combined table
combined_table <- data.frame(

  Variable_Means = var_means,
  Variable_Standard_Deviations = var_sds
)

# Assign factor analysis results to the table

loadings <- factanal.2b$loadings[1:8,]

combined_table <- bind_cols(combined_table,loadings)

combined_table <- round(combined_table, 2)

# Print the combined table using kable
kableExtra::kable(combined_table, format = "markdown")
Variable_Means Variable_Standard_Deviations Factor1 Factor2
zsm_1 1.86 1.42 0.78 -0.06
zsm_2 2.12 1.49 0.86 -0.01
zsm_3 2.70 1.67 0.52 0.09
zsm_4 2.42 1.79 0.53 0.08
zsm_5 1.77 1.43 0.74 0.02
zs_econ_1 3.77 1.95 0.06 0.84
zs_econ_2 5.07 1.75 -0.13 0.72
zs_econ_3 4.05 1.82 -0.01 0.81
# Calculate means and standard deviations
means <- colMeans(zs_it_df_clean)
std_deviations <- apply(zs_it_df_clean, 2, sd)

# Create a data frame with the results
summary_table <- data.frame(Column = colnames(zs_it_df_clean),
                            Mean = means,
                            StandardDeviation = std_deviations)

# Print the summary table
print(summary_table)
##              Column     Mean StandardDeviation
## zsm_1         zsm_1 1.862319          1.420330
## zsm_2         zsm_2 2.119565          1.488201
## zsm_3         zsm_3 2.699275          1.669012
## zsm_4         zsm_4 2.423913          1.790279
## zsm_5         zsm_5 1.768116          1.431032
## zs_econ_1 zs_econ_1 3.768116          1.949508
## zs_econ_2 zs_econ_2 5.068841          1.753637
## zs_econ_3 zs_econ_3 4.054348          1.819275
nrow(zs_it_df_clean)
## [1] 276

CFA for Zero-Sum Mindset and Economic Zero-Sum Beliefs

zero.sum.cfa.model.1<-' zero.sum.mindset.latent.variable =~ zsm_1 + zsm_2 + zsm_3 + zsm_4 + zsm_5 + zs_econ_1 + zs_econ_2 + zs_econ_3 '

zero.sum.cfa.model.2 <-' zero.sum.mindset.latent.variable =~ zsm_1 + zsm_2 + zsm_3 + zsm_4 + zsm_5
econ.latent.variable =~ zs_econ_1 + zs_econ_2 + zs_econ_3 '

fit.1<-cfa(zero.sum.cfa.model.1, data = zs_it_df_clean)
summary(fit.1, fit.measures=TRUE)
## lavaan 0.6.17 ended normally after 29 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        16
## 
##   Number of observations                           276
## 
## Model Test User Model:
##                                                       
##   Test statistic                               324.642
##   Degrees of freedom                                20
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                               875.606
##   Degrees of freedom                                28
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.641
##   Tucker-Lewis Index (TLI)                       0.497
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3965.576
##   Loglikelihood unrestricted model (H1)      -3803.255
##                                                       
##   Akaike (AIC)                                7963.153
##   Bayesian (BIC)                              8021.079
##   Sample-size adjusted Bayesian (SABIC)       7970.346
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.235
##   90 Percent confidence interval - lower         0.213
##   90 Percent confidence interval - upper         0.258
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    1.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.154
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                                       Estimate  Std.Err  z-value  P(>|z|)
##   zero.sum.mindset.latent.variable =~                                    
##     zsm_1                                1.000                           
##     zsm_2                                1.198    0.095   12.592    0.000
##     zsm_3                                0.911    0.104    8.795    0.000
##     zsm_4                                0.985    0.111    8.865    0.000
##     zsm_5                                1.028    0.089   11.522    0.000
##     zs_econ_1                            0.791    0.121    6.535    0.000
##     zs_econ_2                            0.330    0.109    3.026    0.002
##     zs_econ_3                            0.608    0.113    5.381    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .zsm_1             0.928    0.098    9.421    0.000
##    .zsm_2             0.654    0.093    7.053    0.000
##    .zsm_3             1.877    0.173   10.821    0.000
##    .zsm_4             2.143    0.198   10.799    0.000
##    .zsm_5             0.896    0.098    9.191    0.000
##    .zs_econ_1         3.109    0.274   11.330    0.000
##    .zs_econ_2         2.946    0.252   11.671    0.000
##    .zs_econ_3         2.897    0.252   11.483    0.000
##     zr.sm.mndst.l.    1.082    0.163    6.649    0.000
fit.2 <-cfa(zero.sum.cfa.model.2, data = zs_it_df_clean)
summary(fit.2, fit.measures=TRUE)
## lavaan 0.6.17 ended normally after 35 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        17
## 
##   Number of observations                           276
## 
## Model Test User Model:
##                                                       
##   Test statistic                                51.924
##   Degrees of freedom                                19
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                               875.606
##   Degrees of freedom                                28
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.961
##   Tucker-Lewis Index (TLI)                       0.943
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3829.217
##   Loglikelihood unrestricted model (H1)      -3803.255
##                                                       
##   Akaike (AIC)                                7692.434
##   Bayesian (BIC)                              7753.981
##   Sample-size adjusted Bayesian (SABIC)       7700.077
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.079
##   90 Percent confidence interval - lower         0.054
##   90 Percent confidence interval - upper         0.105
##   P-value H_0: RMSEA <= 0.050                    0.031
##   P-value H_0: RMSEA >= 0.080                    0.509
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.052
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                                       Estimate  Std.Err  z-value  P(>|z|)
##   zero.sum.mindset.latent.variable =~                                    
##     zsm_1                                1.000                           
##     zsm_2                                1.202    0.092   13.074    0.000
##     zsm_3                                0.883    0.100    8.813    0.000
##     zsm_4                                0.950    0.107    8.839    0.000
##     zsm_5                                1.007    0.085   11.789    0.000
##   econ.latent.variable =~                                                
##     zs_econ_1                            1.000                           
##     zs_econ_2                            0.667    0.063   10.651    0.000
##     zs_econ_3                            0.840    0.068   12.293    0.000
## 
## Covariances:
##                                       Estimate  Std.Err  z-value  P(>|z|)
##   zero.sum.mindset.latent.variable ~~                                    
##     econ.ltnt.vrbl                       0.663    0.140    4.735    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .zsm_1             0.886    0.096    9.230    0.000
##    .zsm_2             0.582    0.092    6.356    0.000
##    .zsm_3             1.899    0.175   10.877    0.000
##    .zsm_4             2.179    0.200   10.869    0.000
##    .zsm_5             0.900    0.097    9.234    0.000
##    .zs_econ_1         0.829    0.201    4.125    0.000
##    .zs_econ_2         1.749    0.173   10.112    0.000
##    .zs_econ_3         1.210    0.169    7.160    0.000
##     zr.sm.mndst.l.    1.124    0.165    6.829    0.000
##     econ.ltnt.vrbl    2.958    0.367    8.069    0.000
anova_model <- anova(fit.1, fit.2) ## significantly better fit with two factors


print(anova_model)
## 
## Chi-Squared Difference Test
## 
##       Df    AIC    BIC   Chisq Chisq diff   RMSEA Df diff Pr(>Chisq)    
## fit.2 19 7692.4 7754.0  51.924                                          
## fit.1 20 7963.2 8021.1 324.642     272.72 0.99221       1  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Comparing Means

zsm_df <- select(zs_it_df_clean, zsm_1,zsm_2, zsm_3, zsm_4, zsm_5)
psych::alpha(zsm_df)
## 
## Reliability analysis   
## Call: psych::alpha(x = zsm_df)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean  sd median_r
##       0.82      0.82    0.81      0.48 4.7 0.018  2.2 1.2     0.46
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.78  0.82  0.85
## Duhachek  0.78  0.82  0.85
## 
##  Reliability if an item is dropped:
##       raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r med.r
## zsm_1      0.78      0.78    0.74      0.48 3.6    0.022 0.0073  0.46
## zsm_2      0.74      0.75    0.70      0.43 3.0    0.025 0.0073  0.42
## zsm_3      0.81      0.82    0.79      0.53 4.5    0.019 0.0111  0.52
## zsm_4      0.81      0.81    0.79      0.52 4.3    0.020 0.0178  0.54
## zsm_5      0.76      0.77    0.75      0.45 3.3    0.024 0.0160  0.42
## 
##  Item statistics 
##         n raw.r std.r r.cor r.drop mean  sd
## zsm_1 276  0.76  0.77  0.72   0.62  1.9 1.4
## zsm_2 276  0.84  0.85  0.83   0.73  2.1 1.5
## zsm_3 276  0.70  0.69  0.57   0.51  2.7 1.7
## zsm_4 276  0.73  0.71  0.58   0.54  2.4 1.8
## zsm_5 276  0.80  0.81  0.75   0.68  1.8 1.4
## 
## Non missing response frequency for each item
##          1    2    3    4    5    6    7 miss
## zsm_1 0.62 0.18 0.05 0.08 0.03 0.03 0.01    0
## zsm_2 0.49 0.22 0.11 0.07 0.07 0.02 0.02    0
## zsm_3 0.31 0.24 0.17 0.10 0.09 0.06 0.02    0
## zsm_4 0.47 0.18 0.08 0.07 0.11 0.05 0.03    0
## zsm_5 0.66 0.17 0.05 0.04 0.03 0.02 0.03    0
zs_it_df_clean$zsm_mean <- rowMeans(zsm_df)

zs_econ_df <- select(zs_it_df_clean, contains("ec"))
psych::alpha(zs_econ_df)
## 
## Reliability analysis   
## Call: psych::alpha(x = zs_econ_df)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean  sd median_r
##       0.82      0.82    0.76      0.61 4.6 0.018  4.3 1.6     0.58
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.78  0.82  0.86
## Duhachek  0.79  0.82  0.86
## 
##  Reliability if an item is dropped:
##           raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## zs_econ_1      0.71      0.71    0.54      0.54 2.4    0.035    NA  0.54
## zs_econ_2      0.82      0.82    0.70      0.70 4.6    0.021    NA  0.70
## zs_econ_3      0.73      0.73    0.58      0.58 2.7    0.032    NA  0.58
## 
##  Item statistics 
##             n raw.r std.r r.cor r.drop mean  sd
## zs_econ_1 276  0.89  0.88  0.81   0.73  3.8 1.9
## zs_econ_2 276  0.81  0.82  0.66   0.61  5.1 1.8
## zs_econ_3 276  0.87  0.87  0.78   0.70  4.1 1.8
## 
## Non missing response frequency for each item
##              1    2    3    4    5    6    7 miss
## zs_econ_1 0.17 0.16 0.15 0.10 0.20 0.14 0.09    0
## zs_econ_2 0.05 0.07 0.10 0.07 0.21 0.26 0.24    0
## zs_econ_3 0.10 0.15 0.14 0.14 0.21 0.18 0.08    0
zs_it_df_clean$zs_econ_mean <- rowMeans(zs_econ_df)

t.test(zs_it_df_clean$zsm_mean, zs_it_df_clean$zs_econ_mean, paired = T)
## 
##  Paired t-test
## 
## data:  zs_it_df_clean$zsm_mean and zs_it_df_clean$zs_econ_mean
## t = -20.994, df = 275, p-value < 2.2e-16
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
##  -2.321494 -1.923434
## sample estimates:
## mean difference 
##       -2.122464

Multi-national Dataset

bzsg <- read_csv(here("data", "bzsg.csv"))

Subset

bz_df <- select(bzsg, zsm_1, zsm_2, zsm_3, zsm_4, zsm_5, zs_econ_1 , zs_econ_2 , zs_econ_3) 

Examining Data Fitness for Factor Analysis

Kaiser-Meyer Test – “The test measures sampling adequacy for each variable in the model and the complete model. The statistic is a measure of the proportion of variance among variables that might be common variance. The higher the proportion, the higher the KMO-value, the more suited the data is to factor analysis”

Values above .60 considered adequate, above .9 considered “marvelous” :)

psych::KMO(bz_df) 
## Kaiser-Meyer-Olkin factor adequacy
## Call: psych::KMO(r = bz_df)
## Overall MSA =  0.89
## MSA for each item = 
##     zsm_1     zsm_2     zsm_3     zsm_4     zsm_5 zs_econ_1 zs_econ_2 zs_econ_3 
##      0.92      0.88      0.93      0.89      0.91      0.86      0.87      0.92

Multilevel CFA – Grouped by Country

bz_df_clean <- filter(bz_df, complete.cases(bz_df))

bz_df_clean$Country <- bzsg$Country


bzsg_zsm_cfa_model_1 <- 
  ' bzsg_latent = ~ zsm_1 + zsm_2 + zsm_3 + zsm_4 + zsm_5 + zs_econ_1 + zs_econ_2 + zs_econ_3'

fit_1 <-cfa(bzsg_zsm_cfa_model_1, data = bz_df_clean, group = "Country")
fit_1_summary <- summary(fit_1, fit.measures=TRUE)



bzsg_zsm_cfa_model_2 <-
  ' zsm_variable = ~ zsm_1 + zsm_2 + zsm_3 + zsm_4 + zsm_5 
zs_econ_variable =~  zs_econ_1 + zs_econ_2 + zs_econ_3'

fit_2 <-cfa(bzsg_zsm_cfa_model_2, data = bz_df_clean, group = "Country")
fit_2_summary <- summary(fit_2, fit.measures=TRUE)


fit_1_summary$fit
##                  npar                  fmin                 chisq 
##              1032.000                 0.153              3478.208 
##                    df                pvalue        baseline.chisq 
##               860.000                 0.000             36653.619 
##           baseline.df       baseline.pvalue                   cfi 
##              1204.000                 0.000                 0.926 
##                   tli                  logl     unrestricted.logl 
##                 0.897           -154124.974           -152385.870 
##                   aic                   bic                ntotal 
##            310313.947            317887.339             11368.000 
##                  bic2                 rmsea        rmsea.ci.lower 
##            314607.769                 0.107                 0.104 
##        rmsea.ci.upper        rmsea.ci.level          rmsea.pvalue 
##                 0.111                 0.900                 0.000 
##        rmsea.close.h0 rmsea.notclose.pvalue     rmsea.notclose.h0 
##                 0.050                 1.000                 0.080 
##                  srmr 
##                 0.046
fit_2_summary$fit
##                  npar                  fmin                 chisq 
##              1075.000                 0.111              2525.322 
##                    df                pvalue        baseline.chisq 
##               817.000                 0.000             36653.619 
##           baseline.df       baseline.pvalue                   cfi 
##              1204.000                 0.000                 0.952 
##                   tli                  logl     unrestricted.logl 
##                 0.929           -153648.531           -152385.870 
##                   aic                   bic                ntotal 
##            309447.062            317336.011             11368.000 
##                  bic2                 rmsea        rmsea.ci.lower 
##            313919.792                 0.089                 0.085 
##        rmsea.ci.upper        rmsea.ci.level          rmsea.pvalue 
##                 0.093                 0.900                 0.000 
##        rmsea.close.h0 rmsea.notclose.pvalue     rmsea.notclose.h0 
##                 0.050                 1.000                 0.080 
##                  srmr 
##                 0.040
anova(fit_1, fit_2) ## significantly better fit with two factors
## 
## Chi-Squared Difference Test
## 
##        Df    AIC    BIC  Chisq Chisq diff   RMSEA Df diff Pr(>Chisq)    
## fit_2 817 309447 317336 2525.3                                          
## fit_1 860 310314 317887 3478.2     952.89 0.28291      43  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Comparing Country-Level Means

bzsg_country_means <- read_csv(here("data", "bzsg_country_level.csv" ))

CFA for Zero-Sum Mindset and Economic Zero-Sum Beliefs (no country-level grouping)

zero.sum.cfa.model.1<-' zero.sum.mindset.latent.variable =~ zsm_1 + zsm_2 + zsm_3 + zsm_4 + zsm_5 + zs_econ_1 + zs_econ_2 + zs_econ_3 '

zero.sum.cfa.model.2 <-' zero.sum.mindset.latent.variable =~ zsm_1 + zsm_2 + zsm_3 + zsm_4 + zsm_5
econ.latent.variable =~ zs_econ_1 + zs_econ_2 + zs_econ_3 '

fit.1<-cfa(zero.sum.cfa.model.1, data = bz_df_clean)
summary(fit.1, fit.measures=TRUE)
## lavaan 0.6.17 ended normally after 27 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        16
## 
##   Number of observations                         11368
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1660.973
##   Degrees of freedom                                20
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             32826.969
##   Degrees of freedom                                28
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.950
##   Tucker-Lewis Index (TLI)                       0.930
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)            -160345.201
##   Loglikelihood unrestricted model (H1)    -159514.714
##                                                       
##   Akaike (AIC)                              320722.401
##   Bayesian (BIC)                            320839.818
##   Sample-size adjusted Bayesian (SABIC)     320788.972
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.085
##   90 Percent confidence interval - lower         0.082
##   90 Percent confidence interval - upper         0.088
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    0.991
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.034
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                                       Estimate  Std.Err  z-value  P(>|z|)
##   zero.sum.mindset.latent.variable =~                                    
##     zsm_1                                1.000                           
##     zsm_2                                1.339    0.021   62.517    0.000
##     zsm_3                                0.572    0.016   36.521    0.000
##     zsm_4                                1.227    0.021   59.142    0.000
##     zsm_5                                0.737    0.017   42.189    0.000
##     zs_econ_1                            1.325    0.021   61.683    0.000
##     zs_econ_2                            1.275    0.021   61.791    0.000
##     zs_econ_3                            1.001    0.019   51.643    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .zsm_1             1.958    0.028   69.940    0.000
##    .zsm_2             1.093    0.019   57.626    0.000
##    .zsm_3             1.888    0.026   73.556    0.000
##    .zsm_4             1.407    0.022   63.862    0.000
##    .zsm_5             2.073    0.029   72.610    0.000
##    .zs_econ_1         1.205    0.020   59.624    0.000
##    .zs_econ_2         1.100    0.019   59.388    0.000
##    .zs_econ_3         1.875    0.027   69.683    0.000
##     zr.sm.mndst.l.    1.040    0.032   32.631    0.000
fit.2 <-cfa(zero.sum.cfa.model.2, data = bz_df_clean)
summary(fit.2, fit.measures=TRUE)
## lavaan 0.6.17 ended normally after 38 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        17
## 
##   Number of observations                         11368
## 
## Model Test User Model:
##                                                       
##   Test statistic                               995.189
##   Degrees of freedom                                19
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             32826.969
##   Degrees of freedom                                28
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.970
##   Tucker-Lewis Index (TLI)                       0.956
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)            -160012.309
##   Loglikelihood unrestricted model (H1)    -159514.714
##                                                       
##   Akaike (AIC)                              320058.617
##   Bayesian (BIC)                            320183.373
##   Sample-size adjusted Bayesian (SABIC)     320129.349
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.067
##   90 Percent confidence interval - lower         0.064
##   90 Percent confidence interval - upper         0.071
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.027
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                                       Estimate  Std.Err  z-value  P(>|z|)
##   zero.sum.mindset.latent.variable =~                                    
##     zsm_1                                1.000                           
##     zsm_2                                1.342    0.021   63.732    0.000
##     zsm_3                                0.577    0.015   37.446    0.000
##     zsm_4                                1.242    0.020   60.892    0.000
##     zsm_5                                0.733    0.017   42.824    0.000
##   econ.latent.variable =~                                                
##     zs_econ_1                            1.000                           
##     zs_econ_2                            0.969    0.011   87.704    0.000
##     zs_econ_3                            0.740    0.012   63.966    0.000
## 
## Covariances:
##                                       Estimate  Std.Err  z-value  P(>|z|)
##   zero.sum.mindset.latent.variable ~~                                    
##     econ.ltnt.vrbl                       1.312    0.028   46.952    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .zsm_1             1.906    0.028   68.321    0.000
##    .zsm_2             0.991    0.020   49.980    0.000
##    .zsm_3             1.865    0.026   73.019    0.000
##    .zsm_4             1.290    0.022   58.841    0.000
##    .zsm_5             2.050    0.029   71.890    0.000
##    .zs_econ_1         1.062    0.021   51.522    0.000
##    .zs_econ_2         0.943    0.019   50.135    0.000
##    .zs_econ_3         1.838    0.027   68.182    0.000
##     zr.sm.mndst.l.    1.092    0.033   33.204    0.000
##     econ.ltnt.vrbl    1.968    0.041   48.552    0.000
anova_model <- anova(fit.1, fit.2) ## significantly better fit with two factors


print(anova_model)
## 
## Chi-Squared Difference Test
## 
##       Df    AIC    BIC   Chisq Chisq diff   RMSEA Df diff Pr(>Chisq)    
## fit.2 19 320059 320183  995.19                                          
## fit.1 20 320722 320840 1660.97     665.78 0.24182       1  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Comparing Means

zsm_df <- select(bz_df_clean, zsm_1,zsm_2, zsm_3, zsm_4, zsm_5)
psych::alpha(zsm_df)
## 
## Reliability analysis   
## Call: psych::alpha(x = zsm_df)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean  sd median_r
##       0.75      0.75    0.72      0.37   3 0.0036  3.6 1.2     0.33
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.74  0.75  0.76
## Duhachek  0.74  0.75  0.76
## 
##  Reliability if an item is dropped:
##       raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r med.r
## zsm_1      0.70      0.70    0.66      0.37 2.3   0.0044 0.0192  0.33
## zsm_2      0.66      0.66    0.60      0.33 1.9   0.0051 0.0091  0.30
## zsm_3      0.75      0.75    0.71      0.43 3.0   0.0037 0.0130  0.44
## zsm_4      0.66      0.65    0.60      0.32 1.9   0.0052 0.0094  0.30
## zsm_5      0.74      0.74    0.70      0.41 2.8   0.0039 0.0159  0.39
## 
##  Item statistics 
##           n raw.r std.r r.cor r.drop mean  sd
## zsm_1 11368  0.72  0.71  0.60   0.53  3.7 1.7
## zsm_2 11368  0.79  0.78  0.74   0.63  3.6 1.7
## zsm_3 11368  0.58  0.60  0.42   0.37  4.4 1.5
## zsm_4 11368  0.80  0.79  0.75   0.65  3.4 1.7
## zsm_5 11368  0.63  0.63  0.48   0.42  2.9 1.6
bz_df_clean$zsm_mean <- rowMeans(zsm_df)

zs_econ_df <- select(bz_df_clean, contains("ec"))
psych::alpha(zs_econ_df)
## 
## Reliability analysis   
## Call: psych::alpha(x = zs_econ_df)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean  sd median_r
##       0.78      0.78    0.72      0.54 3.6 0.0036  3.7 1.4      0.5
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.77  0.78  0.79
## Duhachek  0.77  0.78  0.79
## 
##  Reliability if an item is dropped:
##           raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## zs_econ_1      0.67      0.67    0.50      0.50 2.0   0.0062    NA  0.50
## zs_econ_2      0.64      0.64    0.47      0.47 1.8   0.0067    NA  0.47
## zs_econ_3      0.80      0.80    0.66      0.66 3.9   0.0038    NA  0.66
## 
##  Item statistics 
##               n raw.r std.r r.cor r.drop mean  sd
## zs_econ_1 11368  0.85  0.85  0.75   0.65  3.6 1.7
## zs_econ_2 11368  0.86  0.86  0.78   0.68  3.6 1.7
## zs_econ_3 11368  0.79  0.79  0.59   0.53  4.0 1.7
bz_df_clean$zs_econ_mean <- rowMeans(zs_econ_df)

t.test(bz_df_clean$zsm_mean, bz_df_clean$zs_econ_mean, paired = T)
## 
##  Paired t-test
## 
## data:  bz_df_clean$zsm_mean and bz_df_clean$zs_econ_mean
## t = -11.05, df = 11367, p-value < 2.2e-16
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
##  -0.12697425 -0.08871188
## sample estimates:
## mean difference 
##      -0.1078431

Summarizing Mean Differences

library(dplyr)

# Create a list of dataset names and corresponding datasets
datasets <- list("US - Sample 1a" = zs_df_clean, "Italy - Sample 7" = zs_it_df_clean, "43 Nations - Country Level" = bzsg_country_means, "43 Nations - Individual Level" = bz_df_clean)

# Create an empty data frame to store the results
results_table <- data.frame(
  Dataset = character(),
  Rows = numeric(),
  Mean_zsm_mean = numeric(),
  SD_zsm_mean = numeric(),
  Mean_zs_econ_mean = numeric(),
  SD_zs_econ_mean = numeric(),
  t_value = numeric(),
  p_value = numeric(),
  Cohens_d = numeric(),
  stringsAsFactors = FALSE
)

# Iterate over each dataset
for (dataset_name in names(datasets)) {
  # Extract the dataset
  dataset <- datasets[[dataset_name]]
  
  # Run the paired t-test
  t_result <- t.test(dataset$zsm_mean, dataset$zs_econ_mean, paired = TRUE)
  
  # Calculate mean difference
  mean_difference <- mean(dataset$zsm_mean - dataset$zs_econ_mean)
  
  # Calculate pooled standard deviation
  pooled_sd <- sqrt(sum((dataset$zsm_mean - dataset$zs_econ_mean - mean_difference)^2) / (length(dataset$zsm_mean) - 1))
  
  # Calculate Cohen's d
  cohens_d <- mean_difference / pooled_sd
  
  # Add the results to the data frame
  results_table <- results_table %>%
    add_row(
      Dataset = dataset_name,
      Rows = nrow(dataset),
      Mean_zsm_mean = mean(dataset$zsm_mean),
      SD_zsm_mean = sd(dataset$zsm_mean),
      Mean_zs_econ_mean = mean(dataset$zs_econ_mean),
      SD_zs_econ_mean = sd(dataset$zs_econ_mean),
      t_value = t_result$statistic,
      p_value = t_result$p.value,
      Cohens_d = cohens_d
    )
}

# Print the results table
print(results_table)
##                         Dataset  Rows Mean_zsm_mean SD_zsm_mean
## 1                US - Sample 1a   821      3.052132   1.3537702
## 2              Italy - Sample 7   276      2.174638   1.1879738
## 3    43 Nations - Country Level    43      3.665806   0.4327221
## 4 43 Nations - Individual Level 11368      3.619849   1.1762078
##   Mean_zs_econ_mean SD_zs_econ_mean    t_value       p_value   Cohens_d
## 1          4.321153       1.4287459 -25.437466 1.100186e-105 -0.8877737
## 2          4.297101       1.5830847 -20.993530  4.640507e-59 -1.2636620
## 3          3.760588       0.3491216  -2.660038  1.101510e-02 -0.4056519
## 4          3.727692       1.4238091 -11.049552  3.067044e-28 -0.1036341
Table continues below
Dataset Rows Mean_zsm_mean SD_zsm_mean
US - Sample 1a 821 3.052 1.354
Italy - Sample 7 276 2.175 1.188
43 Nations - Country Level 43 3.666 0.4327
43 Nations - Individual Level 11368 3.62 1.176
Mean_zs_econ_mean SD_zs_econ_mean t_value p_value Cohens_d
4.321 1.429 -25.44 1.1e-105 -0.8878
4.297 1.583 -20.99 4.641e-59 -1.264
3.761 0.3491 -2.66 0.01102 -0.4057
3.728 1.424 -11.05 3.067e-28 -0.1036

Examining Correlations Between Economic and General ZSM

# BZSG 
bzsg <- read_csv(here("data", "bzsg.csv"))

nrow(bzsg)
## [1] 11368
zs_econ_df <- select(bzsg, contains("ec"))
bzsg$zs_econ_mean <- rowMeans(zs_econ_df)

zsm_df <- select(bzsg, starts_with("zsm_"))
bzsg$zsm_mean <- rowMeans(zsm_df)


bzsg_country_means <- read_csv(here("data", "bzsg_country_level.csv" ))

# US 1
s1 <- read_csv(here( "data","s1a.csv"))


# Italy
s7 <- read_csv(here("data", "s7.csv"))


cor.test(bzsg$zs_econ_mean, bzsg$zsm_mean)
## 
##  Pearson's product-moment correlation
## 
## data:  bzsg$zs_econ_mean and bzsg$zsm_mean
## t = 103.05, df = 11366, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.6853715 0.7043817
## sample estimates:
##      cor 
## 0.694998
cor.test(s1$zs_econ_mean, s1$zsm_mean)
## 
##  Pearson's product-moment correlation
## 
## data:  s1$zs_econ_mean and s1$zsm_mean
## t = 15.374, df = 819, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.4183725 0.5246792
## sample estimates:
##       cor 
## 0.4732469
cor.test(s7$zs_econ_mean, s7$zsm_mean)
## 
##  Pearson's product-moment correlation
## 
## data:  s7$zs_econ_mean and s7$zsm_mean
## t = 5.0438, df = 274, p-value = 8.316e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1795875 0.3959201
## sample estimates:
##       cor 
## 0.2914763