options(max.print=1000000) #load packages and database---------------- library(haven) library(dplyr) library(ggrepel) library (ggplot2) library(plyr) library (ggthemes) library (sjmisc) library (stargazer) library(car) library (psych) library (GPArotation) library (lavaan) library (semPlot) library (lm.beta) library (semTools) library (polycor) library (summarytools) library (officer) library (flextable) library (tidyr) df1 <- read_spss ("korona_data_clean.sav") #database without participants with missing data df1nm <- df1[which(df1$missing == 0),] #CFA's------------------- #COVID-19 unfounded beliefs===================== consp_2f1hfinal <- ' PODR =~ podrijetlo1SQ001 + podrijetlo2SQ001 + podrijetlo3SQ001 + podrijetlo4SQ001 + podrijetlo5SQ001 + ozbiljnost1SQ001+ ozbiljnost2SQ001+ ozbiljnost3SQ001 LIJEC=~ lijecenje1SQ001 + lijecenje2SQ001 + lijecenje3SQ001 + lijecenje4SQ001 + lijecenje5SQ001 + lijecenje6SQ001 UB=~ a*PODR+ a*LIJEC ' fit.consp_2f1hfinal<- cfa (consp_2f1hfinal, data=df1, estimator ="ML" # , missing ="ML" ) summary (fit.consp_2f1hfinal, fit.measures =T, standardized = T) reliability(fit.consp_2f1hfinal) consp_1ffinal <- ' CONSp =~ podrijetlo1SQ001 + podrijetlo2SQ001 + podrijetlo3SQ001 + podrijetlo4SQ001 + podrijetlo5SQ001 + ozbiljnost1SQ001+ ozbiljnost2SQ001+ ozbiljnost3SQ001 + lijecenje1SQ001 + lijecenje2SQ001 + lijecenje3SQ001 + lijecenje4SQ001 + lijecenje5SQ001 + lijecenje6SQ001 ' fit.consp_1ffinal<- cfa (consp_1ffinal, data=df1, estimator ="ML" # , missing ="ML" ) summary (fit.consp_1ffinal, fit.measures =T, standardized = T) anova (fit.consp_1ffinal, fit.consp_2f1hfinal) # CRT============== crt_1f<-' CRT =~ crttn1 + crttn2 + crttn3 ' fit.crt_1f<- cfa (crt_1f, df1, estimator="ML" # , missing ="ML" ) summary (fit.crt_1f, fit.measures=T, standardized=T) #AOT i Faith in intuition====================== aot_2f <- ' AOT =~ aot1SQ001 + aot2SQ001 + aot3SQ001 + aot4SQ001 + aot5r + aot6SQ001 + aot7r + aot8r + aot9SQ001 + aot10SQ001 FI =~ fi1SQ001 + fi2SQ001 + fi3SQ001 + fi4SQ001 + fi5SQ001 ' fit.aot_2f<- cfa (aot_2f, data=df1, estimator ="ML" # , missing ="ML" ) summary (fit.aot_2f, fit.measures =T, standardized = T) #without items 3 and 9 aot_2f <- ' AOT =~ aot1SQ001 + aot2SQ001 + aot4SQ001 + aot5r + aot6SQ001 + aot7r + aot8r + aot10SQ001 FI =~ fi1SQ001 + fi2SQ001 + fi3SQ001 + fi4SQ001 + fi5SQ001 ' #AOTh=~ 1*AOT+ -1*FI' fit.aot_2f<- cfa (aot_2f, data=df1, estimator ="ML" # , missing ="ML" ) summary (fit.aot_2f, fit.measures =T, standardized = T) aot_1f <- ' AOT =~ aot1SQ001 + aot2SQ001 + aot4SQ001 + aot5r + aot6SQ001 + aot7r + aot8r + aot10SQ001 + fi1SQ001 + fi2SQ001 + fi3SQ001 + fi4SQ001 + fi5SQ001 ' fit.aot_1f<- cfa (aot_1f, data=df1, estimator ="ML" # , missing ="ML" ) summary (fit.aot_1f, fit.measures =T, standardized = T) anova (aot_2f, aot_1f) #COVID-19 behavior================ pon_1f<-' PONASANJE =~ ponasanje1SQ001 + ponasanje2SQ001 + ponasanje3SQ001 + ponasanje4SQ001' fit.pon_1f <- cfa(pon_1f, data = df1, estimator = "ML" ) summary(fit.pon_1f, fit.measures = TRUE, standardized = TRUE) #science curiosity============= scicur_1f<-' SCICUR =~ scicur1SQ006 + scicur3SQ006 + scicur4SQ006 + scicur5SQ006 + scicur6SQ006 ' fit.scicur_1f <- cfa(scicur_1f, data = df1, estimator = "ML" ) summary(fit.scicur_1f, fit.measures = TRUE, standardized = TRUE) #anxiety================= anx_1f<- ' ANX =~ anx1SQ001 + anx2SQ001 + anx3SQ001 + anx4SQ001 ' fit.anx_1f <- cfa(anx_1f, data = df1, estimator = "ML" ) summary(fit.anx_1f, fit.measures = TRUE, standardized = TRUE) #measurement model with all scales============================ #all scales on separate factor sve<-' #predictors CRT =~ crttn1 + crttn2 + crttn3 AOT =~ aot1SQ001 + aot2SQ001 + aot4SQ001 + aot5r + aot6SQ001 + aot7r + aot8r + aot10SQ001 FI =~ fi1SQ001 + fi2SQ001 + fi3SQ001 + fi4SQ001 + fi5SQ001 SCICUR =~ scicur1SQ006 + scicur3SQ006 + scicur4SQ006 + scicur5SQ006 + scicur6SQ006 ANX =~ anx1SQ001 + anx2SQ001 + anx3SQ001 + anx4SQ001 #mediators PODR =~ podrijetlo1SQ001 + podrijetlo2SQ001 + podrijetlo3SQ001 + podrijetlo4SQ001 + podrijetlo5SQ001 + ozbiljnost1SQ001+ ozbiljnost2SQ001+ ozbiljnost3SQ001 LIJEC=~ lijecenje1SQ001 + lijecenje2SQ001 + lijecenje3SQ001 + lijecenje4SQ001 + lijecenje5SQ001 + lijecenje6SQ001 UB=~ a*PODR+ a*LIJEC #criterion PONASANJE =~ ponasanje1SQ001 + ponasanje2SQ001 + ponasanje3SQ001 + ponasanje4SQ001 ' fit.sve <- cfa(sve, data = df1, estimator = "ML" ) summary(fit.sve, fit.measures = TRUE, standardized = TRUE) #predictors on two cognitive and anxiety factors sve_p2f<-' #predictors KOGN =~ crttn1 + crttn2 + crttn3+ aot1SQ001 + aot2SQ001 + aot4SQ001 + aot5r + aot6SQ001 + aot7r + aot8r + aot10SQ001 +fi1SQ001 + fi2SQ001 + fi3SQ001 + fi4SQ001 + fi5SQ001 +scicur1SQ006 + scicur3SQ006 + scicur4SQ006 + scicur5SQ006 + scicur6SQ006 ANX =~ anx1SQ001 + anx2SQ001 + anx3SQ001 + anx4SQ001 #mediators PODR =~ podrijetlo1SQ001 + podrijetlo2SQ001 + podrijetlo3SQ001 + podrijetlo4SQ001 + podrijetlo5SQ001 + ozbiljnost1SQ001+ ozbiljnost2SQ001+ ozbiljnost3SQ001 LIJEC=~ lijecenje1SQ001 + lijecenje2SQ001 + lijecenje3SQ001 + lijecenje4SQ001 + lijecenje5SQ001 + lijecenje6SQ001 UB=~ a*PODR+ a*LIJEC #criterion PONASANJE =~ ponasanje1SQ001 + ponasanje2SQ001 + ponasanje3SQ001 + ponasanje4SQ001 ' fit.sve_p2f <- cfa(sve_p2f, data = df1, estimator = "ML" ) summary(fit.sve_p2f, fit.measures = TRUE, standardized = TRUE) anova (fit.sve, fit.sve_p2f) #descriptive statistics of mean scale scores------------------------- #anx=anxiety scale, crt= cognitive reflection test, aot = actively open-minded thinking scale without item 3 and 9, #povj_intuic=faith in intuition, sci_cur= science curiosity, zabrSQ001 = COVID-19 worry, consp= COVID-19 Conspiracy Beliefs, #lijecenje= COVID-19 Treatment Beliefs, UB= COVID-19 Averaged Unfounded Beliefs, znanje= COVID-19 Knowledge, #ponasanje = COVID-19 Behavior #spol=sex, dob = age, obrazovanje = education,ideologijaSQ001 = political values desk<- describe(df1[, c("anx", "crt", "aotclean", "povj_intuic", "sci_cur", "zabrSQ001", "consp", "lijecenje", "UB", "znanje", "ponasanje", "spol", "dob", "obrazovanje", "ideologijaSQ001")]) dfSummary(df1[, c("anx", "crt", "aotclean", "povj_intuic", "sci_cur", "zabrSQ001", "consp", "lijecenje", "UB", "znanje", "ponasanje", "spol", "dob", "obrazovanje", "ideologijaSQ001")]) ## correlations among latent factors============== #rescaling age to equalize it's variance with other variables' variance df1$dobr<- (df1$dob)/10 korel<-' #predictors CRT =~ crttn1 + crttn2 + crttn3 AOT =~ aot1SQ001 + aot2SQ001 + aot4SQ001 + aot5r + aot6SQ001 + aot7r + aot8r + aot10SQ001 FI =~ fi1SQ001 + fi2SQ001 + fi3SQ001 + fi4SQ001 + fi5SQ001 SCICUR =~ scicur1SQ006 + scicur3SQ006 + scicur4SQ006 + scicur5SQ006 + scicur6SQ006 ANX =~ anx1SQ001 + anx2SQ001 + anx3SQ001 + anx4SQ001 #mediators PODR =~ podrijetlo1SQ001 + podrijetlo2SQ001 + podrijetlo3SQ001 + podrijetlo4SQ001 + podrijetlo5SQ001 + ozbiljnost1SQ001+ ozbiljnost2SQ001+ ozbiljnost3SQ001 LIJEC=~ lijecenje1SQ001 + lijecenje2SQ001 + lijecenje3SQ001 + lijecenje4SQ001 + lijecenje5SQ001 + lijecenje6SQ001 UB=~ a*PODR+ a*LIJEC ZNANJE=~ znanje ZABR=~ zabrSQ001 #criterion PONASANJE =~ ponasanje1SQ001 + ponasanje2SQ001 + ponasanje3SQ001 + ponasanje4SQ001 #control varibles (obrazovanje = education,ideologijaSQ001 = political values) SEX=~ spol AGE=~ dobr EDU=~ obrazovanje IDE=~ ideologijaSQ001 ' fit.korel <- cfa (korel, data = df1, estimator = "ML" ) summary(fit.korel, fit.measures = TRUE, standardized = TRUE) parameterestimates(fit.korel, standardized = T) reliability(fit.korel) #test of the scalar invariance and effect of consider the opposite intervention (uputa=consider the opposite intervention, #1=intervetion group, 2=control group) ================= consp_2f1hfinal_int <- ' PODR =~ podrijetlo1SQ001 + podrijetlo2SQ001 + podrijetlo3SQ001 + podrijetlo4SQ001 + podrijetlo5SQ001 + ozbiljnost1SQ001+ ozbiljnost2SQ001+ ozbiljnost3SQ001 LIJEC=~ lijecenje1SQ001 + lijecenje2SQ001 + lijecenje3SQ001 + lijecenje4SQ001 + lijecenje5SQ001 + lijecenje6SQ001 UB=~ 1*PODR+ 1*LIJEC ' fit.consp_2f1hfinal_int<- cfa (consp_2f1hfinal_int, data=df1, estimator ="ML", group= "uputa", meanstructure=T # , missing ="ML" ) summary (fit.consp_2f1hfinal_int, fit.measures =T, standardized = T) fitci.consp_2f1hfinal_int<- cfa (consp_2f1hfinal_int, data=df1, estimator ="ML", group= "uputa", meanstructure=T, group.equal = c("intercepts", "loadings") # , missing ="ML" ) summary (fitci.consp_2f1hfinal_int, fit.measures =T, standardized = T) fitcm.consp_2f1hfinal_int<- cfa (consp_2f1hfinal_int, data=df1, estimator ="ML", group= "uputa", meanstructure=T, group.equal = c("means", "intercepts", "loadings") # , missing ="ML" ) summary (fitcm.consp_2f1hfinal_int, fit.measures =T, standardized = T) anova (fit.consp_2f1hfinal_int, fitci.consp_2f1hfinal_int, fitcm.consp_2f1hfinal_int) #Behavior prediction SEM model------------------- #model without control variables modelnc <- ' #preditcors CRT =~ crttn1 + crttn2 + crttn3 AOT =~ aot1SQ001 + aot2SQ001 + aot4SQ001 + aot5r + aot6SQ001 + aot7r + aot8r + aot10SQ001 FI =~ fi1SQ001 + fi2SQ001 + fi3SQ001 + fi4SQ001 + fi5SQ001 SCICUR =~ scicur1SQ006 + scicur3SQ006 + scicur4SQ006 + scicur5SQ006 + scicur6SQ006 ANX =~ anx1SQ001 + anx2SQ001 + anx3SQ001 + anx4SQ001 #mediators PODR =~ podrijetlo1SQ001 + podrijetlo2SQ001 + podrijetlo3SQ001 + podrijetlo4SQ001 + podrijetlo5SQ001 + ozbiljnost1SQ001+ ozbiljnost2SQ001+ ozbiljnost3SQ001 LIJEC=~ lijecenje1SQ001 + lijecenje2SQ001 + lijecenje3SQ001 + lijecenje4SQ001 + lijecenje5SQ001 + lijecenje6SQ001 UB=~ a*PODR+ a*LIJEC #criterion PONASANJE =~ ponasanje1SQ001 + ponasanje2SQ001 + ponasanje3SQ001 + ponasanje4SQ001 #regressions UB~ acu*CRT+ asu*SCICUR+ aau*AOT+ afu*FI+ aanu*ANX znanje~ aczn*CRT+ aszn*SCICUR+ aazn*AOT+ afzn*FI+ aanzn*ANX zabrSQ001~ acza*CRT+ asza*SCICUR+ aaza*AOT+ afza*FI+ aanza*ANX PONASANJE~ bu*UB+ bzn*znanje+ bzab*zabrSQ001+ cc*CRT+ cs*SCICUR+ ca*AOT+ cf*FI+ can*ANX #covariances UB~~ znanje+ zabrSQ001 znanje~~ zabrSQ001 #indirect effects crtub := acu*bu aotub := aau*bu fiub := afu*bu anxzab := aanza*bzab ' fit.modelnc <- sem(modelnc, data = df1, estimator = "ML" , se = "boot", bootstrap = 5000 # ,missing="ML" # , parallel = "snow", ncpus= 3, verbose= T ) summary(fit.modelnc, fit.measures = TRUE, standardized = TRUE) parameterestimates(fit.modelnc, standardized = T, boot.ci.type = "bca.simple" , level = 0.95) %>% .[136:142,] inspect(fit.modelnc, 'rsquare') #model with control variables #rescaling age to equalize it's variance with other variables' variance df1$dobr<- (df1$dob)/10 model <- ' #predictors CRT =~ crttn1 + crttn2 + crttn3 AOT =~ aot1SQ001 + aot2SQ001 + aot4SQ001 + aot5r + aot6SQ001 + aot7r + aot8r + aot10SQ001 FI =~ fi1SQ001 + fi2SQ001 + fi3SQ001 + fi4SQ001 + fi5SQ001 SCICUR =~ scicur1SQ006 + scicur3SQ006 + scicur4SQ006 + scicur5SQ006 + scicur6SQ006 ANX =~ anx1SQ001 + anx2SQ001 + anx3SQ001 + anx4SQ001 #mediators PODR =~ podrijetlo1SQ001 + podrijetlo2SQ001 + podrijetlo3SQ001 + podrijetlo4SQ001 + podrijetlo5SQ001 + ozbiljnost1SQ001+ ozbiljnost2SQ001+ ozbiljnost3SQ001 LIJEC=~ lijecenje1SQ001 + lijecenje2SQ001 + lijecenje3SQ001 + lijecenje4SQ001 + lijecenje5SQ001 + lijecenje6SQ001 UB=~ a*PODR+ a*LIJEC #criterion PONASANJE =~ ponasanje1SQ001 + ponasanje2SQ001 + ponasanje3SQ001 + ponasanje4SQ001 #regressions UB~ acu*CRT+ asu*SCICUR+ aau*AOT+ afu*FI+ aanu*ANX znanje~ aczn*CRT+ aszn*SCICUR+ aazn*AOT+ afzn*FI+ aanzn*ANX zabrSQ001~ acza*CRT+ asza*SCICUR+ aaza*AOT+ afza*FI+ aanza*ANX PONASANJE~ bu*UB+ bzn*znanje+ bzab*zabrSQ001+ cc*CRT+ cs*SCICUR+ ca*AOT+ cf*FI+ can*ANX #control varibles (spol = sex, obrazovanje = education, #ideologijaSQ001 = political values UB~ spol+ dobr+ obrazovanje+ ideologijaSQ001 znanje~ spol+ dobr+ obrazovanje+ ideologijaSQ001 zabrSQ001~ spol+ dobr+ obrazovanje+ ideologijaSQ001 PONASANJE~ spol+ dobr+ obrazovanje+ ideologijaSQ001 #covariances UB~~ znanje+ zabrSQ001 znanje~~ zabrSQ001 #indirect effects crtub := acu*bu aotub := aau*bu fiub := afu*bu anxzab := aanza*bzab ' fit.model <- sem(model, data = df1, estimator = "ML" , se = "boot", bootstrap = 5000 # ,missing="ML" , parallel = "snow", ncpus= 3, verbose= T ) summary(fit.model, fit.measures = TRUE, standardized = TRUE) parameterestimates(fit.model, standardized = T, boot.ci.type = "bca.simple" , level = 0.99, rsquare = T) %>% .[c(46:84,162:168),] inspect(fit.model, 'rsquare')