Loading Libraries
library(readr)
library(car)
library(lavaan)
library(semTools)
library(tidyr)
library(SmartEDA)
library(ltm)
library(mirt)
library(eRm)
library(sirt)
library(semPlot)
library(patchwork)
library(psych)
library(table1)
library(stringr)
Fechting and cleaning data
banco<- read_csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vTSdQO4_W_PDkHMai0wdm0-cek89CdZ5ds66_f7q365m8epYWXiuyW0NGYcNpMZF-Gw9Z2ke3XNC8bF/pub?gid=1299106176&single=true&output=csv")
banco<-banco[rowSums(is.na(banco))!= ncol(banco),]
banco<-as.data.frame(banco)
label<-names(banco)
names(banco)<-paste("q",seq_along(1:ncol(banco)),sep="")
dicionario<-as.data.frame(cbind(label,names(banco)))
banco$q2<-extract_numeric(banco$q2)
banco$age_years<-recode(banco$q2,"18:29='18-29';
30:44='30-44';
45:64='45-64';
65:hi='65 or more'")
banco<-banco[banco$q2>=18,]
#banco<-banco[,c(1:13,31:52)]
#banco<-banco[complete.cases(banco),]
names(banco)[2]<-"Age"
banco<-banco[!is.na(banco$Age),]
table1::label(banco$age_years)<-"Age (years)"
banco$q3<-as.factor(banco$q3)
banco<-banco[!banco$q3=='Não binário',]
banco$Gender<-recode(banco$q3,"'Feminino'='Female';'Masculino'='Male';else=NA")
table1::label(banco$Gender)<-"Gender"
banco<-banco[!is.na(banco$Gender),]
banco<-banco[!banco$q5=='Sem escolaridade formal',]
banco<-banco[!is.na(banco$q5),]
banco$Education<-recode(banco$q5,"'Ensino básico'='High school or less';'Ensino secundário'='High school or less';'Ensino superior'='College or university';NA=NA;else='Postgraduate'")
table1::label(banco$Education)<-"Education"
banco<-banco[!is.na(banco$q4),]
banco$Marital_status <- recode(banco$q4,"'Casado'='Married';'Separado'='Separated or widowed';'Viúvo (a)'='Separated or widowed';'União livre'='Free union';'Solteiro'='Single';else=NA")
table1::label(banco$Marital_status)<-"Marital status"
banco<-banco[!is.na(banco$q7),]
banco$Employed <- recode(banco$q7,"'Não'='No';'Sim'='Yes';else=NA")
table1::label(banco$Employed)<-"Employed"
#table1::table1(~age_years+Gender+Education+Marital_status+Employed,data=banco)
A total of 1003 of adults voluntarily participated in an online survey using snowball sampling strategy. The age of participantes was between 18 and 78 (M=35.0159521, SD=14.1081418,ME=30, IQR=23-46.
table1(~age_years+Gender+Education+Marital_status+Employed,data=banco)
|
Overall (N=1003) |
| age_years |
|
| 18-29 |
488 (48.7%) |
| 30-44 |
247 (24.6%) |
| 45-64 |
251 (25.0%) |
| 65 or more |
17 (1.7%) |
| Gender |
|
| Female |
715 (71.3%) |
| Male |
288 (28.7%) |
| Education |
|
| College or university |
599 (59.7%) |
| High school or less |
265 (26.4%) |
| Postgraduate |
139 (13.9%) |
| Marital_status |
|
| Free union |
37 (3.7%) |
| Married |
328 (32.7%) |
| Separated or widowed |
52 (5.2%) |
| Single |
586 (58.4%) |
| Employed |
|
| No |
171 (17.0%) |
| Yes |
832 (83.0%) |
Recoding Data for Exploratory Factor Analysis
for (i in c(14:19)){
banco[,i]<-as.ordered(recode(banco[,i],"'NUNCA'=1;'QUASE NUNCA'=2;'QUASE SEMPRE'=3;'SEMPRE'=4"))
banco[,i]<- ordered(banco[,i],levels = c(1,2,3,4),
labels = c("Never", "Almost Never", "Almost Always","Always"))
}
names(banco)[14:19]<-paste("item",seq_along(1:ncol(banco[14:19])),sep="")
data<-data.matrix(banco[,c("item1","item2","item3","item4","item5","item6")])
CorMat <- psych::polychoric(data)$rho
EFA of Fear of COVID-6 Scale
bartlett<-psych::cortest.bartlett(CorMat, n = nrow(data),diag=TRUE)
kmo <-psych::KMO(CorMat)
It was observed that the six items of Fear COVID-6 grouped a latent factor, Bartlett’s chi-square test 3571.53; df= 15; p< 0 and KMO = 0.88
parallel<-psych::fa.parallel(CorMat,n.obs = nrow(data), fm="uls", cor="poly",n.iter=5000, correct = T,quant =.99,error.bars = T,fa="fa",nfactors = 1)

## Parallel analysis suggests that the number of factors = 3 and the number of components = NA
EFArst <- psych::fa(as.matrix(CorMat),1,n.obs=nrow(data), rotate = "oblimin",fm = "uls", n.iter =5000, alpha = T,correct = T)
The communalities were observed between 0.45 and 0.753, and the factor loadings between 0.671and 0.868 Table2. A factor was retained, with an eigenvalue of 3.63 that explained 0.6% of the variance.
table<-cbind(as.character(dicionario$label[14:19]),round(t(t(EFArst$communalities)),3),round(t(t(EFArst$loadings[1:6])),3))
table<-as.data.frame(table)
names(table)<-c("Item","Communality","Loadings")
rownames(table)<-c("1","2","3","4","5","6")
table
| Me incomoda pensar na COVID 19? |
0.45 |
0.671 |
| Minhas mãos ficam suadas quando penso na COVID 19? |
0.59 |
0.768 |
| Tenho medo de perder a vida por COVID 19? |
0.479 |
0.692 |
| Quando vejo noticias e histórias sobre COVID 19 na TV, imprensa e nas redes sociais, fico nervoso ou ansioso? |
0.69 |
0.831 |
| Não consigo dormir porque me preocupa pegar COVID 19? |
0.664 |
0.815 |
| Meu coração acelera ou me dá palpitação quando penso em pegar COVID 19? |
0.753 |
0.868 |
CFA of Fear of COVID-5 Scale
Poor RMSEA indicators were observed of the fear the Fear of COVID-6 Scale (Table 3). Therefore, several models were tested, and the version without item 4 and an alternative version without item 1 presented the best performance.
6 itens version CFA
model<-'fear =~ item1 + item2 + item3 + item4 + item5 + item6'
fit<-cfa(model=model,data=banco,ordered=T,estimator="WLSMV",std.lv=T,missing="pairwise")
semPlot::semPaths(fit,what = "std",intercepts = F,thresholds = F)

summary(fit, fit.measures=TRUE,standardized=T,rsquare=T)
## lavaan 0.6-8 ended normally after 13 iterations
##
## Estimator DWLS
## Optimization method NLMINB
## Number of model parameters 24
##
## Number of observations 1003
## Number of missing patterns 1
##
## Model Test User Model:
## Standard Robust
## Test Statistic 56.774 106.312
## Degrees of freedom 9 9
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.537
## Shift parameter 0.630
## simple second-order correction
##
## Model Test Baseline Model:
##
## Test statistic 9894.814 6492.095
## Degrees of freedom 15 15
## P-value 0.000 0.000
## Scaling correction factor 1.525
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.995 0.985
## Tucker-Lewis Index (TLI) 0.992 0.975
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.073 0.104
## 90 Percent confidence interval - lower 0.055 0.087
## 90 Percent confidence interval - upper 0.091 0.122
## P-value RMSEA <= 0.05 0.017 0.000
##
## Robust RMSEA NA
## 90 Percent confidence interval - lower NA
## 90 Percent confidence interval - upper NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.044 0.044
##
## Parameter Estimates:
##
## Standard errors Robust.sem
## Information Expected
## Information saturated (h1) model Unstructured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## fear =~
## item1 0.698 0.021 32.629 0.000 0.698 0.698
## item2 0.777 0.019 40.764 0.000 0.777 0.777
## item3 0.696 0.020 34.429 0.000 0.696 0.696
## item4 0.825 0.016 53.077 0.000 0.825 0.825
## item5 0.830 0.016 51.220 0.000 0.830 0.830
## item6 0.866 0.012 69.983 0.000 0.866 0.866
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .item1 0.000 0.000 0.000
## .item2 0.000 0.000 0.000
## .item3 0.000 0.000 0.000
## .item4 0.000 0.000 0.000
## .item5 0.000 0.000 0.000
## .item6 0.000 0.000 0.000
## fear 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## item1|t1 -1.492 0.061 -24.616 0.000 -1.492 -1.492
## item1|t2 -0.585 0.042 -13.884 0.000 -0.585 -0.585
## item1|t3 0.576 0.042 13.699 0.000 0.576 0.576
## item2|t1 0.385 0.041 9.475 0.000 0.385 0.385
## item2|t2 1.218 0.052 23.262 0.000 1.218 1.218
## item2|t3 1.997 0.087 22.950 0.000 1.997 1.997
## item3|t1 -1.087 0.049 -22.007 0.000 -1.087 -1.087
## item3|t2 0.021 0.040 0.537 0.592 0.021 0.021
## item3|t3 0.686 0.043 15.895 0.000 0.686 0.686
## item4|t1 -1.157 0.051 -22.729 0.000 -1.157 -1.157
## item4|t2 -0.226 0.040 -5.645 0.000 -0.226 -0.226
## item4|t3 0.914 0.046 19.764 0.000 0.914 0.914
## item5|t1 0.223 0.040 5.582 0.000 0.223 0.223
## item5|t2 1.218 0.052 23.262 0.000 1.218 1.218
## item5|t3 2.410 0.129 18.749 0.000 2.410 2.410
## item6|t1 -0.119 0.040 -2.998 0.003 -0.119 -0.119
## item6|t2 0.680 0.043 15.775 0.000 0.680 0.680
## item6|t3 1.355 0.056 24.154 0.000 1.355 1.355
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .item1 0.513 0.513 0.513
## .item2 0.396 0.396 0.396
## .item3 0.516 0.516 0.516
## .item4 0.320 0.320 0.320
## .item5 0.311 0.311 0.311
## .item6 0.250 0.250 0.250
## fear 1.000 1.000 1.000
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## item1 1.000 1.000 1.000
## item2 1.000 1.000 1.000
## item3 1.000 1.000 1.000
## item4 1.000 1.000 1.000
## item5 1.000 1.000 1.000
## item6 1.000 1.000 1.000
##
## R-Square:
## Estimate
## item1 0.487
## item2 0.604
## item3 0.484
## item4 0.680
## item5 0.689
## item6 0.750
reliability(fit)
## fear
## alpha 0.8460142
## alpha.ord 0.8993477
## omega 0.8628753
## omega2 0.8628753
## omega3 0.8706404
## avevar 0.6157128
covid_6<-fit
modificationindices(covid_6,sort.=T)
| 47 |
item1 |
~~ |
item4 |
23.6914818 |
0.1405531 |
0.1405531 |
0.3467039 |
0.3467039 |
| 48 |
item1 |
~~ |
item5 |
18.2201907 |
-0.1536054 |
-0.1536054 |
-0.3844994 |
-0.3844994 |
| 49 |
item1 |
~~ |
item6 |
11.0801313 |
-0.1144683 |
-0.1144683 |
-0.3197878 |
-0.3197878 |
| 59 |
item5 |
~~ |
item6 |
9.8383714 |
0.0953755 |
0.0953755 |
0.3424793 |
0.3424793 |
| 46 |
item1 |
~~ |
item3 |
9.5085309 |
0.0920506 |
0.0920506 |
0.1787884 |
0.1787884 |
| 50 |
item2 |
~~ |
item3 |
6.3095129 |
-0.0938515 |
-0.0938515 |
-0.2076754 |
-0.2076754 |
| 58 |
item4 |
~~ |
item6 |
5.6796173 |
-0.0751210 |
-0.0751210 |
-0.2658202 |
-0.2658202 |
| 52 |
item2 |
~~ |
item5 |
3.6154689 |
0.0592323 |
0.0592323 |
0.1689193 |
0.1689193 |
| 45 |
item1 |
~~ |
item2 |
2.3101647 |
-0.0629946 |
-0.0629946 |
-0.1397664 |
-0.1397664 |
| 57 |
item4 |
~~ |
item5 |
1.6401961 |
-0.0426866 |
-0.0426866 |
-0.1353415 |
-0.1353415 |
| 56 |
item3 |
~~ |
item6 |
1.5591395 |
0.0392790 |
0.0392790 |
0.1094414 |
0.1094414 |
| 55 |
item3 |
~~ |
item5 |
1.2784053 |
-0.0397031 |
-0.0397031 |
-0.0991193 |
-0.0991193 |
| 54 |
item3 |
~~ |
item4 |
1.0319328 |
-0.0310094 |
-0.0310094 |
-0.0762880 |
-0.0762880 |
| 53 |
item2 |
~~ |
item6 |
0.4939344 |
0.0231117 |
0.0231117 |
0.0735597 |
0.0735597 |
| 51 |
item2 |
~~ |
item4 |
0.0162993 |
0.0042637 |
0.0042637 |
0.0119823 |
0.0119823 |
5 itens version CFA (Colombian version without item four)
model<-'fear =~ item1 + item2 + item3 + item5 + item6'
fit<-cfa(model=model,data=banco,ordered=T,estimator="WLSMV",std.lv=T,missing="pairwise")
semPlot::semPaths(fit,what = "std",intercepts = F,thresholds = F)

summary(fit, fit.measures=TRUE,standardized=T,rsquare=T)
## lavaan 0.6-8 ended normally after 12 iterations
##
## Estimator DWLS
## Optimization method NLMINB
## Number of model parameters 20
##
## Number of observations 1003
## Number of missing patterns 1
##
## Model Test User Model:
## Standard Robust
## Test Statistic 31.322 57.076
## Degrees of freedom 5 5
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.552
## Shift parameter 0.323
## simple second-order correction
##
## Model Test Baseline Model:
##
## Test statistic 6023.106 4353.789
## Degrees of freedom 10 10
## P-value 0.000 0.000
## Scaling correction factor 1.384
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.996 0.988
## Tucker-Lewis Index (TLI) 0.991 0.976
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.072 0.102
## 90 Percent confidence interval - lower 0.049 0.079
## 90 Percent confidence interval - upper 0.098 0.127
## P-value RMSEA <= 0.05 0.054 0.000
##
## Robust RMSEA NA
## 90 Percent confidence interval - lower NA
## 90 Percent confidence interval - upper NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.040 0.040
##
## Parameter Estimates:
##
## Standard errors Robust.sem
## Information Expected
## Information saturated (h1) model Unstructured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## fear =~
## item1 0.642 0.025 26.017 0.000 0.642 0.642
## item2 0.772 0.020 37.872 0.000 0.772 0.772
## item3 0.708 0.022 32.638 0.000 0.708 0.708
## item5 0.836 0.016 50.890 0.000 0.836 0.836
## item6 0.886 0.013 69.514 0.000 0.886 0.886
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .item1 0.000 0.000 0.000
## .item2 0.000 0.000 0.000
## .item3 0.000 0.000 0.000
## .item5 0.000 0.000 0.000
## .item6 0.000 0.000 0.000
## fear 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## item1|t1 -1.492 0.061 -24.616 0.000 -1.492 -1.492
## item1|t2 -0.585 0.042 -13.884 0.000 -0.585 -0.585
## item1|t3 0.576 0.042 13.699 0.000 0.576 0.576
## item2|t1 0.385 0.041 9.475 0.000 0.385 0.385
## item2|t2 1.218 0.052 23.262 0.000 1.218 1.218
## item2|t3 1.997 0.087 22.950 0.000 1.997 1.997
## item3|t1 -1.087 0.049 -22.007 0.000 -1.087 -1.087
## item3|t2 0.021 0.040 0.537 0.592 0.021 0.021
## item3|t3 0.686 0.043 15.895 0.000 0.686 0.686
## item5|t1 0.223 0.040 5.582 0.000 0.223 0.223
## item5|t2 1.218 0.052 23.262 0.000 1.218 1.218
## item5|t3 2.410 0.129 18.749 0.000 2.410 2.410
## item6|t1 -0.119 0.040 -2.998 0.003 -0.119 -0.119
## item6|t2 0.680 0.043 15.775 0.000 0.680 0.680
## item6|t3 1.355 0.056 24.154 0.000 1.355 1.355
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .item1 0.587 0.587 0.587
## .item2 0.404 0.404 0.404
## .item3 0.499 0.499 0.499
## .item5 0.301 0.301 0.301
## .item6 0.216 0.216 0.216
## fear 1.000 1.000 1.000
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## item1 1.000 1.000 1.000
## item2 1.000 1.000 1.000
## item3 1.000 1.000 1.000
## item5 1.000 1.000 1.000
## item6 1.000 1.000 1.000
##
## R-Square:
## Estimate
## item1 0.413
## item2 0.596
## item3 0.501
## item5 0.699
## item6 0.784
reliability(fit)
## fear
## alpha 0.8075920
## alpha.ord 0.8730222
## omega 0.8293154
## omega2 0.8293154
## omega3 0.8349924
## avevar 0.5986168
colombia_covid_5<-fit
modificationindices(colombia_covid_5,sort.=T)
| 39 |
item1 |
~~ |
item3 |
24.8825204 |
0.1605900 |
0.1605900 |
0.2967631 |
0.2967631 |
| 42 |
item2 |
~~ |
item3 |
8.2951318 |
-0.1140820 |
-0.1140820 |
-0.2541645 |
-0.2541645 |
| 40 |
item1 |
~~ |
item5 |
8.2137881 |
-0.1112556 |
-0.1112556 |
-0.2645145 |
-0.2645145 |
| 43 |
item2 |
~~ |
item5 |
5.2507697 |
0.0857526 |
0.0857526 |
0.2457993 |
0.2457993 |
| 41 |
item1 |
~~ |
item6 |
3.9094398 |
-0.0764376 |
-0.0764376 |
-0.2147444 |
-0.2147444 |
| 45 |
item3 |
~~ |
item5 |
3.6280484 |
-0.0744081 |
-0.0744081 |
-0.1920144 |
-0.1920144 |
| 47 |
item5 |
~~ |
item6 |
2.6587197 |
0.0678838 |
0.0678838 |
0.2663200 |
0.2663200 |
| 38 |
item1 |
~~ |
item2 |
0.0226356 |
-0.0064510 |
-0.0064510 |
-0.0132416 |
-0.0132416 |
| 44 |
item2 |
~~ |
item6 |
0.0138000 |
0.0047803 |
0.0047803 |
0.0161910 |
0.0161910 |
| 46 |
item3 |
~~ |
item6 |
0.0124718 |
-0.0041781 |
-0.0041781 |
-0.0127404 |
-0.0127404 |
5 itens version CFA (Brazil without item one)
model<-'fear =~ item2 + item3 + item4 + item5 + item6'
fit<-cfa(model=model,data=banco,ordered=T,estimator="WLSMV",std.lv=T,missing="pairwise")
semPlot::semPaths(fit,what = "std",intercepts = F,thresholds = F)

summary(fit, fit.measures=TRUE,standardized=T,rsquare=T)
## lavaan 0.6-8 ended normally after 15 iterations
##
## Estimator DWLS
## Optimization method NLMINB
## Number of model parameters 20
##
## Number of observations 1003
## Number of missing patterns 1
##
## Model Test User Model:
## Standard Robust
## Test Statistic 8.446 17.391
## Degrees of freedom 5 5
## P-value (Chi-square) 0.133 0.004
## Scaling correction factor 0.491
## Shift parameter 0.194
## simple second-order correction
##
## Model Test Baseline Model:
##
## Test statistic 7616.791 5238.186
## Degrees of freedom 10 10
## P-value 0.000 0.000
## Scaling correction factor 1.455
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000 0.998
## Tucker-Lewis Index (TLI) 0.999 0.995
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.026 0.050
## 90 Percent confidence interval - lower 0.000 0.026
## 90 Percent confidence interval - upper 0.056 0.076
## P-value RMSEA <= 0.05 0.897 0.458
##
## Robust RMSEA NA
## 90 Percent confidence interval - lower NA
## 90 Percent confidence interval - upper NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.021 0.021
##
## Parameter Estimates:
##
## Standard errors Robust.sem
## Information Expected
## Information saturated (h1) model Unstructured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## fear =~
## item2 0.782 0.019 40.985 0.000 0.782 0.782
## item3 0.678 0.022 31.192 0.000 0.678 0.678
## item4 0.791 0.017 46.345 0.000 0.791 0.791
## item5 0.847 0.016 51.671 0.000 0.847 0.847
## item6 0.884 0.012 71.823 0.000 0.884 0.884
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .item2 0.000 0.000 0.000
## .item3 0.000 0.000 0.000
## .item4 0.000 0.000 0.000
## .item5 0.000 0.000 0.000
## .item6 0.000 0.000 0.000
## fear 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## item2|t1 0.385 0.041 9.475 0.000 0.385 0.385
## item2|t2 1.218 0.052 23.262 0.000 1.218 1.218
## item2|t3 1.997 0.087 22.950 0.000 1.997 1.997
## item3|t1 -1.087 0.049 -22.007 0.000 -1.087 -1.087
## item3|t2 0.021 0.040 0.537 0.592 0.021 0.021
## item3|t3 0.686 0.043 15.895 0.000 0.686 0.686
## item4|t1 -1.157 0.051 -22.729 0.000 -1.157 -1.157
## item4|t2 -0.226 0.040 -5.645 0.000 -0.226 -0.226
## item4|t3 0.914 0.046 19.764 0.000 0.914 0.914
## item5|t1 0.223 0.040 5.582 0.000 0.223 0.223
## item5|t2 1.218 0.052 23.262 0.000 1.218 1.218
## item5|t3 2.410 0.129 18.749 0.000 2.410 2.410
## item6|t1 -0.119 0.040 -2.998 0.003 -0.119 -0.119
## item6|t2 0.680 0.043 15.775 0.000 0.680 0.680
## item6|t3 1.355 0.056 24.154 0.000 1.355 1.355
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .item2 0.388 0.388 0.388
## .item3 0.541 0.541 0.541
## .item4 0.374 0.374 0.374
## .item5 0.283 0.283 0.283
## .item6 0.219 0.219 0.219
## fear 1.000 1.000 1.000
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## item2 1.000 1.000 1.000
## item3 1.000 1.000 1.000
## item4 1.000 1.000 1.000
## item5 1.000 1.000 1.000
## item6 1.000 1.000 1.000
##
## R-Square:
## Estimate
## item2 0.612
## item3 0.459
## item4 0.626
## item5 0.717
## item6 0.781
reliability(fit)
## fear
## alpha 0.8323451
## alpha.ord 0.8946955
## omega 0.8493197
## omega2 0.8493197
## omega3 0.8513557
## avevar 0.6392464
brazil_covid_5<-fit
4 itens version CFA (Colombian version without item four)
model<-'fear =~ item2 + item3 + item5 + item6
'
fit<-cfa(model=model,data=banco,ordered=T,estimator="WLSMV",std.lv=T,missing="pairwise")
semPlot::semPaths(fit,what = "std",intercepts = F,thresholds = F)

summary(fit, fit.measures=TRUE,standardized=T,rsquare=T)
## lavaan 0.6-8 ended normally after 10 iterations
##
## Estimator DWLS
## Optimization method NLMINB
## Number of model parameters 16
##
## Number of observations 1003
## Number of missing patterns 1
##
## Model Test User Model:
## Standard Robust
## Test Statistic 4.666 10.247
## Degrees of freedom 2 2
## P-value (Chi-square) 0.097 0.006
## Scaling correction factor 0.457
## Shift parameter 0.045
## simple second-order correction
##
## Model Test Baseline Model:
##
## Test statistic 4747.807 3610.076
## Degrees of freedom 6 6
## P-value 0.000 0.000
## Scaling correction factor 1.316
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.999 0.998
## Tucker-Lewis Index (TLI) 0.998 0.993
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.036 0.064
## 90 Percent confidence interval - lower 0.000 0.029
## 90 Percent confidence interval - upper 0.081 0.105
## P-value RMSEA <= 0.05 0.623 0.220
##
## Robust RMSEA NA
## 90 Percent confidence interval - lower NA
## 90 Percent confidence interval - upper NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.019 0.019
##
## Parameter Estimates:
##
## Standard errors Robust.sem
## Information Expected
## Information saturated (h1) model Unstructured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## fear =~
## item2 0.770 0.021 36.930 0.000 0.770 0.770
## item3 0.664 0.024 27.538 0.000 0.664 0.664
## item5 0.848 0.017 49.901 0.000 0.848 0.848
## item6 0.899 0.013 67.611 0.000 0.899 0.899
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .item2 0.000 0.000 0.000
## .item3 0.000 0.000 0.000
## .item5 0.000 0.000 0.000
## .item6 0.000 0.000 0.000
## fear 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## item2|t1 0.385 0.041 9.475 0.000 0.385 0.385
## item2|t2 1.218 0.052 23.262 0.000 1.218 1.218
## item2|t3 1.997 0.087 22.950 0.000 1.997 1.997
## item3|t1 -1.087 0.049 -22.007 0.000 -1.087 -1.087
## item3|t2 0.021 0.040 0.537 0.592 0.021 0.021
## item3|t3 0.686 0.043 15.895 0.000 0.686 0.686
## item5|t1 0.223 0.040 5.582 0.000 0.223 0.223
## item5|t2 1.218 0.052 23.262 0.000 1.218 1.218
## item5|t3 2.410 0.129 18.749 0.000 2.410 2.410
## item6|t1 -0.119 0.040 -2.998 0.003 -0.119 -0.119
## item6|t2 0.680 0.043 15.775 0.000 0.680 0.680
## item6|t3 1.355 0.056 24.154 0.000 1.355 1.355
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .item2 0.407 0.407 0.407
## .item3 0.559 0.559 0.559
## .item5 0.281 0.281 0.281
## .item6 0.192 0.192 0.192
## fear 1.000 1.000 1.000
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## item2 1.000 1.000 1.000
## item3 1.000 1.000 1.000
## item5 1.000 1.000 1.000
## item6 1.000 1.000 1.000
##
## R-Square:
## Estimate
## item2 0.593
## item3 0.441
## item5 0.719
## item6 0.808
reliability(fit)
## fear
## alpha 0.7953606
## alpha.ord 0.8700510
## omega 0.8169518
## omega2 0.8169518
## omega3 0.8188032
## avevar 0.6402931
reduced_covid_4<-fit
f.covid_6<-round(fitmeasures(covid_6),2)
f.covid_6cor1_4<-round(fitmeasures(covid_6cor1_4),2)
f.colombia_covid_5<-round(fitmeasures(colombia_covid_5),2)
f.colombia_covid_5cor1_3<-round(fitmeasures(colombia_covid_5cor1_3),2)
f.reduced_covid_4<-round(fitmeasures(reduced_covid_4),2)
f.brazil_covid_5<-round(fitmeasures(brazil_covid_5),2)
table.fit<-cbind(f.covid_6,f.covid_6cor1_4,f.brazil_covid_5,f.colombia_covid_5,f.colombia_covid_5cor1_3,f.reduced_covid_4)
names(table.fit)<-c("covid_6","covid_6cor1_4","brazil_covid_5","colombia_covid_5","colombia_covid_5cor1_3","reduced_covid_4")
r.covid_6<-round(reliability(covid_6),2)
r.covid_6cor1_4<-round(reliability(covid_6cor1_4),2)
r.colombia_covid_5<-round(reliability(colombia_covid_5),2)
r.colombia_covid_5cor1_3<-round(reliability(colombia_covid_5cor1_3),2)
r.reduced_covid_4<-round(reliability(reduced_covid_4),2)
r.brazil_covid_5<-round(reliability(brazil_covid_5),2)
table.reliability<-cbind(r.covid_6,r.covid_6cor1_4,r.brazil_covid_5,r.colombia_covid_5,r.colombia_covid_5cor1_3,r.reduced_covid_4)
names(table.reliability)<-c("covid_6","covid_6cor1_4","brazil_covid_5","colombia_covid_5","colombia_covid_5cor1_3","reduced_covid_4")
table.fit<-rbind(table.fit,table.reliability)
table.fit<-as.data.frame(t(table.fit))
table.fit$X2dfp<-paste(table.fit$chisq.scaled," (",table.fit$df.scaled,")", "[",table.fit$pvalue.scaled,"]",sep="")
table.fit$X2dfp<-stringr::str_replace(table.fit$X2dfp,fixed("[0]"),"[<0,01]")
table.fit$X2bydf<-round((table.fit$chisq.scaled/table.fit$df.scaled),2)
table.fit$rmseaIC90p<- paste(table.fit$rmsea.scaled," (",table.fit$rmsea.ci.lower.scaled,"-",table.fit$rmsea.ci.upper.scaled,")", " [",table.fit$rmsea.pvalue.scaled,"]",sep="")
table.fit$rmseaIC90p<-stringr::str_replace(table.fit$rmseaIC90p,fixed("[0]"), "[<0,01]")
table3<-table.fit[,c(68,69,70,25,26,51,63,64,67)]
table3<-as.data.frame(t(table3))
names(table3)<-c("Fear of COVID-6", "Fear of COVID-6 (itens 1 and 4 correlated)","Fear of COVID-5 Brazil (item 1 excluded)","Fear of COVID-5 Colombia (item 4 excluded)", "Fear of COVID-5 Colombia (item 4 excluded and itens 1 and 3 correlated)","Fear of COVID-4 reduced (item 1 and 4 excluded)")
rownames(table3)<-c("Xˆ2(df) [p]", "Xˆ2/df","RMSEA (IC90%) [p]","CFI scaled","TLI scaled","SRMR Bentler","Cronbach's alpha","McDonald's omega","Average Extracted Variance")
table3
| Xˆ2(df) [p] |
0.62 |
0.60 |
0.64 |
0.60 |
0.58 |
0.64 |
| Xˆ2/df |
106.31 (9)[<0,01] |
63.19 (8)[<0,01] |
17.39 (5)[<0,01] |
57.08 (5)[<0,01] |
13.57 (4)[0.01] |
10.25 (2)[0.01] |
| RMSEA (IC90%) [p] |
11.81 |
7.90 |
3.48 |
11.42 |
3.39 |
5.12 |
| CFI scaled |
0.98 |
0.99 |
1.00 |
0.99 |
1.00 |
1.00 |
| TLI scaled |
0.97 |
0.98 |
1.00 |
0.98 |
0.99 |
0.99 |
| SRMR Bentler |
0.04 |
0.03 |
0.02 |
0.03 |
0.02 |
0.02 |
| Cronbach’s alpha |
0.85 |
0.85 |
0.83 |
0.81 |
0.81 |
0.80 |
| McDonald’s omega |
0.90 |
0.90 |
0.89 |
0.87 |
0.87 |
0.87 |
| Average Extracted Variance |
0.87 |
0.85 |
0.85 |
0.83 |
0.80 |
0.82 |
6 itens version CFA Gender Invariance
model<-'fear =~ item6 + item2 + item3 + item4 + item5'
fit.invaricance<-semTools::measurementInvarianceCat(model=model,data=banco,ordered=T,estimator="WLSMV",group="Gender",parameterization="theta",missing="pairwise",std.lv=F,strict=T)
##
## Measurement invariance models:
##
## Model 1 : fit.configural
## Model 2 : fit.loadings
## Model 3 : fit.thresholds
## Model 4 : fit.residuals
## Model 5 : fit.means
##
## Scaled Chi-Squared Difference Test (method = "satorra.2000")
##
## lavaan NOTE:
## The "Chisq" column contains standard test statistics, not the
## robust test that should be reported per model. A robust difference
## test is a function of two standard (not robust) statistics.
##
## Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
## fit.configural 10 10.222
## fit.loadings 14 12.500 3.9002 4 0.41968
## fit.thresholds 23 22.643 11.3379 9 0.25326
## fit.residuals 28 32.704 11.0052 5 0.05128 .
## fit.means 29 207.146 28.6595 1 8.629e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
##
## Fit measures:
##
## cfi.scaled rmsea.scaled cfi.scaled.delta rmsea.scaled.delta
## fit.configural 0.998 0.047 NA NA
## fit.loadings 0.998 0.040 0.000 0.008
## fit.thresholds 0.997 0.035 0.001 0.005
## fit.residuals 0.995 0.041 0.002 0.006
## fit.means 0.958 0.120 0.037 0.079
Final Theresholds Model
semPlot::semPaths(fit.invaricance$fit.thresholds,what = "std",intercepts = F,thresholds = F)


Fit Indices
fit.configural<-t(as.data.frame(round(fitmeasures(fit.invaricance$fit.configural),3)))
fit.loadings<-t(as.data.frame(round(fitmeasures(fit.invaricance$fit.loadings),3)))
fit.thresholds<-t(as.data.frame(round(fitmeasures(fit.invaricance$fit.thresholds),3)))
fit.means<-t(as.data.frame(round(fitmeasures(fit.invaricance$fit.means),3)))
invariance<-as.data.frame(t(rbind(fit.configural,fit.loadings,fit.thresholds,fit.means)))
names(invariance)<-c("configural","loadings","thresholds","means")
rel.configural<-reliability(fit.invaricance$fit.configural)
rel.configural$Male<-round(rel.configural$Male,2)
rel.configural$Female<-round(rel.configural$Female,2)
alpha<-paste(rel.configural$Male[1]," - ", rel.configural$Female[1],sep="")
omega<-paste(rel.configural$Male[2]," - ", rel.configural$Female[2],sep="")
avevar<-paste(rel.configural$Male[5]," - ", rel.configural$Female[5],sep="")
configural<-as.data.frame(cbind(alpha,omega,avevar))
names(configural)<-c("Cronbach's alpha","McDonald's omega","Average Extracted Variance")
rownames(configural)<-"configural"
rel.loadings<-reliability(fit.invaricance$fit.loadings)
rel.loadings$Male<-round(rel.loadings$Male,2)
rel.loadings$Female<-round(rel.loadings$Female,2)
alpha<-paste(rel.loadings$Male[1]," - ", rel.loadings$Female[1],sep="")
omega<-paste(rel.loadings$Male[2]," - ", rel.loadings$Female[2],sep="")
avevar<-paste(rel.loadings$Male[5]," - ", rel.loadings$Female[5],sep="")
loadings<-as.data.frame(cbind(alpha,omega,avevar))
names(loadings)<-c("Cronbach's alpha","McDonald's omega","Average Extracted Variance")
rownames(loadings)<-"loadings"
rel.thresholds<-reliability(fit.invaricance$fit.thresholds)
rel.thresholds$Male<-round(rel.thresholds$Male,2)
rel.thresholds$Female<-round(rel.thresholds$Female,2)
alpha<-paste(rel.thresholds$Male[1]," - ", rel.thresholds$Female[1],sep="")
omega<-paste(rel.thresholds$Male[2]," - ", rel.thresholds$Female[2],sep="")
avevar<-paste(rel.thresholds$Male[5]," - ", rel.thresholds$Female[5],sep="")
thresholds<-as.data.frame(cbind(alpha,omega,avevar))
names(thresholds)<-c("Cronbach's alpha","McDonald's omega","Average Extracted Variance")
rownames(thresholds)<-"thresholds"
rel.means<-reliability(fit.invaricance$fit.means)
rel.means$Male<-round(rel.means$Male,2)
rel.means$Female<-round(rel.means$Female,2)
alpha<-paste(rel.means$Male[1]," - ", rel.means$Female[1],sep="")
omega<-paste(rel.means$Male[2]," - ", rel.means$Female[2],sep="")
avevar<-paste(rel.means$Male[5]," - ", rel.means$Female[5],sep="")
means<-as.data.frame(cbind(alpha,omega,avevar))
names(means)<-c("Cronbach's alpha","McDonald's omega","Average Extracted Variance")
rownames(means)<-"means"
reliability<-as.data.frame(t(rbind(configural,loadings,thresholds,means)))
invariance<-rbind(invariance,reliability)
invariance<-data.frame(t(invariance))
invariance$X2dfp<-paste(invariance$chisq," (",invariance$df,")", "[",invariance$pvalue,"]",sep="")
invariance$X2dfp<-stringr::str_replace(invariance$X2dfp,fixed("[0]"),"[<0,01]")
invariance$X2bydf<-round((as.numeric(invariance$chisq)/as.numeric(invariance$df)),2)
invariance$rmseaIC90p<- paste(invariance$rmsea.scaled," (",invariance$rmsea.ci.lower.scaled,"-",invariance$rmsea.ci.upper.scaled,")", " [",invariance$rmsea.pvalue.scaled,"]",sep="")
invariance$rmseaIC90p<-stringr::str_replace(invariance$rmseaIC90p,fixed("[0]"), "[<0,01]")
table4<-invariance[,c(66,67,68,25,26,51,63,64,65)]
table4<-as.data.frame(t(table4))
rownames(table4)<-c("Xˆ2(df) [p]", "Xˆ2/df","RMSEA (IC90%) [p]","CFI scaled","TLI scaled","SRMR Bentler","Cronbach's alpha (Male - Female)","McDonald's omega (Male - Female)","Average Extracted Variance (Male - Female)")
table4
| Xˆ2(df) [p] |
10.222 (10)[0.421] |
12.5 (14)[0.566] |
22.643 (23)[0.482] |
207.146 (29)[<0,01] |
| Xˆ2/df |
1.00 |
1.00 |
1.33 |
0.75 |
| RMSEA (IC90%) [p] |
0.047 (0.018-0.076) [0.516] |
0.04 (0.011-0.065) [0.724] |
0.035 (0.01-0.055) [0.887] |
0.12 (0.106-0.134) [<0,01] |
| CFI scaled |
0.998 |
0.998 |
0.997 |
0.958 |
| TLI scaled |
0.995 |
0.997 |
0.998 |
0.971 |
| SRMR Bentler |
0.256 |
0.244 |
0.265 |
0.026 |
| Cronbach’s alpha (Male - Female) |
0.81 - 0.83 |
0.81 - 0.83 |
0.81 - 0.83 |
0.81 - 0.83 |
| McDonald’s omega (Male - Female) |
0.89 - 0.89 |
0.89 - 0.89 |
0.89 - 0.89 |
0.89 - 0.89 |
| Average Extracted Variance (Male - Female) |
0.83 - 0.84 |
0.83 - 0.84 |
0.83 - 0.84 |
0.81 - 0.86 |
Partial Latent Mean Invariance
fit_partial<-semTools::partialInvarianceCat(fit.invaricance,type="means")
fit_partial
## $estimates
## poolest mean:Male mean:Female std:Male std:Female
## fear~1 0 0 0.9037853 0 0.4824995
## diff_std:Female vs. Male
## fear~1 0.4824995
##
## $results
## free.chi free.df free.p free.cfi fix.chi fix.df fix.p
## fear~1 21.32791 1 3.870553e-06 -0.02397026 21.32791 1 3.870553e-06
## fix.cfi wald.chi wald.df wald.p
## fear~1 -0.02397026 NA NA NA
mean_sd<-as.data.frame(round(fit_partial$estimates,2))
stats<-as.data.frame(round(fit_partial$results,4))
mean<-cbind(mean_sd$`mean:Male`,mean_sd$`mean:Female`)
sd<-cbind(mean_sd$`std:Male`,mean_sd$`std:Female`)
stat<-cbind(paste("Delta CFI= ",stats$fix.cfi,sep=""),paste("Xˆ2(df)= ",stats$fix.chi," (",stats$fix.df,"); ","p<0,001",sep=""))
table5<-as.data.frame(rbind(mean,sd,stat))
names(table5)<-c("Male","Female")
rownames(table5)<-c("Mean","Standard Deviation","Diff. Test")
table5
| Mean |
0 |
0.9 |
| Standard Deviation |
0 |
0.48 |
| Diff. Test |
Delta CFI= -0.024 |
Xˆ2(df)= 21.3279 (1); p<0,001 |
6 itens version CFA MIMIC AGE
model<-'Fear =~ item6 + item2 + item3 + item4 + item5
item2 + item3 + item4 + item5 + item6 ~ Age
'
fit<-cfa(model=model,data=banco,ordered=T,estimator="WLSMV",std.lv=T,missing="pairwise",orthogonal=T)
semPlot::semPaths(fit,what = "std",intercepts = F,thresholds = F)

summary(fit, fit.measures=TRUE,standardized=T,rsquare=T)
## lavaan 0.6-8 ended normally after 39 iterations
##
## Estimator DWLS
## Optimization method NLMINB
## Number of model parameters 25
##
## Number of observations 1003
## Number of missing patterns 1
##
## Model Test User Model:
## Standard Robust
## Test Statistic 8.095 16.720
## Degrees of freedom 5 5
## P-value (Chi-square) 0.151 0.005
## Scaling correction factor 0.490
## Shift parameter 0.191
## simple second-order correction
##
## Model Test Baseline Model:
##
## Test statistic 7761.484 5322.273
## Degrees of freedom 10 10
## P-value 0.000 0.000
## Scaling correction factor 1.459
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000 0.998
## Tucker-Lewis Index (TLI) 0.999 0.996
##
## Robust Comparative Fit Index (CFI) NA
## Robust Tucker-Lewis Index (TLI) NA
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.025 0.048
## 90 Percent confidence interval - lower 0.000 0.024
## 90 Percent confidence interval - upper 0.055 0.075
## P-value RMSEA <= 0.05 0.909 0.492
##
## Robust RMSEA NA
## 90 Percent confidence interval - lower NA
## 90 Percent confidence interval - upper NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.020 0.020
##
## Parameter Estimates:
##
## Standard errors Robust.sem
## Information Expected
## Information saturated (h1) model Unstructured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Fear =~
## item6 0.883 0.012 71.542 0.000 0.883 0.883
## item2 0.784 0.019 40.840 0.000 0.784 0.781
## item3 0.686 0.021 32.173 0.000 0.686 0.685
## item4 0.791 0.017 47.022 0.000 0.791 0.788
## item5 0.847 0.016 52.166 0.000 0.847 0.847
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## item2 ~
## Age -0.006 0.003 -2.283 0.022 -0.006 -0.088
## item3 ~
## Age 0.004 0.002 1.736 0.083 0.004 0.058
## item4 ~
## Age -0.006 0.002 -2.472 0.013 -0.006 -0.081
## item5 ~
## Age -0.001 0.003 -0.233 0.816 -0.001 -0.009
## item6 ~
## Age -0.002 0.002 -0.979 0.327 -0.002 -0.034
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .item6 0.000 0.000 0.000
## .item2 0.000 0.000 0.000
## .item3 0.000 0.000 0.000
## .item4 0.000 0.000 0.000
## .item5 0.000 0.000 0.000
## Fear 0.000 0.000 0.000
##
## Thresholds:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## item6|t1 -0.203 0.094 -2.153 0.031 -0.203 -0.203
## item6|t2 0.597 0.095 6.272 0.000 0.597 0.596
## item6|t3 1.272 0.104 12.285 0.000 1.272 1.271
## item2|t1 0.168 0.104 1.610 0.107 0.168 0.168
## item2|t2 1.003 0.113 8.840 0.000 1.003 0.999
## item2|t3 1.779 0.139 12.791 0.000 1.779 1.772
## item3|t1 -0.944 0.100 -9.483 0.000 -0.944 -0.943
## item3|t2 0.165 0.093 1.771 0.077 0.165 0.165
## item3|t3 0.832 0.095 8.721 0.000 0.832 0.831
## item4|t1 -1.363 0.101 -13.537 0.000 -1.363 -1.359
## item4|t2 -0.427 0.093 -4.605 0.000 -0.427 -0.425
## item4|t3 0.715 0.095 7.489 0.000 0.715 0.712
## item5|t1 0.201 0.102 1.983 0.047 0.201 0.201
## item5|t2 1.196 0.109 10.938 0.000 1.196 1.196
## item5|t3 2.388 0.170 14.076 0.000 2.388 2.388
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .item6 0.220 0.220 0.220
## .item2 0.386 0.386 0.383
## .item3 0.529 0.529 0.527
## .item4 0.375 0.375 0.372
## .item5 0.282 0.282 0.282
## Fear 1.000 1.000 1.000
##
## Scales y*:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## item6 1.000 1.000 1.000
## item2 1.000 1.000 1.000
## item3 1.000 1.000 1.000
## item4 1.000 1.000 1.000
## item5 1.000 1.000 1.000
##
## R-Square:
## Estimate
## item6 0.780
## item2 0.617
## item3 0.473
## item4 0.628
## item5 0.718
mimic_age<-fit
Fit Indices MIMIC Model
f.mimic_age<-round(fitmeasures(mimic_age),3)
f.mimic_age<-as.data.frame(f.mimic_age)
names(f.mimic_age)<-"Values"
f2.mimic_age<-as.data.frame(t(f.mimic_age))
table.fit<-f2.mimic_age
table.fit$X2dfp<-paste(table.fit$chisq.scaled," (",table.fit$df.scaled,")", "[",table.fit$pvalue.scaled,"]",sep="")
table.fit$X2dfp<-stringr::str_replace(table.fit$X2dfp,stringr::fixed("[0]"),"[<0,01]")
table.fit$X2bydf<-round((table.fit$chisq.scaled/table.fit$df.scaled),2)
table.fit$rmseaIC90p<- paste(table.fit$rmsea.scaled," (",table.fit$rmsea.ci.lower.scaled,"-",table.fit$rmsea.ci.upper.scaled,")", " [",table.fit$rmsea.pvalue.scaled,"]",sep="")
table.fit$rmseaIC90p<-stringr::str_replace(table.fit$rmseaIC90p,stringr::fixed("[0]"), "[<0,01]")
table4<-table.fit[,c(63,64,65,25,26,51)]
table4<-as.data.frame(t(table4))
names(table4)<-c("MIMIC Model")
rownames(table4)<-c("Xˆ2(df) [p]", "Xˆ2/df","RMSEA (IC90%) [p]","CFI scaled","TLI scaled","SRMR Bentler")
table4
| Xˆ2(df) [p] |
16.72 (5)[0.005] |
| Xˆ2/df |
3.34 |
| RMSEA (IC90%) [p] |
0.048 (0.024-0.075) [0.492] |
| CFI scaled |
0.998 |
| TLI scaled |
0.996 |
| SRMR Bentler |
0.018 |
MIMIC Parameters
parameters<-lavaan::parameterestimates(mimic_age,standardized = T)
parameters<-parameters[(parameters$op=="=~" | parameters$op=="~"),c(1,2,3,4,7)]
parameters<-cbind(parameters[,c(1:3)],round(parameters[,c(4:5)],3))
parameters$pvalue<-as.character(parameters$pvalue)
parameters<-as.data.frame(parameters)
parameters$pvalue<-round(as.numeric(parameters$pvalue),3)
parameters[parameters$pvalue==0,5]<-"<0.001"
parameters
| Fear |
=~ |
item6 |
0.883 |
<0.001 |
| Fear |
=~ |
item2 |
0.784 |
<0.001 |
| Fear |
=~ |
item3 |
0.686 |
<0.001 |
| Fear |
=~ |
item4 |
0.791 |
<0.001 |
| Fear |
=~ |
item5 |
0.847 |
<0.001 |
| item2 |
~ |
Age |
-0.006 |
0.022 |
| item3 |
~ |
Age |
0.004 |
0.083 |
| item4 |
~ |
Age |
-0.006 |
0.013 |
| item5 |
~ |
Age |
-0.001 |
0.816 |
| item6 |
~ |
Age |
-0.002 |
0.327 |
Item Response Theory (Brazil 5 Itens)
Basic Model
data<-data.matrix(banco[,c("item2","item3","item4","item5","item6")])
CorMat <- psych::polychoric(data)$rho
Descriptives
dsc<-descript(data)
round(dsc$perc,2)
## [,1] [,2] [,3] [,4]
## item2 0.65 0.24 0.09 0.02
## item3 0.14 0.37 0.25 0.25
## item4 0.12 0.29 0.41 0.18
## item5 0.59 0.30 0.10 0.01
## item6 0.45 0.30 0.16 0.09
Alpha - per excluded item
dsc$alpha
## value
## All Items 0.8323451
## Excluding item2 0.8089135
## Excluding item3 0.8245936
## Excluding item4 0.7953606
## Excluding item5 0.7947402
## Excluding item6 0.7673558
Correlation Itens
rcor.test(data, method = "kendall")
##
## item2 item3 item4 item5 item6
## item2 ***** 0.305 0.428 0.504 0.495
## item3 <0.001 ***** 0.428 0.386 0.457
## item4 <0.001 <0.001 ***** 0.465 0.502
## item5 <0.001 <0.001 <0.001 ***** 0.596
## item6 <0.001 <0.001 <0.001 <0.001 *****
##
## upper diagonal part contains correlation coefficient estimates
## lower diagonal part contains corresponding p-values
Empirical Plots - Total Raw Score and Responses
empirical_plot(data, c(1,2,3,4,5), smooth = TRUE)

Firts Constrained Model
fit1<-grm(data,constrained = T, Hessian=T,IRT.param=T)
summary(fit1)
##
## Call:
## grm(data = data, constrained = T, IRT.param = T, Hessian = T)
##
## Model Summary:
## log.Lik AIC BIC
## -4866.697 9765.394 9843.966
##
## Coefficients:
## $item2
## value std.err z.vals
## Extrmt1 0.458 0.050 9.092
## Extrmt2 1.495 0.775 1.929
## Extrmt3 2.589 17.164 0.151
## Dscrmn 2.317 0.079 29.194
##
## $item3
## value std.err z.vals
## Extrmt1 -1.329 0.069 -19.347
## Extrmt2 0.057 0.062 0.920
## Extrmt3 0.845 0.070 12.135
## Dscrmn 2.317 0.079 29.194
##
## $item4
## value std.err z.vals
## Extrmt1 -1.437 0.071 -20.183
## Extrmt2 -0.257 0.189 -1.360
## Extrmt3 1.145 0.192 5.973
## Dscrmn 2.317 0.079 29.194
##
## $item5
## value std.err z.vals
## Extrmt1 0.269 0.049 5.452
## Extrmt2 1.539 0.296 5.196
## Extrmt3 3.167 0.531 5.967
## Dscrmn 2.317 0.079 29.194
##
## $item6
## value std.err z.vals
## Extrmt1 -0.161 0.049 -3.265
## Extrmt2 0.847 0.725 1.168
## Extrmt3 1.743 46.276 0.038
## Dscrmn 2.317 0.079 29.194
##
##
## Integration:
## method: Gauss-Hermite
## quadrature points: 21
##
## Optimization:
## Convergence: 0
## max(|grad|): 0.012
## quasi-Newton: BFGS
margins(fit1)
##
## Call:
## grm(data = data, constrained = T, IRT.param = T, Hessian = T)
##
## Fit on the Two-Way Margins
##
## item2 item3 item4 item5 item6
## item2 - 86.14 40.55 39.83 26.42
## item3 *** - 36.33 39.50 34.37
## item4 - 26.05 66.35
## item5 - 52.51
## item6 *** -
##
## '***' denotes pairs of items with lack-of-fit
margins(fit1, "three")
##
## Call:
## grm(data = data, constrained = T, IRT.param = T, Hessian = T)
##
## Fit on the Three-Way Margins
##
## Item i Item j Item k (O-E)^2/E
## 1 1 2 3 212.40
## 2 1 2 4 201.07
## 3 1 2 5 212.48
## 4 1 3 4 129.91
## 5 1 3 5 150.42
## 6 1 4 5 125.06
## 7 2 3 4 137.49
## 8 2 3 5 162.01
## 9 2 4 5 178.27
## 10 3 4 5 173.04
Unconstrained Model
fit2<-grm(data,constrained = F, Hessian=T,IRT.param=T)
summary(fit2)
##
## Call:
## grm(data = data, constrained = F, IRT.param = T, Hessian = T)
##
## Model Summary:
## log.Lik AIC BIC
## -4829.967 9699.934 9798.149
##
## Coefficients:
## $item2
## value std.err z.vals
## Extrmt1 0.469 0.051 9.141
## Extrmt2 1.504 0.911 1.650
## Extrmt3 2.573 16.638 0.155
## Dscrmn 2.287 0.169 13.519
##
## $item3
## value std.err z.vals
## Extrmt1 -1.579 0.098 -16.034
## Extrmt2 0.067 0.059 1.130
## Extrmt3 1.021 0.191 5.352
## Dscrmn 1.616 0.106 15.258
##
## $item4
## value std.err z.vals
## Extrmt1 -1.450 0.079 -18.391
## Extrmt2 -0.245 0.076 -3.220
## Extrmt3 1.159 0.299 3.882
## Dscrmn 2.273 0.149 15.294
##
## $item5
## value std.err z.vals
## Extrmt1 0.267 0.047 5.735
## Extrmt2 1.428 1.392 1.026
## Extrmt3 2.877 151.323 0.019
## Dscrmn 2.873 0.215 13.376
##
## $item6
## value std.err z.vals
## Extrmt1 -0.118 0.045 -2.616
## Extrmt2 0.772 0.284 2.721
## Extrmt3 1.541 4.799 0.321
## Dscrmn 3.383 0.274 12.364
##
##
## Integration:
## method: Gauss-Hermite
## quadrature points: 21
##
## Optimization:
## Convergence: 0
## max(|grad|): 0.03
## quasi-Newton: BFGS
margins(fit1)
##
## Call:
## grm(data = data, constrained = T, IRT.param = T, Hessian = T)
##
## Fit on the Two-Way Margins
##
## item2 item3 item4 item5 item6
## item2 - 86.14 40.55 39.83 26.42
## item3 *** - 36.33 39.50 34.37
## item4 - 26.05 66.35
## item5 - 52.51
## item6 *** -
##
## '***' denotes pairs of items with lack-of-fit
margins(fit1, "three")
##
## Call:
## grm(data = data, constrained = T, IRT.param = T, Hessian = T)
##
## Fit on the Three-Way Margins
##
## Item i Item j Item k (O-E)^2/E
## 1 1 2 3 212.40
## 2 1 2 4 201.07
## 3 1 2 5 212.48
## 4 1 3 4 129.91
## 5 1 3 5 150.42
## 6 1 4 5 125.06
## 7 2 3 4 137.49
## 8 2 3 5 162.01
## 9 2 4 5 178.27
## 10 3 4 5 173.04
Comparisons Constrained and Uconstrained
anova(fit1,fit2)
##
## Likelihood Ratio Table
## AIC BIC log.Lik LRT df p.value
## fit1 9765.39 9843.97 -4866.70
## fit2 9699.93 9798.15 -4829.97 73.46 4 <0.001
Unconstrained Model
Coeficients
coef(fit2, simplify = TRUE,standardized=T,prob=T,order=T)
## Extrmt1 Extrmt2 Extrmt3 Dscrmn
## item2 0.469 1.504 2.573 2.287
## item3 -1.579 0.067 1.021 1.616
## item4 -1.450 -0.245 1.159 2.273
## item5 0.267 1.428 2.877 2.873
## item6 -0.118 0.772 1.541 3.383