Introduction Analysis script

Presets

R markdown

Sample description

# Age

knitr::kable(describe(df$age), 'simple', caption = 'Descriptive Statistics: Age')
Descriptive Statistics: Age
vars n mean sd median trimmed mad min max range skew kurtosis se
X1 1 690 56.55 15.55 58 57.65 16.31 19 94 75 -0.5148 -0.49 0.5921
# Gender
df$gender <- set_labels(df$gender, 
                        labels = c("Male", "Female", "Other"))

knitr::kable(frq(df$gender), 'simple', caption = 'Gender frequencies in sample')
val label frq raw.prc valid.prc cum.prc
1 Male 284 41.16 41.16 41.16
2 Female 403 58.41 58.41 99.57
3 Other 3 0.43 0.43 100.00
NA NA 0 0.00 NA NA

Descriptive statistics 7C

Descriptive Statistics: 7C items
vars n mean sd min max range se
conf_01 1 690 5.468 1.526 1 7 6 0.0581
conf_02 2 690 5.412 1.484 1 7 6 0.0565
conf_03 3 690 6.123 1.267 1 7 6 0.0482
cmpcy_01 4 690 6.184 1.360 1 7 6 0.0518
cmpcy_02 5 690 6.106 1.424 1 7 6 0.0542
cmpcy_03 6 690 5.825 1.585 1 7 6 0.0604
const_01 7 690 5.851 1.472 1 7 6 0.0561
const_02 8 690 4.916 1.865 1 7 6 0.0710
const_03 9 690 6.314 1.199 1 7 6 0.0457
calc_01 10 690 3.451 2.212 1 7 6 0.0842
calc_02 11 690 3.885 2.173 1 7 6 0.0827
calc_03 12 690 3.849 2.187 1 7 6 0.0833
colr_01 13 690 6.012 1.476 1 7 6 0.0562
colr_02 14 690 6.378 1.181 1 7 6 0.0449
colr_03 15 690 6.109 1.368 1 7 6 0.0521
cmpli_01 16 690 4.465 2.025 1 7 6 0.0771
cmpli_02 17 690 5.478 1.611 1 7 6 0.0613
cmpli_03 18 690 4.070 1.997 1 7 6 0.0760
consp_01 19 690 5.936 1.452 1 7 6 0.0553
consp_02 20 690 4.952 1.711 1 7 6 0.0651
consp_03 21 690 5.548 1.651 1 7 6 0.0629

Descrictives of mean values

Descriptive Statistics: 7C components
vars n mean sd min max range se
conf_m 1 690 5.668 1.112 1.333 7 5.667 0.0423
cmpcy_m 2 690 6.038 1.167 1.000 7 6.000 0.0444
const_m 3 690 5.694 1.141 1.333 7 5.667 0.0434
calc_m 4 690 3.728 1.579 1.000 7 6.000 0.0601
colr_m 5 690 6.166 1.171 1.000 7 6.000 0.0446
cmpli_m 6 690 4.671 1.540 1.000 7 6.000 0.0586
consp_m 7 690 5.479 1.226 1.000 7 6.000 0.0467
mean_7c 8 690 5.349 0.866 1.571 7 5.429 0.0330
mean.short_7c 9 690 5.305 1.028 1.000 7 6.000 0.0391

Histograms 7C

library(psych)
# Confidence
psych::multi.hist(df %>% select(conf_01:conf_03))

# Complacency
psych::multi.hist(df %>% select(cmpcy_01:cmpcy_03))

# Csonatraints
psych::multi.hist(df %>% select(const_01:const_03))

# Calculation
psych::multi.hist(df %>% select(calc_01:calc_03))

# Collective Responsibility
psych::multi.hist(df %>% select(colr_01:colr_03))

# Compliance
psych::multi.hist(df %>% select(cmpli_01:cmpli_03))

# Conspiracy
psych::multi.hist(df %>% select(consp_01:consp_03))

# component Means
psych::multi.hist(df %>% select(conf_m:consp_m))

# long version and short version total mean scores
psych::multi.hist(df %>% select(mean_7c:mean.short_7c))

Inter Item Correlations

corPlot(df %>% select(conf_01:consp_03))

Component Correlations

corPlot(df %>% select(conf_m:consp_m))

Bifactor model

mod_7c <- "
          g =~ conf_01 + conf_02 + conf_03 + cmpcy_01 + cmpcy_02 + cmpcy_03 +
                const_01 + const_02 + const_03 + calc_01 + calc_02 + calc_03 +
                colr_01 + colr_02 + colr_03 + cmpli_01 + cmpli_02 + cmpli_03 +
                consp_01 + consp_02 + consp_03
          
          cmpcy =~ cmpcy_01 + cmpcy_02 + cmpcy_03 
          const =~ const_01 + const_02 + const_03 
          calc =~ calc_01 + calc_02 + calc_03 
          colres =~ colr_01 + colr_02 + colr_03 
          cmpli =~ cmpli_01 + cmpli_02 + cmpli_03 
          consp =~ consp_01 + consp_02 + consp_03
          "

fit.mod_7c <- cfa(mod_7c, 
                data = df, 
                estimator = "MLR",
                missing = "FIML", 
                std.lv = TRUE, 
                orthogonal = TRUE)


knitr::kable(fitMeasures(fit.mod_7c, c("chisq", "df", "pvalue", "cfi", "tli", "rmsea", "srmr"), 
            output = "matrix"), 'simple', caption = 'Fit measures of 7C bifactor model')
Fit measures of 7C bifactor model
chisq 497.0922
df 171.0000
pvalue 0.0000
cfi 0.9308
tli 0.9150
rmsea 0.0526
srmr 0.0461
summary(fit.mod_7c, standardized = TRUE)
## lavaan 0.6-7 ended normally after 72 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         81
##                                                       
##   Number of observations                           690
##   Number of missing patterns                         1
##                                                       
## Model Test User Model:
##                                                Standard      Robust
##   Test Statistic                                497.092     440.820
##   Degrees of freedom                                171         171
##   P-value (Chi-square)                            0.000       0.000
##   Scaling correction factor                                   1.128
##        Yuan-Bentler correction (Mplus variant)                     
## 
## 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
##   g =~                                                                  
##     conf_01           0.826    0.068   12.197    0.000    0.826    0.542
##     conf_02           0.807    0.072   11.202    0.000    0.807    0.544
##     conf_03           0.878    0.071   12.453    0.000    0.878    0.693
##     cmpcy_01          0.733    0.066   11.142    0.000    0.733    0.539
##     cmpcy_02          0.833    0.068   12.313    0.000    0.833    0.585
##     cmpcy_03          0.920    0.068   13.451    0.000    0.920    0.581
##     const_01          0.921    0.066   13.865    0.000    0.921    0.626
##     const_02          1.132    0.068   16.664    0.000    1.132    0.607
##     const_03          0.424    0.052    8.142    0.000    0.424    0.354
##     calc_01           0.051    0.091    0.560    0.576    0.051    0.023
##     calc_02           0.768    0.075   10.204    0.000    0.768    0.354
##     calc_03           0.681    0.079    8.560    0.000    0.681    0.311
##     colr_01           0.882    0.069   12.859    0.000    0.882    0.598
##     colr_02           0.819    0.069   11.923    0.000    0.819    0.695
##     colr_03           0.845    0.066   12.728    0.000    0.845    0.618
##     cmpli_01          0.808    0.081    9.993    0.000    0.808    0.399
##     cmpli_02          0.930    0.068   13.585    0.000    0.930    0.578
##     cmpli_03          0.778    0.074   10.560    0.000    0.778    0.390
##     consp_01          0.715    0.064   11.155    0.000    0.715    0.493
##     consp_02          0.711    0.071   10.057    0.000    0.711    0.416
##     consp_03          0.704    0.074    9.506    0.000    0.704    0.426
##   cmpcy =~                                                              
##     cmpcy_01          0.658    0.175    3.747    0.000    0.658    0.484
##     cmpcy_02          0.858    0.216    3.966    0.000    0.858    0.603
##     cmpcy_03          0.207    0.088    2.344    0.019    0.207    0.131
##   const =~                                                              
##     const_01          0.801    0.622    1.286    0.198    0.801    0.544
##     const_02          0.271    0.223    1.218    0.223    0.271    0.145
##     const_03          0.172    0.157    1.094    0.274    0.172    0.144
##   calc =~                                                               
##     calc_01           0.817    0.133    6.138    0.000    0.817    0.369
##     calc_02           1.660    0.214    7.759    0.000    1.660    0.764
##     calc_03           0.830    0.131    6.331    0.000    0.830    0.380
##   colres =~                                                             
##     colr_01           0.853    0.091    9.382    0.000    0.853    0.578
##     colr_02           0.333    0.065    5.152    0.000    0.333    0.283
##     colr_03           0.843    0.077   10.984    0.000    0.843    0.616
##   cmpli =~                                                              
##     cmpli_01          1.230    0.119   10.328    0.000    1.230    0.608
##     cmpli_02          0.481    0.070    6.871    0.000    0.481    0.299
##     cmpli_03          1.531    0.133   11.502    0.000    1.531    0.767
##   consp =~                                                              
##     consp_01          0.461    0.101    4.588    0.000    0.461    0.318
##     consp_02          0.584    0.124    4.694    0.000    0.584    0.341
##     consp_03          1.052    0.193    5.445    0.000    1.052    0.637
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   g ~~                                                                  
##     cmpcy             0.000                               0.000    0.000
##     const             0.000                               0.000    0.000
##     calc              0.000                               0.000    0.000
##     colres            0.000                               0.000    0.000
##     cmpli             0.000                               0.000    0.000
##     consp             0.000                               0.000    0.000
##   cmpcy ~~                                                              
##     const             0.000                               0.000    0.000
##     calc              0.000                               0.000    0.000
##     colres            0.000                               0.000    0.000
##     cmpli             0.000                               0.000    0.000
##     consp             0.000                               0.000    0.000
##   const ~~                                                              
##     calc              0.000                               0.000    0.000
##     colres            0.000                               0.000    0.000
##     cmpli             0.000                               0.000    0.000
##     consp             0.000                               0.000    0.000
##   calc ~~                                                               
##     colres            0.000                               0.000    0.000
##     cmpli             0.000                               0.000    0.000
##     consp             0.000                               0.000    0.000
##   colres ~~                                                             
##     cmpli             0.000                               0.000    0.000
##     consp             0.000                               0.000    0.000
##   cmpli ~~                                                              
##     consp             0.000                               0.000    0.000
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .conf_01           5.468    0.058   94.213    0.000    5.468    3.587
##    .conf_02           5.412    0.056   95.866    0.000    5.412    3.650
##    .conf_03           6.123    0.048  127.012    0.000    6.123    4.835
##    .cmpcy_01          6.184    0.052  119.564    0.000    6.184    4.552
##    .cmpcy_02          6.106    0.054  112.707    0.000    6.106    4.291
##    .cmpcy_03          5.825    0.060   96.577    0.000    5.825    3.677
##    .const_01          5.851    0.056  104.457    0.000    5.851    3.977
##    .const_02          4.916    0.071   69.280    0.000    4.916    2.637
##    .const_03          6.314    0.046  138.422    0.000    6.314    5.270
##    .calc_01           3.451    0.084   40.998    0.000    3.451    1.561
##    .calc_02           3.886    0.083   46.999    0.000    3.886    1.789
##    .calc_03           3.849    0.083   46.261    0.000    3.849    1.761
##    .colr_01           6.012    0.056  107.033    0.000    6.012    4.075
##    .colr_02           6.378    0.045  142.021    0.000    6.378    5.407
##    .colr_03           6.109    0.052  117.408    0.000    6.109    4.470
##    .cmpli_01          4.465    0.077   57.960    0.000    4.465    2.207
##    .cmpli_02          5.478    0.061   89.390    0.000    5.478    3.403
##    .cmpli_03          4.070    0.076   53.560    0.000    4.070    2.039
##    .consp_01          5.936    0.055  107.448    0.000    5.936    4.090
##    .consp_02          4.952    0.065   76.076    0.000    4.952    2.896
##    .consp_03          5.548    0.063   88.312    0.000    5.548    3.362
##     g                 0.000                               0.000    0.000
##     cmpcy             0.000                               0.000    0.000
##     const             0.000                               0.000    0.000
##     calc              0.000                               0.000    0.000
##     colres            0.000                               0.000    0.000
##     cmpli             0.000                               0.000    0.000
##     consp             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .conf_01           1.642    0.125   13.157    0.000    1.642    0.707
##    .conf_02           1.547    0.126   12.301    0.000    1.547    0.704
##    .conf_03           0.833    0.086    9.719    0.000    0.833    0.519
##    .cmpcy_01          0.877    0.237    3.698    0.000    0.877    0.475
##    .cmpcy_02          0.594    0.369    1.610    0.107    0.594    0.293
##    .cmpcy_03          1.620    0.147   11.042    0.000    1.620    0.645
##    .const_01          0.675    1.004    0.673    0.501    0.675    0.312
##    .const_02          2.119    0.180   11.802    0.000    2.119    0.610
##    .const_03          1.227    0.123   10.005    0.000    1.227    0.854
##    .calc_01           4.218    0.241   17.482    0.000    4.218    0.863
##    .calc_02           1.369    0.701    1.953    0.051    1.369    0.290
##    .calc_03           3.625    0.241   15.063    0.000    3.625    0.759
##    .colr_01           0.671    0.143    4.710    0.000    0.671    0.308
##    .colr_02           0.609    0.098    6.217    0.000    0.609    0.438
##    .colr_03           0.444    0.128    3.454    0.001    0.444    0.238
##    .cmpli_01          1.928    0.274    7.048    0.000    1.928    0.471
##    .cmpli_02          1.494    0.106   14.079    0.000    1.494    0.577
##    .cmpli_03          1.034    0.378    2.735    0.006    1.034    0.260
##    .consp_01          1.382    0.157    8.819    0.000    1.382    0.656
##    .consp_02          2.077    0.169   12.258    0.000    2.077    0.710
##    .consp_03          1.122    0.399    2.807    0.005    1.122    0.412
##     g                 1.000                               1.000    1.000
##     cmpcy             1.000                               1.000    1.000
##     const             1.000                               1.000    1.000
##     calc              1.000                               1.000    1.000
##     colres            1.000                               1.000    1.000
##     cmpli             1.000                               1.000    1.000
##     consp             1.000                               1.000    1.000
# Reliability
knitr::kable(reliability(fit.mod_7c), 'simple', caption = 'Reliability of 7C bifactor model')
Reliability of 7C bifactor model
g cmpcy const calc colres cmpli consp
alpha 0.8662 0.7181 0.5933 0.5370 0.8384 0.7488 0.6395
omega 0.8937 0.4900 0.2779 0.5428 0.7047 0.7023 0.4898
omega2 0.7994 0.2425 0.1322 0.4883 0.3339 0.4935 0.3253
omega3 0.7915 0.2425 0.1322 0.4883 0.3339 0.4935 0.3253
avevar NA NA NA NA NA NA NA

logistic regression: binary vacciantion intention variable is regressed on 7C short version items

mod <- glm(vacc_dich ~ conf_03.z + cmpcy_03.z + const_02.z + calc_02.z + colr_02.z + cmpli_03.z + consp_01.z, data = df, family = "binomial")
summary(mod)
## 
## Call:
## glm(formula = vacc_dich ~ conf_03.z + cmpcy_03.z + const_02.z + 
##     calc_02.z + colr_02.z + cmpli_03.z + consp_01.z, family = "binomial", 
##     data = df)
## 
## Deviance Residuals: 
##    Min      1Q  Median      3Q     Max  
## -2.981   0.141   0.242   0.399   2.710  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)    2.385      0.176   13.55  < 2e-16 ***
## conf_03.z      0.846      0.142    5.98  2.3e-09 ***
## cmpcy_03.z     0.447      0.136    3.29  0.00101 ** 
## const_02.z     0.504      0.157    3.21  0.00133 ** 
## calc_02.z      0.201      0.161    1.25  0.21217    
## colr_02.z      0.373      0.129    2.89  0.00379 ** 
## cmpli_03.z     0.179      0.154    1.16  0.24506    
## consp_01.z     0.486      0.131    3.70  0.00021 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 634.48  on 689  degrees of freedom
## Residual deviance: 371.28  on 682  degrees of freedom
## AIC: 387.3
## 
## Number of Fisher Scoring iterations: 6
tab <- coef(summary(mod))  # regression coefficients
knitr::kable(tab, 'simple', caption = 'Regression coefficients')
Regression coefficients
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.3854 0.1760 13.551 0.0000
conf_03.z 0.8462 0.1415 5.978 0.0000
cmpcy_03.z 0.4468 0.1359 3.287 0.0010
const_02.z 0.5035 0.1569 3.209 0.0013
calc_02.z 0.2014 0.1615 1.248 0.2122
colr_02.z 0.3726 0.1287 2.895 0.0038
cmpli_03.z 0.1790 0.1540 1.162 0.2451
consp_01.z 0.4865 0.1313 3.704 0.0002
#'## Parameters
logit.7c.short.fact <- as.data.frame(mod[["coefficients"]])
odd.7c.short.fact <- as.data.frame(exp(mod[["coefficients"]]))
cond.7c.short.fact <- as.data.frame(exp(mod[["coefficients"]])/(1+exp(mod[["coefficients"]])))


summary.table.7c.short_fact <- cbind(logit.7c.short.fact, odd.7c.short.fact, cond.7c.short.fact)
colnames(summary.table.7c.short_fact) <- c("logits", "Odds", "cond.prob.") 
rownames(summary.table.7c.short_fact) <- c("Intercept", "Conf", "Comp", "Const", "Calc", "ColRes", "Compl", "Consp")
knitr::kable(summary.table.7c.short_fact, 'simple', caption = 'Regression coefficients as logits, odds and conditional probabilities')
Regression coefficients as logits, odds and conditional probabilities
logits Odds cond.prob.
Intercept 2.3854 10.864 0.9157
Conf 0.8462 2.331 0.6998
Comp 0.4468 1.563 0.6099
Const 0.5035 1.655 0.6233
Calc 0.2014 1.223 0.5502
ColRes 0.3726 1.452 0.5921
Compl 0.1790 1.196 0.5446
Consp 0.4865 1.627 0.6193
#'## Nagelkerke R Square
r2.nagel.7c_short.f.mean <- r2_nagelkerke(mod)
knitr::kable(r2.nagel.7c_short.f.mean, 'simple', caption = 'Nagelkerks R-square')
Nagelkerks R-square
x
Nagelkerke's R2 0.5274

Allaire, JJ, Yihui Xie, Jonathan McPherson, Javier Luraschi, Kevin Ushey, Aron Atkins, Hadley Wickham, Joe Cheng, Winston Chang, and Richard Iannone. 2021. Rmarkdown: Dynamic Documents for R. https://CRAN.R-project.org/package=rmarkdown.