Za ilustraciju upotrebe bootstrap intervala poverenja u medijacionim modelima, ovde ćemo prikazati kako se testiraju medijacioni modeli iz članka:
Lazarević, Lj., Purić, D., Teovanović, P., Lukić, P., Zupan, Z. & Knežević G. (2021). What drives us to be (ir)responsible for our health during the COVID-19 pandemic? The role of personality, thinking styles, and conspiracy mentality. Personality and Individual Differences, 176, https://doi.org/10.1016/j.paid.2021.110771.
Članak se može pročitati na: https://www.sciencedirect.com/science/article/pii/S019188692100146X?via%3Dihub

Pripremne aktivnosti

Učitavanje potrebnih paketa

haven nam je potreban da lako učitamo spss fajl
lavaan je potreban za testiranje medijacionog modela
semPlot ćemo koristiti da nacrtamo model

library(haven)
library(lavaan)
library(semPlot)

Učitavanje fajla sa podacima

Podaci se mogu naći na OSF stranici istraživanja: https://osf.io/9njp3/
Ovde koristimo Database_Serbian_transformed (fajl je samo preimenovan za vežbe)

setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
dat <- read_sav("mediation_delta_PSP.sav")

Postavljanje random seed-a

Ovo je važno kako bismo dobili reproducibilne rezultate (svaki put kada pokrenemo analizu, bilo mi, bilo neko drugi)

set.seed(1234)

Medijacioni model

Postavljanje medijacionog modela

Ovaj model je pojednostavljena verzija u odnosu na onu iz članka zato što nisu uključeni kovarijati (rezultati se ne menjaju dramatično)
Model iz članka dostupan je isto na OSF stranici istraživanja: https://osf.io/9njp3/
Varijabla CAM_bin se odnosi na primenu pseudo-naučnih praksi (pseudo-scientific practices PSP)
DELTA je dezintegracija
NFC je Need for cognition, odnosno racionalni stil razmišljanja
FI je Faith in intuition, odnosno intuitivni stil razmišljanja
CMQ je Conspiracy Mentality Questionnaire, odnosno zavereničko mišljenje

DELTA_PSP <- '
  CAM_bin ~ c * DELTA + b1 * NFC + b2 * FI + b3 * CMQ
  NFC ~ a1 * DELTA
  FI ~ a2 * DELTA
  CMQ ~ a3 * DELTA
  indirect1 := a1*b1
  indirect2 := a2*b2
  indirect3 := a3*b3
  direct := c
  total := c + (a1*b1) + (a2*b2) + (a3*b3) 
  NFC ~~ FI + CMQ
  FI ~~ CMQ
'

fit_DELTA_PSP <- sem(DELTA_PSP, 
                     data = dat,
                     se = "bootstrap")

Rezultati medijacionog modela

summary(fit_DELTA_PSP, 
        rsquare=TRUE, 
        standardized = TRUE, 
        fit.measures = TRUE)
## lavaan 0.6-12 ended normally after 36 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        14
## 
##   Number of observations                           417
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 0.000
##   Degrees of freedom                                 0
## 
## Model Test Baseline Model:
## 
##   Test statistic                               165.703
##   Degrees of freedom                                10
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    1.000
##   Tucker-Lewis Index (TLI)                       1.000
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -2578.306
##   Loglikelihood unrestricted model (H1)      -2578.306
##                                                       
##   Akaike (AIC)                                5184.612
##   Bayesian (BIC)                              5241.075
##   Sample-size adjusted Bayesian (BIC)         5196.650
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.000
##   90 Percent confidence interval - lower         0.000
##   90 Percent confidence interval - upper         0.000
##   P-value RMSEA <= 0.05                             NA
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.000
## 
## Parameter Estimates:
## 
##   Standard errors                            Bootstrap
##   Number of requested bootstrap draws             1000
##   Number of successful bootstrap draws            1000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   CAM_bin ~                                                             
##     DELTA      (c)    0.012    0.018    0.698    0.485    0.012    0.036
##     NFC       (b1)   -0.045    0.015   -2.992    0.003   -0.045   -0.155
##     FI        (b2)    0.043    0.015    2.916    0.004    0.043    0.146
##     CMQ       (b3)    0.001    0.001    1.882    0.060    0.001    0.095
##   NFC ~                                                                 
##     DELTA     (a1)   -0.337    0.056   -6.003    0.000   -0.337   -0.288
##   FI ~                                                                  
##     DELTA     (a2)    0.261    0.055    4.735    0.000    0.261    0.226
##   CMQ ~                                                                 
##     DELTA     (a3)    9.676    1.490    6.496    0.000    9.676    0.322
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .NFC ~~                                                                
##    .FI                0.042    0.027    1.562    0.118    0.042    0.088
##    .CMQ              -1.416    0.556   -2.546    0.011   -1.416   -0.117
##  .FI ~~                                                                 
##    .CMQ               2.513    0.642    3.913    0.000    2.513    0.206
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .CAM_bin           0.041    0.002   16.953    0.000    0.041    0.924
##    .NFC               0.479    0.032   15.032    0.000    0.479    0.917
##    .FI                0.484    0.034   14.337    0.000    0.484    0.949
##    .CMQ             307.365   21.323   14.415    0.000  307.365    0.896
## 
## R-Square:
##                    Estimate
##     CAM_bin           0.076
##     NFC               0.083
##     FI                0.051
##     CMQ               0.104
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     indirect1         0.015    0.006    2.597    0.009    0.015    0.045
##     indirect2         0.011    0.004    2.537    0.011    0.011    0.033
##     indirect3         0.011    0.006    1.821    0.069    0.011    0.031
##     direct            0.012    0.018    0.698    0.485    0.012    0.036
##     total             0.049    0.017    2.928    0.003    0.049    0.144
parameterEstimates(fit_DELTA_PSP, standardized = TRUE)
lhs op rhs label est se z pvalue ci.lower ci.upper std.lv std.all std.nox
CAM_bin ~ DELTA c 0.0122626 0.0175655 0.6981101 0.4851083 -0.0206872 0.0472886 0.0122626 0.0357041 0.0578986
CAM_bin ~ NFC b1 -0.0453833 0.0151662 -2.9923983 0.0027679 -0.0742805 -0.0161435 -0.0453833 -0.1548965 -0.1548965
CAM_bin ~ FI b2 0.0434155 0.0148902 2.9157073 0.0035488 0.0154975 0.0723327 0.0434155 0.1464536 0.1464536
CAM_bin ~ CMQ b3 0.0010856 0.0005768 1.8821467 0.0598161 -0.0000202 0.0022914 0.0010856 0.0949216 0.0949216
NFC ~ DELTA a1 -0.3372013 0.0561717 -6.0030437 0.0000000 -0.4475090 -0.2251410 -0.3372013 -0.2876586 -0.4664740
FI ~ DELTA a2 0.2612813 0.0551793 4.7351336 0.0000022 0.1534420 0.3683007 0.2612813 0.2255214 0.3657108
CMQ ~ DELTA a3 9.6761695 1.4895758 6.4959227 0.0000000 6.7133260 12.5199734 9.6761695 0.3221998 0.5224868
NFC ~~ FI 0.0422842 0.0270773 1.5616116 0.1183795 -0.0100225 0.0925257 0.0422842 0.0877477 0.0877477
NFC ~~ CMQ -1.4162827 0.5563275 -2.5457715 0.0109037 -2.5583648 -0.2505474 -1.4162827 -0.1166853 -0.1166853
FI ~~ CMQ 2.5126821 0.6421203 3.9131018 0.0000911 1.2798364 3.8893392 2.5126821 0.2059085 0.2059085
CAM_bin ~~ CAM_bin 0.0414563 0.0024454 16.9525604 0.0000000 0.0364641 0.0461520 0.0414563 0.9241840 0.9241840
NFC ~~ NFC 0.4793056 0.0318852 15.0322114 0.0000000 0.4174242 0.5455806 0.4793056 0.9172525 0.9172525
FI ~~ FI 0.4844752 0.0337931 14.3365291 0.0000000 0.4203101 0.5516562 0.4844752 0.9491401 0.9491401
CMQ ~~ CMQ 307.3654147 21.3226517 14.4149714 0.0000000 266.6150929 348.5749530 307.3654147 0.8961873 0.8961873
DELTA ~~ DELTA 0.3802768 0.0000000 NA NA 0.3802768 0.3802768 0.3802768 1.0000000 0.3802768
indirect1 := a1*b1 indirect1 0.0153033 0.0058938 2.5965168 0.0094174 0.0050479 0.0282639 0.0153033 0.0445573 0.0722552
indirect2 := a2*b2 indirect2 0.0113437 0.0044715 2.5368840 0.0111844 0.0038343 0.0209466 0.0113437 0.0330284 0.0535596
indirect3 := a3*b3 indirect3 0.0105040 0.0057677 1.8211829 0.0685791 -0.0002298 0.0224921 0.0105040 0.0305837 0.0495953
direct := c direct 0.0122626 0.0175743 0.6977609 0.4853267 -0.0206872 0.0472886 0.0122626 0.0357041 0.0578986
total := c+(a1b1)+(a2b2)+(a3*b3) total 0.0494136 0.0168757 2.9280874 0.0034105 0.0176699 0.0834085 0.0494136 0.1438736 0.2333088

Plot modela

semPaths(fit_DELTA_PSP, what = "path", whatLabels = "std", layout = "spring",  sizeMan = 8, edge.label.cex = 1)