Se correra la base de datos, la cual esta consta de 80 observaciones y 105 variables de mujeres con cancer de mama en la ciudad de cali, concretando algunos parametros para las simulaciones y el MCMC para obtener la convergencia de los parametros esperados.
options(mc.cores = parallel::detectCores())
datos <- readRDS("data/datos.RDS")
set.seed(535535)
BURNIN1 = 3000
SAMPLE1 = 6500
BURNIN = 2500
SAMPLE = 6500
CHAINS = 6
se establece despues de las prueba de modelos frecuentistas y sus efectos indirectos, finalmente con la investgacion en la literatura, el modelo bayesiano con sus variables latentes.
model_bayesianoref <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ sintomas
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad
Salud ~ prior("normal(-10,10)")*sintomas + funcionalidad
# residual correlations
'
Del paquete Blavaan que nos ayuda a ejecurtar modelos bayesianos para ecuaciones de modelos estructurales.
#codigo para funcion sem
fitref <- bsem(
model = model_bayesianoref,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
inits = "prior",
sample = 6500,
burnin = 3000,
n.chains = 6)
## Computing posterior predictives...
summary(fitref,standardized = TRUE)
## blavaan (0.4-1) results of 6500 samples after 3000 adapt/burnin iterations
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -519.994 0.200
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.537 0.811
## F_c30 1.437 0.156 1.170 1.780 0.771 0.939
## sintomas =~
## S_br23 1.000 0.331 0.589
## S_c30 2.343 0.475 1.663 3.513 0.776 0.929
## Rhat Prior
##
##
## 1.000 normal(0,15)
##
##
## 1.000 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas -1.604 0.342 -2.437 -1.094 -0.990 -0.990
## CV_Gral ~
## Salud 0.751 0.091 0.573 0.913 0.751 0.760
## sintomas -0.604 7.815 -16.484 15.877 -0.200 -0.110
## funcionalidad 0.373 5.025 -9.849 11.096 0.201 0.110
## Salud ~
## sintomas -5.783 8.298 -22.898 9.480 -1.916 -1.036
## funcionalidad -1.025 5.315 -12.090 8.860 -0.550 -0.298
## Rhat Prior
##
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.000 normal(0,10)
## 1.000 normal(0,15)
##
## 1.000 normal(-10,10)
## 1.000 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.342 0.073 2.199 2.487 2.342 3.536
## .F_c30 2.437 0.088 2.264 2.611 2.437 2.965
## .S_br23 1.765 0.063 1.643 1.889 1.765 3.138
## .S_c30 2.164 0.090 1.986 2.341 2.164 2.590
## .CV_Gral 0.843 0.402 0.123 1.627 0.843 0.462
## .Salud 4.335 0.207 3.928 4.743 4.335 2.344
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.150 0.029 0.102 0.215 0.150 0.343
## .F_c30 0.081 0.028 0.029 0.139 0.081 0.119
## .S_br23 0.206 0.036 0.147 0.286 0.206 0.653
## .S_c30 0.095 0.033 0.021 0.161 0.095 0.136
## .CV_Gral 0.430 0.109 0.164 0.633 0.430 0.129
## .Salud 1.534 0.327 0.902 2.212 1.534 0.448
## .funcionalidad 0.006 0.010 0.000 0.036 0.021 0.021
## sintomas 0.110 0.042 0.043 0.204 1.000 1.000
## Rhat Prior
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavFitIndices(fitref)
## Posterior mean (EAP) of devm-based fit indices:
##
## BRMSEA BGammaHat adjBGammaHat BMc
## 0.116 0.963 0.864 0.944
blavInspect(fitref, 'rhat')
## funcionalidad=~F_c30 sintomas=~S_c30
## 1.0000343 1.0000453
## funcionalidad~sintomas CV_Gral~Salud
## 1.0000549 1.0003213
## CV_Gral~sintomas CV_Gral~funcionalidad
## 1.0004063 1.0004426
## Salud~sintomas Salud~funcionalidad
## 1.0004253 1.0003951
## F_br23~~F_br23 F_c30~~F_c30
## 1.0001521 1.0005471
## S_br23~~S_br23 S_c30~~S_c30
## 0.9999676 1.0002329
## CV_Gral~~CV_Gral Salud~~Salud
## 1.0001215 1.0001325
## funcionalidad~~funcionalidad sintomas~~sintomas
## 1.0006765 0.9999426
## F_br23~1 F_c30~1
## 1.0000566 1.0000149
## S_br23~1 S_c30~1
## 1.0000496 1.0000642
## CV_Gral~1 Salud~1
## 1.0003088 1.0000529
blavInspect(fitref, 'neff')
## funcionalidad=~F_c30 sintomas=~S_c30
## 25671.738 11504.372
## funcionalidad~sintomas CV_Gral~Salud
## 12714.626 9877.462
## CV_Gral~sintomas CV_Gral~funcionalidad
## 9562.564 9425.354
## Salud~sintomas Salud~funcionalidad
## 11436.464 11015.307
## F_br23~~F_br23 F_c30~~F_c30
## 30448.833 16757.158
## S_br23~~S_br23 S_c30~~S_c30
## 30851.553 12372.945
## CV_Gral~~CV_Gral Salud~~Salud
## 8951.224 15476.893
## funcionalidad~~funcionalidad sintomas~~sintomas
## 7301.670 19658.809
## F_br23~1 F_c30~1
## 19064.776 16806.909
## S_br23~1 S_c30~1
## 23222.674 17088.299
## CV_Gral~1 Salud~1
## 10088.024 20375.859
semPaths(
fitref,
intercepts = FALSE,
residuals = TRUE,
edge.label.cex = 1.5,
intStyle = "multi",
optimizeLatRes = TRUE,
title.color = "black",
groups = "lat",
pastel = TRUE,
exoVar = FALSE,
sizeInt = 5,
edge.color = "black",
esize = 6,
label.prop = 2,
sizeLat = 6,
"std"
)
plot(fitref, par = 1:12, facet_args = list(ncol = 4))
plot(fitref, par = 13:22, facet_args = list(ncol = 4))
plot(fitref, par = 1:12, plot.type = "intervals")
plot(fitref, plot.type = "parcoord")
model_bayesiano1.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad + Edad
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad
# residual correlations
'
fitedad1.0 <- bsem(
model = model_bayesiano1.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fitedad1.0,standardized = TRUE)
## blavaan (0.4-1) results of 6500 samples after 2500 adapt/burnin iterations
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -526.600 0.035
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.539 0.812
## F_c30 1.436 0.157 1.167 1.780 0.773 0.939
## sintomas =~
## S_br23 1.000 0.330 0.588
## S_c30 2.362 0.539 1.669 3.546 0.780 0.930
## Rhat Prior
##
##
## 1.000 normal(0,15)
##
##
## 1.001 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) -1.614 0.371 -2.462 -1.097 -0.989 -0.989
## CV_Gral ~
## Salud (c) 0.741 0.089 0.567 0.901 0.741 0.753
## sintomas (e) -1.324 7.335 -16.128 13.986 -0.437 -0.240
## funcionldd (d) -0.049 4.615 -9.543 9.659 -0.027 -0.015
## Edad -0.005 0.007 -0.018 0.008 -0.005 -0.032
## Salud ~
## sintomas -5.725 8.329 -23.134 9.303 -1.890 -1.020
## funcionldd (b) -0.966 5.318 -12.320 8.735 -0.521 -0.281
## Rhat Prior
##
## 1.001 normal(0,10)
##
## 1.000 normal(0,10)
## 1.001 normal(0,10)
## 1.001 normal(0,10)
## 1.000 normal(0,10)
##
## 1.000 normal(-10,10)
## 1.000 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.342 0.072 2.201 2.484 2.342 3.529
## .F_c30 2.437 0.088 2.266 2.611 2.437 2.958
## .S_br23 1.765 0.063 1.641 1.889 1.765 3.142
## .S_c30 2.164 0.090 1.987 2.340 2.164 2.581
## .CV_Gral 1.149 0.579 0.049 2.297 1.149 0.630
## .Salud 4.337 0.206 3.931 4.742 4.337 2.341
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.150 0.029 0.102 0.215 0.150 0.341
## .F_c30 0.081 0.027 0.030 0.139 0.081 0.119
## .S_br23 0.207 0.036 0.147 0.287 0.207 0.655
## .S_c30 0.095 0.033 0.024 0.160 0.095 0.135
## .CV_Gral 0.433 0.107 0.179 0.635 0.433 0.130
## .Salud 1.535 0.331 0.896 2.210 1.535 0.447
## .funcionalidad 0.006 0.010 0.000 0.036 0.021 0.021
## sintomas 0.109 0.042 0.041 0.204 1.000 1.000
## Rhat Prior
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavFitIndices(fitedad1.0, baseline.model = fitref)
## Posterior mean (EAP) of devm-based fit indices:
##
## BRMSEA BGammaHat adjBGammaHat BMc BCFI BTLI
## 0.130 0.936 0.838 0.887 -0.146 -0.263
## BNFI
## -1.496
blavCompare(fitref, fitedad1.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 915.775
##
## WAIC difference & SE:
## -1.008 1.053
##
## LOO estimates:
## object1: 914.152
## object2: 916.23
##
## LOO difference & SE:
## -1.039 1.103
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 6.606
Gana modelo ref
model_bayesiano2.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad + Con_companero_permanente
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad
# residual correlations
'
fit2.0 <- bsem(
model = model_bayesiano2.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fit2.0,standardized = TRUE)
## blavaan (0.4-1) results of 6500 samples after 2500 adapt/burnin iterations
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -523.845 0.227
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.538 0.812
## F_c30 1.435 0.156 1.167 1.779 0.773 0.939
## sintomas =~
## S_br23 1.000 0.330 0.587
## S_c30 2.362 0.525 1.664 3.607 0.779 0.930
## Rhat Prior
##
##
## 1.000 normal(0,15)
##
##
## 1.001 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) -1.615 0.366 -2.487 -1.095 -0.989 -0.989
## CV_Gral ~
## Salud (c) 0.752 0.084 0.584 0.907 0.752 0.761
## sintomas (e) -0.717 7.243 -15.598 14.423 -0.236 -0.129
## funcionldd (d) 0.298 4.572 -9.100 9.930 0.161 0.088
## Cn_cmpnr_p 0.001 0.162 -0.317 0.318 0.001 0.000
## Salud ~
## sintomas -5.631 8.167 -22.863 9.037 -1.857 -1.003
## funcionldd (b) -0.910 5.189 -11.988 8.561 -0.490 -0.265
## Rhat Prior
##
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.001 normal(0,10)
## 1.001 normal(0,10)
## 1.000 normal(0,10)
##
## 1.001 normal(-10,10)
## 1.001 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.342 0.071 2.202 2.482 2.342 3.531
## .F_c30 2.437 0.087 2.266 2.608 2.437 2.961
## .S_br23 1.765 0.062 1.643 1.888 1.765 3.143
## .S_c30 2.165 0.089 1.991 2.340 2.165 2.585
## .CV_Gral 0.837 0.434 0.021 1.707 0.837 0.458
## .Salud 4.335 0.204 3.931 4.732 4.335 2.340
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.150 0.029 0.102 0.215 0.150 0.341
## .F_c30 0.080 0.027 0.030 0.137 0.080 0.118
## .S_br23 0.207 0.037 0.147 0.289 0.207 0.655
## .S_c30 0.095 0.033 0.020 0.160 0.095 0.135
## .CV_Gral 0.441 0.105 0.201 0.643 0.441 0.132
## .Salud 1.543 0.322 0.949 2.218 1.543 0.450
## .funcionalidad 0.006 0.010 0.000 0.038 0.022 0.022
## sintomas 0.109 0.042 0.041 0.203 1.000 1.000
## Rhat Prior
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavCompare(fitref, fit2.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 915.719
##
## WAIC difference & SE:
## -0.980 0.088
##
## LOO estimates:
## object1: 914.152
## object2: 916.01
##
## LOO difference & SE:
## -0.929 0.101
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 3.851
blavCompare(fitedad1.0, fit2.0)
##
## WAIC estimates:
## object1: 915.775
## object2: 915.719
##
## WAIC difference & SE:
## -0.028 1.090
##
## LOO estimates:
## object1: 916.23
## object2: 916.01
##
## LOO difference & SE:
## -0.110 1.129
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): -2.755
model_bayesiano1.0_2.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad + Edad + Con_companero_permanente
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad
# residual correlations
'
fit1.0_2.0 <- bsem(
model = model_bayesiano1.0_2.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fit1.0_2.0,standardized = TRUE)
## blavaan (0.4-1) results of 6500 samples after 2500 adapt/burnin iterations
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -530.854 0.053
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.537 0.811
## F_c30 1.436 0.157 1.167 1.787 0.772 0.939
## sintomas =~
## S_br23 1.000 0.331 0.589
## S_c30 2.349 0.482 1.663 3.510 0.778 0.930
## Rhat Prior
##
##
## 1.000 normal(0,15)
##
##
## 1.000 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) -1.605 0.345 -2.432 -1.096 -0.989 -0.989
## CV_Gral ~
## Salud (c) 0.741 0.090 0.564 0.904 0.741 0.752
## sintomas (e) -1.509 7.259 -16.517 13.671 -0.500 -0.274
## funcionldd (d) -0.168 4.595 -9.684 9.466 -0.090 -0.050
## Edad -0.005 0.007 -0.019 0.008 -0.005 -0.034
## Cn_cmpnr_p -0.015 0.165 -0.338 0.306 -0.015 -0.004
## Salud ~
## sintomas -5.454 8.229 -22.846 9.616 -1.805 -0.976
## funcionldd (b) -0.815 5.262 -12.020 8.877 -0.438 -0.237
## Rhat Prior
##
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.001 normal(0,10)
## 1.001 normal(0,10)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
## 1.000 normal(-10,10)
## 1.000 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.342 0.072 2.199 2.484 2.342 3.534
## .F_c30 2.437 0.088 2.265 2.608 2.437 2.963
## .S_br23 1.765 0.063 1.642 1.890 1.765 3.143
## .S_c30 2.164 0.090 1.989 2.338 2.164 2.589
## .CV_Gral 1.180 0.646 -0.044 2.464 1.180 0.647
## .Salud 4.336 0.205 3.932 4.738 4.336 2.343
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.001 normal(0,32)
## 1.001 normal(0,32)
## 1.000 normal(0,32)
## 1.001 normal(0,32)
## 1.001 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.150 0.029 0.102 0.215 0.150 0.342
## .F_c30 0.080 0.027 0.029 0.138 0.080 0.119
## .S_br23 0.206 0.036 0.147 0.286 0.206 0.653
## .S_c30 0.094 0.033 0.021 0.159 0.094 0.135
## .CV_Gral 0.439 0.110 0.172 0.649 0.439 0.132
## .Salud 1.536 0.330 0.910 2.219 1.536 0.449
## .funcionalidad 0.006 0.010 0.000 0.037 0.022 0.022
## sintomas 0.110 0.041 0.042 0.204 1.000 1.000
## Rhat Prior
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavCompare(fitref, fit1.0_2.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 917.643
##
## WAIC difference & SE:
## -1.942 1.073
##
## LOO estimates:
## object1: 914.152
## object2: 918.12
##
## LOO difference & SE:
## -1.984 1.118
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 10.860
model_bayesiano3.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas + Estrato
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad
# residual correlations
'
fit3.0 <- bsem(
model = model_bayesiano3.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fit3.0,standardized = TRUE)
## blavaan (0.4-1) results of 6500 samples after 2500 adapt/burnin iterations
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -523.980 0.307
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.544 0.815
## F_c30 1.432 0.152 1.172 1.762 0.778 0.943
## sintomas =~
## S_br23 1.000 0.324 0.580
## S_c30 2.436 0.533 1.708 3.736 0.788 0.939
## Rhat Prior
##
##
## 1.000 normal(0,15)
##
##
## 1.000 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) -1.644 0.377 -2.558 -1.106 -0.979 -0.979
## Estrato 0.084 0.060 -0.019 0.212 0.155 0.077
## CV_Gral ~
## Salud (c) 0.756 0.071 0.617 0.892 0.756 0.766
## sintomas (e) -1.531 3.868 -10.133 6.792 -0.496 -0.268
## funcionldd (d) -0.207 2.358 -5.399 4.804 -0.113 -0.061
## Salud ~
## sintomas -3.341 5.519 -16.796 5.881 -1.082 -0.576
## funcionldd (b) 0.573 3.398 -7.609 6.346 0.312 0.166
## Rhat Prior
##
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.001 normal(0,10)
## 1.001 normal(0,10)
##
## 1.001 normal(-10,10)
## 1.001 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.221 0.113 1.992 2.434 2.221 3.330
## .F_c30 2.265 0.150 1.959 2.544 2.265 2.743
## .S_br23 1.765 0.063 1.642 1.889 1.765 3.163
## .S_c30 2.165 0.090 1.989 2.340 2.165 2.577
## .CV_Gral 0.849 0.355 0.185 1.566 0.849 0.459
## .Salud 4.202 0.388 3.397 4.942 4.202 2.239
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.149 0.029 0.102 0.214 0.149 0.336
## .F_c30 0.076 0.027 0.024 0.133 0.076 0.111
## .S_br23 0.207 0.036 0.147 0.288 0.207 0.664
## .S_c30 0.084 0.036 0.005 0.152 0.084 0.119
## .CV_Gral 0.459 0.086 0.307 0.642 0.459 0.134
## .Salud 1.594 0.298 1.088 2.253 1.594 0.453
## .funcionalidad 0.011 0.013 0.000 0.049 0.036 0.036
## sintomas 0.105 0.041 0.038 0.199 1.000 1.000
## Rhat Prior
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavCompare(fitref, fit3.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 913.279
##
## WAIC difference & SE:
## -0.240 1.414
##
## LOO estimates:
## object1: 914.152
## object2: 913.691
##
## LOO difference & SE:
## -0.231 1.421
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 3.986
model_bayesiano4.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad + niveleducativo
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad
# residual correlations
'
fit4.0 <- bsem(
model = model_bayesiano4.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fit4.0,standardized = TRUE)
## blavaan (0.4-1) results of 6500 samples after 2500 adapt/burnin iterations
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -523.665 0.085
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.538 0.811
## F_c30 1.436 0.155 1.168 1.776 0.772 0.939
## sintomas =~
## S_br23 1.000 0.330 0.587
## S_c30 2.357 0.489 1.667 3.536 0.778 0.930
## Rhat Prior
##
##
## 1.000 normal(0,15)
##
##
## 1.000 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) -1.611 0.349 -2.446 -1.097 -0.989 -0.989
## CV_Gral ~
## Salud (c) 0.752 0.084 0.584 0.910 0.752 0.755
## sintomas (e) -0.917 7.122 -15.516 13.917 -0.302 -0.164
## funcionldd (d) 0.211 4.530 -9.015 9.810 0.114 0.062
## niveledctv 0.116 0.173 -0.228 0.455 0.116 0.030
## Salud ~
## sintomas -5.700 8.226 -22.949 9.229 -1.881 -1.014
## funcionldd (b) -0.949 5.235 -12.015 8.650 -0.510 -0.275
## Rhat Prior
##
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.001 normal(0,10)
## 1.001 normal(0,10)
## 1.000 normal(0,10)
##
## 1.001 normal(-10,10)
## 1.001 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.341 0.072 2.200 2.484 2.341 3.533
## .F_c30 2.436 0.088 2.263 2.610 2.436 2.964
## .S_br23 1.765 0.063 1.640 1.889 1.765 3.143
## .S_c30 2.165 0.090 1.987 2.340 2.165 2.589
## .CV_Gral 0.681 0.441 -0.160 1.562 0.681 0.368
## .Salud 4.335 0.206 3.930 4.738 4.335 2.338
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.150 0.029 0.102 0.215 0.150 0.342
## .F_c30 0.080 0.028 0.028 0.139 0.080 0.118
## .S_br23 0.207 0.036 0.148 0.287 0.207 0.655
## .S_c30 0.095 0.033 0.019 0.161 0.095 0.135
## .CV_Gral 0.437 0.107 0.191 0.643 0.437 0.128
## .Salud 1.538 0.324 0.930 2.216 1.538 0.447
## .funcionalidad 0.006 0.010 0.000 0.038 0.022 0.022
## sintomas 0.109 0.041 0.042 0.203 1.000 1.000
## Rhat Prior
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavCompare(fitref, fit4.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 915.408
##
## WAIC difference & SE:
## -0.824 0.778
##
## LOO estimates:
## object1: 914.152
## object2: 915.757
##
## LOO difference & SE:
## -0.803 0.799
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 3.671
model_bayesiano3.0_4.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas + Estrato
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad + niveleducativo
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad
# residual correlations
'
fit3.0_4.0 <- bsem(
model = model_bayesiano3.0_4.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fit3.0_4.0,standardized = TRUE)
## blavaan (0.4-1) results of 6500 samples after 2500 adapt/burnin iterations
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -527.682 0.123
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.545 0.815
## F_c30 1.432 0.154 1.169 1.771 0.780 0.943
## sintomas =~
## S_br23 1.000 0.324 0.580
## S_c30 2.432 0.552 1.699 3.759 0.788 0.937
## Rhat Prior
##
##
## 1.000 normal(0,15)
##
##
## 1.000 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) -1.649 0.394 -2.607 -1.100 -0.981 -0.981
## Estrato 0.087 0.059 -0.016 0.213 0.160 0.079
## CV_Gral ~
## Salud (c) 0.755 0.070 0.617 0.890 0.755 0.758
## sintomas (e) -2.387 3.902 -11.312 5.112 -0.773 -0.412
## funcionldd (d) -0.676 2.359 -6.031 3.964 -0.368 -0.196
## niveledctv 0.152 0.182 -0.205 0.511 0.152 0.039
## Salud ~
## sintomas -3.355 5.328 -16.169 5.677 -1.087 -0.577
## funcionldd (b) 0.576 3.246 -7.212 6.195 0.314 0.167
## Rhat Prior
##
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
## 1.000 normal(-10,10)
## 1.000 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.217 0.112 1.988 2.427 2.217 3.319
## .F_c30 2.259 0.149 1.956 2.538 2.259 2.732
## .S_br23 1.765 0.063 1.641 1.887 1.765 3.158
## .S_c30 2.164 0.090 1.989 2.339 2.164 2.573
## .CV_Gral 0.695 0.409 -0.087 1.505 0.695 0.370
## .Salud 4.212 0.393 3.397 4.963 4.212 2.236
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.150 0.029 0.101 0.215 0.150 0.335
## .F_c30 0.076 0.027 0.025 0.132 0.076 0.111
## .S_br23 0.207 0.037 0.147 0.290 0.207 0.664
## .S_c30 0.086 0.034 0.009 0.152 0.086 0.122
## .CV_Gral 0.457 0.090 0.300 0.649 0.457 0.130
## .Salud 1.599 0.297 1.093 2.258 1.599 0.451
## .funcionalidad 0.010 0.013 0.000 0.046 0.032 0.032
## sintomas 0.105 0.041 0.038 0.199 1.000 1.000
## Rhat Prior
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavCompare(fitref, fit3.0_4.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 914.672
##
## WAIC difference & SE:
## -0.456 1.690
##
## LOO estimates:
## object1: 914.152
## object2: 915.045
##
## LOO difference & SE:
## -0.446 1.712
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 7.688
model_bayesiano5.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas + Situacion_laboral
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad
# residual correlations
'
fit5.0 <- bsem(
model = model_bayesiano5.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fit5.0,standardized = TRUE)
## blavaan (0.4-1) results of 6500 samples after 2500 adapt/burnin iterations
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -524.806 0.187
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.542 0.815
## F_c30 1.420 0.153 1.158 1.758 0.769 0.937
## sintomas =~
## S_br23 1.000 0.327 0.584
## S_c30 2.382 0.524 1.675 3.633 0.780 0.930
## Rhat Prior
##
##
## 1.000 normal(0,15)
##
##
## 1.000 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) -1.635 0.372 -2.516 -1.111 -0.988 -0.988
## Sitcn_lbrl -0.019 0.051 -0.124 0.081 -0.035 -0.017
## CV_Gral ~
## Salud (c) 0.760 0.081 0.606 0.915 0.760 0.768
## sintomas (e) 0.334 6.193 -12.963 13.087 0.109 0.059
## funcionldd (d) 0.919 3.827 -7.255 8.952 0.498 0.270
## Salud ~
## sintomas -5.409 7.419 -21.500 7.847 -1.771 -0.951
## funcionldd (b) -0.723 4.608 -10.758 7.615 -0.392 -0.210
## Rhat Prior
##
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
## 1.000 normal(-10,10)
## 1.001 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.373 0.109 2.159 2.590 2.373 3.567
## .F_c30 2.480 0.144 2.194 2.766 2.480 3.021
## .S_br23 1.764 0.063 1.641 1.888 1.764 3.150
## .S_c30 2.164 0.089 1.988 2.339 2.164 2.582
## .CV_Gral 0.928 0.387 0.207 1.703 0.928 0.504
## .Salud 4.254 0.355 3.489 4.923 4.254 2.284
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.149 0.029 0.101 0.213 0.149 0.336
## .F_c30 0.082 0.027 0.031 0.140 0.082 0.121
## .S_br23 0.207 0.036 0.147 0.287 0.207 0.658
## .S_c30 0.094 0.034 0.019 0.161 0.094 0.134
## .CV_Gral 0.439 0.099 0.230 0.632 0.439 0.129
## .Salud 1.551 0.323 0.975 2.228 1.551 0.447
## .funcionalidad 0.007 0.011 0.000 0.040 0.024 0.024
## sintomas 0.107 0.041 0.040 0.201 1.000 1.000
## Rhat Prior
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavCompare(fitref, fit5.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 915.843
##
## WAIC difference & SE:
## -1.042 0.673
##
## LOO estimates:
## object1: 914.152
## object2: 916.331
##
## LOO difference & SE:
## -1.090 0.690
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 4.812
model_bayesiano6.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad +Regimen_salud
# residual correlations
'
fit6.0 <- bsem(
model = model_bayesiano6.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fit6.0,standardized = TRUE)
## ** WARNING ** blavaan (0.4-1) did NOT converge after 2500 adapt+burnin iterations
## ** WARNING ** Proceed with caution
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -863.236 0.105
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.305 0.615
## F_c30 1.451 0.161 1.179 1.809 0.442 0.848
## sintomas =~
## S_br23 1.000 0.302 0.532
## S_c30 -1.700 9.457 -28.864 3.442 -0.513 -0.861
## Rhat Prior
##
##
## 1.018 normal(0,15)
##
##
## 3.646 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) 0.963 5.994 -2.379 18.041 0.954 0.954
## CV_Gral ~
## Salud (c) 0.762 0.086 0.605 0.927 0.762 0.993
## sintomas (e) -0.001 7.570 -15.276 15.868 -0.000 -0.000
## funcionldd (d) 0.500 4.217 -8.467 9.779 0.152 0.087
## Salud ~
## sintomas -6.167 8.664 -24.471 9.745 -1.861 -0.818
## funcionldd (b) -0.136 5.117 -11.660 8.547 -0.041 -0.018
## Regimn_sld 0.285 0.317 -0.347 0.907 0.285 0.060
## Rhat Prior
##
## 3.684 normal(0,10)
##
## 1.000 normal(0,10)
## 1.007 normal(0,10)
## 1.001 normal(0,10)
##
## 1.011 normal(-10,10)
## 1.057 normal(0,10)
## 1.000 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.342 0.072 2.201 2.485 2.342 4.732
## .F_c30 2.437 0.088 2.264 2.612 2.437 4.674
## .S_br23 1.765 0.064 1.639 1.892 1.765 3.110
## .S_c30 2.164 0.090 1.986 2.340 2.164 3.632
## .CV_Gral 0.795 0.382 0.051 1.501 0.795 0.455
## .Salud 3.871 0.559 2.764 4.973 3.871 1.702
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.152 0.029 0.103 0.218 0.152 0.621
## .F_c30 0.077 0.028 0.023 0.135 0.077 0.281
## .S_br23 0.231 0.067 0.149 0.411 0.231 0.717
## .S_c30 0.092 0.036 0.007 0.161 0.092 0.258
## .CV_Gral 0.441 0.102 0.214 0.638 0.441 0.145
## .Salud 1.542 0.330 0.917 2.228 1.542 0.298
## .funcionalidad 0.008 0.012 0.000 0.045 0.089 0.089
## sintomas 0.091 0.055 0.001 0.198 1.000 1.000
## Rhat Prior
## 1.007 gamma(1,.5)[sd]
## 1.025 gamma(1,.5)[sd]
## 1.711 gamma(1,.5)[sd]
## 1.023 gamma(1,.5)[sd]
## 1.012 gamma(1,.5)[sd]
## 1.002 gamma(1,.5)[sd]
## 1.073 gamma(1,.5)[sd]
## 1.491 gamma(1,.5)[sd]
blavCompare(fitref, fit6.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 926.619
##
## WAIC difference & SE:
## -6.430 1.350
##
## LOO estimates:
## object1: 914.152
## object2: 926.921
##
## LOO difference & SE:
## -6.384 1.362
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 343.242
model_bayesiano5.0_6.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas + Situacion_laboral
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad + Regimen_salud
# residual correlations
'
fit5.0_6.0 <- bsem(
model = model_bayesiano5.0_6.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fit5.0_6.0,standardized = TRUE)
## blavaan (0.4-1) results of 6500 samples after 2500 adapt/burnin iterations
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -527.869 0.126
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.541 0.813
## F_c30 1.424 0.153 1.161 1.764 0.770 0.939
## sintomas =~
## S_br23 1.000 0.328 0.585
## S_c30 2.372 0.498 1.673 3.615 0.778 0.930
## Rhat Prior
##
##
## 1.000 normal(0,15)
##
##
## 1.001 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) -1.627 0.359 -2.496 -1.102 -0.987 -0.987
## Sitcn_lbrl -0.019 0.051 -0.122 0.083 -0.035 -0.017
## CV_Gral ~
## Salud (c) 0.769 0.087 0.616 0.944 0.769 0.779
## sintomas (e) 0.610 6.306 -12.573 13.889 0.200 0.107
## funcionldd (d) 1.063 3.901 -7.139 9.292 0.575 0.308
## Salud ~
## sintomas -5.408 7.469 -21.435 8.183 -1.775 -0.939
## funcionldd (b) -0.671 4.661 -10.584 7.892 -0.363 -0.192
## Regimn_sld 0.288 0.314 -0.334 0.902 0.288 0.073
## Rhat Prior
##
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.001 normal(0,10)
## 1.001 normal(0,10)
##
## 1.000 normal(-10,10)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.372 0.109 2.156 2.589 2.372 3.568
## .F_c30 2.479 0.144 2.193 2.765 2.479 3.020
## .S_br23 1.765 0.062 1.642 1.888 1.765 3.149
## .S_c30 2.165 0.090 1.989 2.342 2.165 2.586
## .CV_Gral 0.896 0.403 0.130 1.664 0.896 0.480
## .Salud 3.772 0.635 2.516 5.009 3.772 1.996
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.150 0.029 0.101 0.215 0.150 0.339
## .F_c30 0.080 0.028 0.028 0.138 0.080 0.119
## .S_br23 0.207 0.036 0.147 0.287 0.207 0.657
## .S_c30 0.095 0.034 0.019 0.162 0.095 0.135
## .CV_Gral 0.437 0.101 0.206 0.631 0.437 0.125
## .Salud 1.541 0.330 0.919 2.216 1.541 0.432
## .funcionalidad 0.007 0.011 0.000 0.042 0.025 0.025
## sintomas 0.108 0.041 0.040 0.201 1.000 1.000
## Rhat Prior
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavCompare(fitref, fit5.0_6.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 917.076
##
## WAIC difference & SE:
## -1.659 1.177
##
## LOO estimates:
## object1: 914.152
## object2: 917.448
##
## LOO difference & SE:
## -1.648 1.170
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 7.875
model_bayesiano7.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas + Comorbilidad
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad
# residual correlations
'
fit7.0 <- bsem(
model = model_bayesiano7.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fit7.0,standardized = TRUE)
## ** WARNING ** blavaan (0.4-1) did NOT converge after 2500 adapt+burnin iterations
## ** WARNING ** Proceed with caution
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -866.873 0.132
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.294 0.603
## F_c30 1.419 0.155 1.152 1.765 0.417 0.816
## sintomas =~
## S_br23 1.000 0.311 0.545
## S_c30 -1.574 8.990 -27.364 3.222 -0.489 -0.850
## Rhat Prior
##
##
## 1.025 normal(0,15)
##
##
## 3.570 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) 0.908 5.807 -2.282 17.468 0.962 0.962
## Comorbildd 0.035 0.092 -0.123 0.189 0.121 0.057
## CV_Gral ~
## Salud (c) 0.686 0.114 0.410 0.864 0.686 0.775
## sintomas (e) -1.202 7.454 -16.603 11.814 -0.374 -0.250
## funcionldd (d) 0.461 4.180 -8.432 8.182 0.135 0.091
## Salud ~
## sintomas -4.878 11.839 -26.891 13.617 -1.517 -0.899
## funcionldd (b) 1.081 6.939 -12.872 11.718 0.317 0.188
## Rhat Prior
##
## 3.662 normal(0,10)
## 1.054 normal(0,10)
##
## 1.028 normal(0,10)
## 1.006 normal(0,10)
## 1.006 normal(0,10)
##
## 1.055 normal(-10,10)
## 1.022 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.283 0.169 1.983 2.596 2.283 4.691
## .F_c30 2.351 0.232 1.943 2.773 2.351 4.605
## .S_br23 1.765 0.064 1.639 1.891 1.765 3.095
## .S_c30 2.164 0.090 1.987 2.341 2.164 3.758
## .CV_Gral 0.708 0.412 -0.024 1.593 0.708 0.475
## .Salud 3.487 0.588 2.250 4.518 3.487 2.067
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.043 normal(0,32)
## 1.049 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.001 normal(0,10)
## 1.022 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.151 0.029 0.102 0.217 0.151 0.636
## .F_c30 0.087 0.028 0.035 0.147 0.087 0.334
## .S_br23 0.229 0.069 0.146 0.412 0.229 0.703
## .S_c30 0.092 0.036 0.011 0.162 0.092 0.277
## .CV_Gral 0.419 0.104 0.183 0.618 0.419 0.188
## .Salud 1.371 0.348 0.648 2.062 1.371 0.482
## .funcionalidad 0.006 0.009 0.000 0.035 0.072 0.072
## sintomas 0.097 0.057 0.001 0.207 1.000 1.000
## Rhat Prior
## 1.012 gamma(1,.5)[sd]
## 1.032 gamma(1,.5)[sd]
## 1.767 gamma(1,.5)[sd]
## 1.022 gamma(1,.5)[sd]
## 1.019 gamma(1,.5)[sd]
## 1.018 gamma(1,.5)[sd]
## 1.096 gamma(1,.5)[sd]
## 1.534 gamma(1,.5)[sd]
blavCompare(fitref, fit7.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 924.257
##
## WAIC difference & SE:
## -5.249 2.233
##
## LOO estimates:
## object1: 914.152
## object2: 924.601
##
## LOO difference & SE:
## -5.225 2.244
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 346.879
model_bayesiano8.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad + Estado_del_tumor
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad
# residual correlations
'
fit8.0 <- bsem(
model = model_bayesiano8.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fit8.0,standardized = TRUE)
## ** WARNING ** blavaan (0.4-1) did NOT converge after 2500 adapt+burnin iterations
## ** WARNING ** Proceed with caution
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -873.023 0.115
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.309 0.621
## F_c30 1.450 0.161 1.175 1.804 0.448 0.849
## sintomas =~
## S_br23 1.000 0.301 0.531
## S_c30 -1.735 9.570 -29.226 3.499 -0.523 -0.866
## Rhat Prior
##
##
## 1.016 normal(0,15)
##
##
## 3.625 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) 0.980 6.052 -2.412 18.270 0.956 0.956
## CV_Gral ~
## Salud (c) 0.753 0.081 0.589 0.904 0.753 0.892
## sintomas (e) -0.553 7.561 -16.075 14.979 -0.166 -0.086
## funcionldd (d) 0.199 4.168 -8.952 9.053 0.061 0.032
## Estd_dl_tm -0.159 0.169 -0.495 0.170 -0.159 -0.039
## Salud ~
## sintomas -6.211 8.497 -23.970 9.162 -1.871 -0.814
## funcionldd (b) -0.212 5.024 -11.291 8.168 -0.066 -0.029
## Rhat Prior
##
## 3.658 normal(0,10)
##
## 1.001 normal(0,10)
## 1.012 normal(0,10)
## 1.002 normal(0,10)
## 1.000 normal(0,10)
##
## 1.011 normal(-10,10)
## 1.060 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.342 0.072 2.201 2.482 2.342 4.710
## .F_c30 2.437 0.087 2.264 2.607 2.437 4.622
## .S_br23 1.765 0.063 1.641 1.890 1.765 3.110
## .S_c30 2.164 0.089 1.990 2.340 2.164 3.588
## .CV_Gral 1.047 0.426 0.249 1.901 1.047 0.539
## .Salud 4.335 0.205 3.929 4.731 4.335 1.885
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.152 0.029 0.103 0.217 0.152 0.614
## .F_c30 0.078 0.028 0.025 0.135 0.078 0.279
## .S_br23 0.231 0.068 0.149 0.412 0.231 0.718
## .S_c30 0.091 0.036 0.007 0.160 0.091 0.249
## .CV_Gral 0.440 0.102 0.215 0.636 0.440 0.117
## .Salud 1.549 0.317 0.969 2.219 1.549 0.293
## .funcionalidad 0.008 0.012 0.000 0.045 0.087 0.087
## sintomas 0.091 0.055 0.001 0.197 1.000 1.000
## Rhat Prior
## 1.006 gamma(1,.5)[sd]
## 1.019 gamma(1,.5)[sd]
## 1.713 gamma(1,.5)[sd]
## 1.027 gamma(1,.5)[sd]
## 1.010 gamma(1,.5)[sd]
## 1.002 gamma(1,.5)[sd]
## 1.081 gamma(1,.5)[sd]
## 1.486 gamma(1,.5)[sd]
blavCompare(fitref, fit8.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 926.346
##
## WAIC difference & SE:
## -6.294 1.429
##
## LOO estimates:
## object1: 914.152
## object2: 926.699
##
## LOO difference & SE:
## -6.273 1.449
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 353.029
model_bayesiano7.0_8.0 <- '
# measurement model
funcionalidad =~
prior("normal(0,15)")*F_br23 + prior("normal(0,15)")*F_c30
sintomas =~
prior("normal(0,15)")*S_br23 + prior("normal(0,15)")*S_c30
# regressions
funcionalidad ~ a*sintomas + Comorbilidad
CV_Gral ~ c*Salud + e*sintomas + d*prior("normal(0,15)")*funcionalidad + Estado_del_tumor
Salud ~ prior("normal(-10,10)")*sintomas + b*funcionalidad
# residual correlations
'
fit7.0_8.0 <- bsem(
model = model_bayesiano7.0_8.0,
data = datos,
auto.var = TRUE,
auto.fix.first = TRUE,
auto.cov.lv.x = TRUE,
sample = SAMPLE,
burnin = BURNIN,
n.chains = CHAINS)
## Computing posterior predictives...
summary(fit7.0_8.0,standardized = TRUE)
## blavaan (0.4-1) results of 6500 samples after 2500 adapt/burnin iterations
##
## Number of observations 80
##
## Number of missing patterns 1
##
## Statistic MargLogLik PPP
## Value -567.230 0.111
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.541 0.814
## F_c30 1.408 0.151 1.148 1.737 0.762 0.930
## sintomas =~
## S_br23 1.000 0.339 0.600
## S_c30 2.280 0.452 1.642 3.364 0.773 0.929
## Rhat Prior
##
##
## 1.000 normal(0,15)
##
##
## 1.000 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas (a) -1.584 0.328 -2.361 -1.101 -0.992 -0.992
## Comorbildd 0.022 0.092 -0.128 0.178 0.041 0.019
## CV_Gral ~
## Salud (c) 0.675 0.116 0.397 0.851 0.675 0.685
## sintomas (e) -1.174 7.278 -16.056 11.178 -0.398 -0.219
## funcionldd (d) 0.265 4.666 -9.064 8.530 0.144 0.079
## Estd_dl_tm -0.173 0.166 -0.501 0.152 -0.173 -0.045
## Salud ~
## sintomas -3.384 11.590 -24.738 14.142 -1.148 -0.623
## funcionldd (b) 0.527 7.479 -13.307 12.088 0.285 0.155
## Rhat Prior
##
## 1.000 normal(0,10)
## 1.005 normal(0,10)
##
## 1.001 normal(0,10)
## 1.004 normal(0,10)
## 1.004 normal(0,10)
## 1.000 normal(0,10)
##
## 1.005 normal(-10,10)
## 1.005 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.305 0.170 1.999 2.607 2.305 3.465
## .F_c30 2.383 0.232 1.971 2.787 2.383 2.910
## .S_br23 1.765 0.063 1.640 1.889 1.765 3.124
## .S_c30 2.165 0.089 1.990 2.340 2.165 2.600
## .CV_Gral 0.922 0.478 0.057 1.938 0.922 0.508
## .Salud 3.430 0.595 2.211 4.494 3.430 1.861
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.004 normal(0,32)
## 1.004 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,10)
## 1.000 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.149 0.029 0.100 0.215 0.149 0.338
## .F_c30 0.090 0.028 0.041 0.150 0.090 0.134
## .S_br23 0.204 0.036 0.145 0.285 0.204 0.640
## .S_c30 0.095 0.033 0.028 0.161 0.095 0.137
## .CV_Gral 0.408 0.107 0.155 0.609 0.408 0.124
## .Salud 1.348 0.345 0.626 2.037 1.348 0.397
## .funcionalidad 0.004 0.006 0.000 0.021 0.015 0.015
## sintomas 0.115 0.042 0.046 0.208 1.000 1.000
## Rhat Prior
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.002 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavCompare(fitref, fit7.0_8.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 912.421
##
## WAIC difference & SE:
## -0.669 2.699
##
## LOO estimates:
## object1: 914.152
## object2: 912.696
##
## LOO difference & SE:
## -0.728 2.730
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 47.236