Objective
To conduct an analysis inspired in the dataset and work of Awad and Aboud 2015.
Method: CB-SEM using R’s Lavaan Package, and the semPlots’s Package was used for visualisation. Inspired by Awad 2015’s data on attitudes toward the out-of-prescription use of antibiotics. Analysis originally conducted without the use of SEM.
Data: Awad AI, Aboud EA (2015) Knowledge, Attitude and Practice towards Antibiotic Use among the Public in Kuwait. PLOS ONE 10(2): e0117910. https://doi.org/10.1371/journal.pone.0117910
Data acquisition
from: Awad AI, Aboud EA (2015) Knowledge, Attitude and Practice towards Antibiotic Use among the Public in Kuwait. PLOS ONE 10(2): e0117910. https://doi.org/10.1371/journal.pone.0117910
data<-read_sav('Awad2015.SAV')
Structural equation analysis
The model after adjustments is presented as follows:
modelSEM<-"
Q16times~Atttitudes+doctors+knowledge+Q4education+Q7income
Atttitudes~doctors+knowledge+Q4education+Q7income
doctors~Q4education+Q7income
knowledge~Q4education+Q7income
Q4education~~Q7income
doctors~~knowledge
doctors=~Q22.1+Q22.3+Q22.6
Atttitudes=~Q21.1+Q21.2+Q21.3+Q21.4
knowledge=~Q20.3+Q20.5+Q20.6+Q20.8+Q20.9+Q20.10+Q20.12+Q20.13
Q20.5~~Q20.6
Q20.6~~Q20.9"
fit_SEM=sem(modelSEM,data)
summary(fit_SEM,fit.meas=TRUE)
## lavaan 0.6-12 ended normally after 109 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 50
##
## Number of observations 680
##
## Model Test User Model:
##
## Test statistic 374.500
## Degrees of freedom 121
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 1975.328
## Degrees of freedom 153
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.861
## Tucker-Lewis Index (TLI) 0.824
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -16465.776
## Loglikelihood unrestricted model (H1) NA
##
## Akaike (AIC) 33031.551
## Bayesian (BIC) 33257.656
## Sample-size adjusted Bayesian (BIC) 33098.900
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.056
## 90 Percent confidence interval - lower 0.049
## 90 Percent confidence interval - upper 0.062
## P-value RMSEA <= 0.05 0.076
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.058
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|)
## doctors =~
## Q22.1 1.000
## Q22.3 1.686 0.247 6.826 0.000
## Q22.6 0.932 0.100 9.328 0.000
## Atttitudes =~
## Q21.1 1.000
## Q21.2 1.174 0.085 13.777 0.000
## Q21.3 1.318 0.096 13.777 0.000
## Q21.4 0.665 0.075 8.859 0.000
## knowledge =~
## Q20.3 1.000
## Q20.5 2.296 0.918 2.501 0.012
## Q20.6 3.463 1.348 2.570 0.010
## Q20.8 4.661 1.790 2.603 0.009
## Q20.9 2.373 0.943 2.516 0.012
## Q20.10 2.583 1.018 2.537 0.011
## Q20.12 1.426 0.600 2.377 0.017
## Q20.13 3.213 1.253 2.564 0.010
##
## Regressions:
## Estimate Std.Err z-value P(>|z|)
## Q16times ~
## Atttitudes 0.886 0.124 7.132 0.000
## doctors 0.021 0.144 0.146 0.884
## knowledge 0.105 0.700 0.150 0.881
## Q4education -0.070 0.090 -0.781 0.435
## Q7income -0.067 0.096 -0.705 0.481
## Atttitudes ~
## doctors -0.003 0.060 -0.050 0.960
## knowledge 0.435 0.333 1.305 0.192
## Q4education -0.005 0.037 -0.139 0.890
## Q7income 0.032 0.040 0.813 0.416
## doctors ~
## Q4education 0.030 0.028 1.088 0.277
## Q7income -0.036 0.030 -1.190 0.234
## knowledge ~
## Q4education 0.033 0.014 2.302 0.021
## Q7income 0.008 0.008 0.941 0.347
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## Q4education ~~
## Q7income 0.187 0.027 6.910 0.000
## .doctors ~~
## .knowledge 0.005 0.004 1.252 0.211
## .Q20.5 ~~
## .Q20.6 0.086 0.028 3.055 0.002
## .Q20.6 ~~
## .Q20.9 -0.073 0.026 -2.805 0.005
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .Q22.1 1.126 0.072 15.582 0.000
## .Q22.3 0.161 0.110 1.466 0.143
## .Q22.6 0.726 0.052 14.043 0.000
## .Q21.1 1.052 0.064 16.529 0.000
## .Q21.2 0.387 0.039 9.971 0.000
## .Q21.3 0.393 0.046 8.514 0.000
## .Q21.4 1.105 0.063 17.655 0.000
## .Q20.3 1.150 0.063 18.328 0.000
## .Q20.5 0.624 0.036 17.130 0.000
## .Q20.6 0.621 0.041 15.279 0.000
## .Q20.8 0.307 0.035 8.860 0.000
## .Q20.9 0.582 0.034 16.927 0.000
## .Q20.10 0.595 0.035 16.954 0.000
## .Q20.12 0.537 0.030 17.950 0.000
## .Q20.13 0.651 0.040 16.301 0.000
## .Q16times 3.468 0.193 17.998 0.000
## Q4education 0.741 0.040 18.439 0.000
## Q7income 0.623 0.034 18.439 0.000
## .doctors 0.297 0.061 4.892 0.000
## .Atttitudes 0.502 0.068 7.391 0.000
## .knowledge 0.016 0.012 1.316 0.188
Adjusting the visualization
the semPlot package enable adjustment of coordinates for the nodes in the graph.
ly<-structure(c(-1, -1, -1, -0.3, -0.15, 0, 0.15, -1, -1, -1, -1,
-1, -1, -1, -1, 0.7, -0.9, -0.15, -0.5, 0.0172024219296872, -0.5,
-0.8, -0.633333333333333, -0.466666666666667, -0.3, -0.433333333333333,
-0.566666666666667, -0.7, -0.3, -0.133333333333333, 0.0333333333333332,
0.2, 0.366666666666666, 0.533333333333333, 0.7, 0.866666666666666,
-0.1, 1, 1.1, -0.6, 0.1, 0.4), .Dim = c(21L, 2L), .Dimnames = list(
NULL, c("X1", "X2")))
We also adjust the text to be present alongside the arrows. We extract the estimates from the parameter table, and generate the label with the estimates and the significance considering pvalue.
parTable<-parameterEstimates(fit_SEM,standardized=TRUE)%>%as.data.frame()
table2<-parTable[!parTable$lhs==parTable$rhs,]
table2$sig=ifelse(table2$pvalue<0.001,'***',
ifelse(table2$pvalue<0.01,'**',
ifelse(table2$pvalue<0.05,'*','')
)
)
b<-ifelse(table2$pvalue<=0.05,paste0(round(table2$std.all,3), table2$sig),"")
png(file='./4_Awad2015/Awad2015c.png',width=1200, height = 600)
s<-semPlot::semPaths(fit_SEM, layout=ly,
edgeLabels=b,
residuals=FALSE,
what='est',
whatLabels = "std",
shapeMan='rectangle',
sizeMan = 10, sizeMan2=2,
edge.label.cex = 0.5,label.cex=0.8,
curve=TRUE,
nCharNodes = 0,fade=FALSE,
shapeLat='ellipse',
sizeLat = 13,sizeLat2=4,
cut=0.3, cardinal=TRUE,cut=0.1)
dev.off()
## png
## 2