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 ~ sintomas
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad + Edad
Salud ~ prior("normal(-10,10)")*sintomas + 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.911 0.036
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.536 0.810
## F_c30 1.438 0.158 1.170 1.788 0.771 0.938
## sintomas =~
## S_br23 1.000 0.331 0.589
## S_c30 2.346 0.488 1.665 3.520 0.777 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 -1.600 0.350 -2.425 -1.086 -0.989 -0.989
## CV_Gral ~
## Salud 0.740 0.089 0.560 0.903 0.740 0.752
## sintomas -1.400 7.841 -17.339 15.298 -0.464 -0.254
## funcionalidad -0.091 5.019 -10.401 10.553 -0.049 -0.027
## Edad -0.005 0.007 -0.018 0.008 -0.005 -0.033
## Salud ~
## sintomas -5.621 8.157 -22.985 9.081 -1.862 -1.005
## funcionalidad -0.920 5.244 -12.086 8.625 -0.493 -0.266
## 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(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.483 2.342 3.539
## .F_c30 2.437 0.087 2.268 2.609 2.437 2.966
## .S_br23 1.765 0.063 1.641 1.889 1.765 3.142
## .S_c30 2.165 0.090 1.988 2.340 2.165 2.592
## .CV_Gral 1.152 0.587 0.034 2.328 1.152 0.631
## .Salud 4.335 0.204 3.936 4.740 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.214 0.150 0.343
## .F_c30 0.081 0.028 0.027 0.139 0.081 0.119
## .S_br23 0.206 0.036 0.147 0.286 0.206 0.653
## .S_c30 0.094 0.034 0.016 0.160 0.094 0.135
## .CV_Gral 0.427 0.115 0.132 0.635 0.427 0.128
## .Salud 1.538 0.325 0.921 2.203 1.538 0.448
## .funcionalidad 0.007 0.010 0.000 0.039 0.023 0.023
## sintomas 0.110 0.041 0.043 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.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(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.386 -0.532
## BNFI
## -1.483
blavCompare(fitref, fitedad1.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 915.901
##
## WAIC difference & SE:
## -1.071 1.047
##
## LOO estimates:
## object1: 914.152
## object2: 916.265
##
## LOO difference & SE:
## -1.057 1.082
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 6.917
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 ~ sintomas
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad + Con_companero_permanente
Salud ~ prior("normal(-10,10)")*sintomas + 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.596 0.223
##
## 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.158 1.167 1.789 0.773 0.939
## sintomas =~
## S_br23 1.000 0.331 0.589
## S_c30 2.351 0.521 1.657 3.541 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 -1.607 0.371 -2.448 -1.089 -0.989 -0.989
## CV_Gral ~
## Salud 0.752 0.105 0.571 0.918 0.752 0.763
## sintomas -0.617 7.879 -16.963 15.837 -0.204 -0.112
## funcionalidad 0.352 5.092 -10.191 10.978 0.189 0.104
## Cn_cmpnr_prmnn 0.001 0.162 -0.320 0.320 0.001 0.000
## Salud ~
## sintomas -5.689 8.374 -23.184 9.682 -1.885 -1.018
## funcionalidad -0.957 5.367 -12.267 9.062 -0.515 -0.278
## Rhat Prior
##
## 1.001 normal(0,10)
##
## 1.002 normal(0,10)
## 1.000 normal(0,10)
## 1.000 normal(0,15)
## 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.343 0.072 2.201 2.483 2.343 3.533
## .F_c30 2.437 0.088 2.265 2.609 2.437 2.960
## .S_br23 1.765 0.063 1.640 1.889 1.765 3.137
## .S_c30 2.164 0.090 1.987 2.340 2.164 2.583
## .CV_Gral 0.837 0.510 -0.030 1.739 0.837 0.458
## .Salud 4.336 0.206 3.930 4.738 4.336 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.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.081 0.028 0.030 0.140 0.081 0.119
## .S_br23 0.207 0.036 0.147 0.288 0.207 0.653
## .S_c30 0.095 0.034 0.018 0.161 0.095 0.135
## .CV_Gral 0.434 0.112 0.150 0.641 0.434 0.130
## .Salud 1.532 0.331 0.895 2.206 1.532 0.447
## .funcionalidad 0.006 0.010 0.000 0.037 0.021 0.021
## sintomas 0.110 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.000 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]
blavCompare(fitref, fit2.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 915.836
##
## WAIC difference & SE:
## -1.039 0.107
##
## LOO estimates:
## object1: 914.152
## object2: 916.205
##
## LOO difference & SE:
## -1.026 0.123
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 3.602
blavCompare(fitedad1.0, fit2.0)
##
## WAIC estimates:
## object1: 915.901
## object2: 915.836
##
## WAIC difference & SE:
## -0.032 1.068
##
## LOO estimates:
## object1: 916.265
## object2: 916.205
##
## LOO difference & SE:
## -0.030 1.086
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): -3.315
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 ~ sintomas
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad + Edad + Con_companero_permanente
Salud ~ prior("normal(-10,10)")*sintomas + 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.677 0.052
##
## 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.156 1.171 1.783 0.772 0.938
## sintomas =~
## S_br23 1.000 0.331 0.589
## S_c30 2.348 0.502 1.661 3.568 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 -1.605 0.356 -2.455 -1.091 -0.989 -0.989
## CV_Gral ~
## Salud 0.740 0.101 0.549 0.906 0.740 0.751
## sintomas -1.402 8.033 -17.814 15.440 -0.464 -0.255
## funcionalidad -0.095 5.185 -10.676 10.763 -0.051 -0.028
## Edad -0.005 0.007 -0.019 0.008 -0.005 -0.034
## Cn_cmpnr_prmnn -0.016 0.162 -0.336 0.303 -0.016 -0.004
## Salud ~
## sintomas -5.552 8.300 -22.803 9.604 -1.839 -0.994
## funcionalidad -0.881 5.342 -12.219 8.950 -0.473 -0.256
## Rhat Prior
##
## 1.001 normal(0,10)
##
## 1.001 normal(0,10)
## 1.001 normal(0,10)
## 1.001 normal(0,15)
## 1.000 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.343 0.072 2.201 2.485 2.343 3.535
## .F_c30 2.438 0.088 2.263 2.611 2.438 2.964
## .S_br23 1.765 0.063 1.641 1.889 1.765 3.137
## .S_c30 2.164 0.090 1.988 2.342 2.164 2.587
## .CV_Gral 1.186 0.673 -0.076 2.508 1.186 0.651
## .Salud 4.336 0.206 3.930 4.740 4.336 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.207 0.036 0.147 0.288 0.207 0.653
## .S_c30 0.095 0.033 0.023 0.160 0.095 0.135
## .CV_Gral 0.431 0.119 0.109 0.642 0.431 0.130
## .Salud 1.537 0.341 0.878 2.228 1.537 0.449
## .funcionalidad 0.006 0.010 0.000 0.037 0.021 0.021
## sintomas 0.110 0.042 0.041 0.205 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, fit1.0_2.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 917.961
##
## WAIC difference & SE:
## -2.101 1.051
##
## LOO estimates:
## object1: 914.152
## object2: 918.437
##
## LOO difference & SE:
## -2.142 1.076
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 10.683
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 ~ sintomas + Estrato
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad
Salud ~ prior("normal(-10,10)")*sintomas + 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 -524.117 0.305
##
## 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.153 1.170 1.774 0.779 0.942
## sintomas =~
## S_br23 1.000 0.324 0.581
## S_c30 2.432 0.559 1.705 3.728 0.789 0.938
## 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 -1.642 0.393 -2.552 -1.104 -0.980 -0.980
## Estrato 0.083 0.061 -0.020 0.209 0.153 0.076
## CV_Gral ~
## Salud 0.755 0.071 0.615 0.890 0.755 0.765
## sintomas -1.470 4.080 -10.320 7.518 -0.477 -0.257
## funcionalidad -0.166 2.514 -5.464 5.406 -0.090 -0.049
## Salud ~
## sintomas -3.321 5.562 -16.734 6.192 -1.077 -0.574
## funcionalidad 0.582 3.412 -7.616 6.480 0.316 0.168
## Rhat Prior
##
## 1.001 normal(0,10)
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.001 normal(0,10)
## 1.001 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.222 0.114 1.992 2.435 2.222 3.332
## .F_c30 2.266 0.152 1.963 2.548 2.266 2.743
## .S_br23 1.765 0.063 1.643 1.889 1.765 3.160
## .S_c30 2.165 0.090 1.987 2.340 2.165 2.575
## .CV_Gral 0.852 0.359 0.177 1.575 0.852 0.460
## .Salud 4.209 0.390 3.403 4.953 4.209 2.242
## .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.077 0.027 0.025 0.134 0.077 0.112
## .S_br23 0.207 0.036 0.148 0.287 0.207 0.663
## .S_c30 0.084 0.035 0.006 0.153 0.084 0.119
## .CV_Gral 0.458 0.090 0.301 0.649 0.458 0.134
## .Salud 1.596 0.301 1.078 2.253 1.596 0.453
## .funcionalidad 0.010 0.013 0.000 0.047 0.035 0.035
## sintomas 0.105 0.041 0.038 0.197 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.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavCompare(fitref, fit3.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 913.51
##
## WAIC difference & SE:
## -0.124 1.396
##
## LOO estimates:
## object1: 914.152
## object2: 913.884
##
## LOO difference & SE:
## -0.134 1.402
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 4.123
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 ~ sintomas
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad + niveleducativo
Salud ~ prior("normal(-10,10)")*sintomas + 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.384 0.085
##
## 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.435 0.156 1.169 1.783 0.774 0.939
## sintomas =~
## S_br23 1.000 0.331 0.589
## S_c30 2.351 0.537 1.657 3.555 0.779 0.929
## 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 -1.611 0.383 -2.471 -1.089 -0.990 -0.990
## CV_Gral ~
## Salud 0.750 0.093 0.565 0.915 0.750 0.756
## sintomas -0.746 8.073 -17.344 15.958 -0.247 -0.135
## funcionalidad 0.305 5.179 -10.394 11.132 0.164 0.090
## niveleducativo 0.116 0.173 -0.220 0.457 0.116 0.030
## Salud ~
## sintomas -5.771 8.383 -23.089 9.753 -1.912 -1.034
## funcionalidad -1.010 5.361 -12.227 9.017 -0.545 -0.294
## Rhat Prior
##
## 1.001 normal(0,10)
##
## 1.000 normal(0,10)
## 1.001 normal(0,10)
## 1.001 normal(0,15)
## 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.343 0.072 2.200 2.485 2.343 3.529
## .F_c30 2.438 0.088 2.264 2.610 2.438 2.957
## .S_br23 1.765 0.063 1.640 1.889 1.765 3.136
## .S_c30 2.163 0.090 1.986 2.342 2.163 2.582
## .CV_Gral 0.690 0.478 -0.189 1.641 0.690 0.376
## .Salud 4.338 0.206 3.934 4.741 4.338 2.345
## .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.028 0.102 0.214 0.150 0.340
## .F_c30 0.081 0.027 0.031 0.139 0.081 0.119
## .S_br23 0.207 0.036 0.147 0.289 0.207 0.653
## .S_c30 0.096 0.033 0.025 0.161 0.096 0.136
## .CV_Gral 0.429 0.115 0.132 0.636 0.429 0.127
## .Salud 1.531 0.333 0.874 2.204 1.531 0.447
## .funcionalidad 0.006 0.009 0.000 0.035 0.020 0.020
## sintomas 0.110 0.042 0.041 0.205 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.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavCompare(fitref, fit4.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 915.473
##
## WAIC difference & SE:
## -0.857 0.762
##
## LOO estimates:
## object1: 914.152
## object2: 915.771
##
## LOO difference & SE:
## -0.809 0.801
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 3.390
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 ~ sintomas + Estrato
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad + niveleducativo
Salud ~ prior("normal(-10,10)")*sintomas + 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.778 0.124
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.544 0.816
## F_c30 1.433 0.154 1.169 1.770 0.780 0.943
## sintomas =~
## S_br23 1.000 0.325 0.581
## S_c30 2.427 0.552 1.693 3.750 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 -1.645 0.391 -2.589 -1.100 -0.981 -0.981
## Estrato 0.087 0.060 -0.018 0.214 0.160 0.079
## CV_Gral ~
## Salud 0.754 0.073 0.610 0.892 0.754 0.758
## sintomas -2.406 4.298 -12.462 6.237 -0.781 -0.418
## funcionalidad -0.693 2.624 -6.686 4.485 -0.377 -0.202
## niveleducativo 0.151 0.183 -0.205 0.516 0.151 0.039
## Salud ~
## sintomas -3.389 5.437 -16.405 5.925 -1.100 -0.585
## funcionalidad 0.544 3.342 -7.393 6.316 0.296 0.158
## 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,15)
## 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.113 1.987 2.428 2.217 3.322
## .F_c30 2.259 0.150 1.955 2.538 2.259 2.730
## .S_br23 1.765 0.063 1.642 1.888 1.765 3.157
## .S_c30 2.164 0.090 1.987 2.339 2.164 2.573
## .CV_Gral 0.701 0.420 -0.103 1.539 0.701 0.375
## .Salud 4.209 0.395 3.384 4.958 4.209 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.028 0.102 0.213 0.149 0.335
## .F_c30 0.076 0.027 0.027 0.132 0.076 0.111
## .S_br23 0.207 0.036 0.147 0.288 0.207 0.663
## .S_c30 0.087 0.034 0.011 0.153 0.087 0.123
## .CV_Gral 0.455 0.092 0.287 0.646 0.455 0.130
## .Salud 1.597 0.298 1.090 2.250 1.597 0.452
## .funcionalidad 0.009 0.012 0.000 0.044 0.031 0.031
## 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.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]
blavCompare(fitref, fit3.0_4.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 914.607
##
## WAIC difference & SE:
## -0.424 1.691
##
## LOO estimates:
## object1: 914.152
## object2: 915.029
##
## LOO difference & SE:
## -0.439 1.712
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 7.784
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 ~ sintomas + Situacion_laboral
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad
Salud ~ prior("normal(-10,10)")*sintomas + 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.889 0.192
##
## 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.421 0.153 1.158 1.757 0.770 0.937
## sintomas =~
## S_br23 1.000 0.328 0.585
## S_c30 2.375 0.570 1.672 3.570 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 -1.631 0.401 -2.479 -1.108 -0.988 -0.988
## Situacion_lbrl -0.019 0.051 -0.125 0.081 -0.035 -0.017
## CV_Gral ~
## Salud 0.758 0.085 0.599 0.916 0.758 0.767
## sintomas 0.354 6.618 -14.111 14.015 0.116 0.063
## funcionalidad 0.938 4.127 -8.052 9.531 0.508 0.277
## Salud ~
## sintomas -5.376 7.449 -21.342 8.246 -1.765 -0.950
## funcionalidad -0.723 4.647 -10.718 7.817 -0.392 -0.211
## Rhat Prior
##
## 1.001 normal(0,10)
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.001 normal(0,10)
## 1.001 normal(0,15)
##
## 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.373 0.108 2.160 2.586 2.373 3.569
## .F_c30 2.479 0.143 2.193 2.761 2.479 3.018
## .S_br23 1.765 0.063 1.642 1.887 1.765 3.147
## .S_c30 2.164 0.089 1.990 2.341 2.164 2.582
## .CV_Gral 0.940 0.397 0.199 1.740 0.940 0.512
## .Salud 4.254 0.359 3.478 4.928 4.254 2.291
## .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.028 0.031 0.140 0.082 0.121
## .S_br23 0.207 0.036 0.147 0.289 0.207 0.657
## .S_c30 0.095 0.033 0.020 0.162 0.095 0.135
## .CV_Gral 0.435 0.104 0.193 0.633 0.435 0.129
## .Salud 1.546 0.318 0.959 2.218 1.546 0.448
## .funcionalidad 0.007 0.011 0.000 0.039 0.024 0.024
## sintomas 0.108 0.041 0.041 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.001 gamma(1,.5)[sd]
## 1.000 gamma(1,.5)[sd]
blavCompare(fitref, fit5.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 915.674
##
## WAIC difference & SE:
## -0.958 0.692
##
## LOO estimates:
## object1: 914.152
## object2: 916.18
##
## LOO difference & SE:
## -1.014 0.710
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 4.895
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 ~ sintomas
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad
Salud ~ prior("normal(-10,10)")*sintomas + funcionalidad + regimensalud
# 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 -666.899 0.089
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.974 0.928
## F_c30 1.466 0.167 1.184 1.840 1.427 0.982
## sintomas =~
## S_br23 1.000 0.271 0.473
## S_c30 -5.831 12.200 -32.492 3.342 -1.581 -0.983
## Rhat Prior
##
##
## 1.031 normal(0,15)
##
##
## 3.277 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas 3.572 7.713 -2.321 20.299 0.995 0.995
## CV_Gral ~
## Salud 0.761 0.086 0.607 0.922 0.761 1.144
## sintomas 0.451 8.302 -16.456 17.488 0.122 0.100
## funcionalidad 0.556 4.179 -8.772 10.178 0.541 0.443
## Salud ~
## sintomas -6.718 8.915 -25.247 9.564 -1.821 -0.993
## funcionalidad 0.497 4.868 -11.171 7.971 0.484 0.264
## regimensalud 0.288 0.317 -0.337 0.913 0.288 0.076
## Rhat Prior
##
## 3.310 normal(0,10)
##
## 1.000 normal(0,10)
## 1.009 normal(0,10)
## 1.001 normal(0,15)
##
## 1.013 normal(-10,10)
## 1.111 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.200 2.484 2.342 2.231
## .F_c30 2.437 0.088 2.263 2.610 2.437 1.678
## .S_br23 1.765 0.065 1.639 1.893 1.765 3.078
## .S_c30 2.164 0.090 1.988 2.342 2.164 1.345
## .CV_Gral 0.798 0.384 0.080 1.496 0.798 0.654
## .Salud 3.865 0.559 2.761 4.960 3.865 2.106
## .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.154 0.029 0.104 0.220 0.154 0.140
## .F_c30 0.074 0.028 0.020 0.133 0.074 0.035
## .S_br23 0.255 0.082 0.152 0.443 0.255 0.777
## .S_c30 0.088 0.039 0.003 0.162 0.088 0.034
## .CV_Gral 0.443 0.104 0.198 0.641 0.443 0.297
## .Salud 1.550 0.322 0.964 2.222 1.550 0.460
## .funcionalidad 0.010 0.014 0.000 0.049 0.011 0.011
## sintomas 0.073 0.061 0.001 0.192 1.000 1.000
## Rhat Prior
## 1.012 gamma(1,.5)[sd]
## 1.043 gamma(1,.5)[sd]
## 1.902 gamma(1,.5)[sd]
## 1.034 gamma(1,.5)[sd]
## 1.022 gamma(1,.5)[sd]
## 1.004 gamma(1,.5)[sd]
## 1.100 gamma(1,.5)[sd]
## 1.866 gamma(1,.5)[sd]
blavCompare(fitref, fit6.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 936.114
##
## WAIC difference & SE:
## -11.178 2.066
##
## LOO estimates:
## object1: 914.152
## object2: 935.835
##
## LOO difference & SE:
## -10.841 2.085
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 146.905
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 ~ sintomas + Situacion_laboral
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad
Salud ~ prior("normal(-10,10)")*sintomas + funcionalidad + regimensalud
# 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 -528.101 0.124
##
## 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.425 0.154 1.161 1.765 0.771 0.939
## sintomas =~
## S_br23 1.000 0.329 0.586
## S_c30 2.375 0.563 1.669 3.593 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 -1.627 0.394 -2.483 -1.100 -0.988 -0.988
## Situacion_lbrl -0.019 0.050 -0.123 0.082 -0.036 -0.018
## CV_Gral ~
## Salud 0.767 0.082 0.614 0.932 0.767 0.777
## sintomas 0.597 6.548 -13.410 14.110 0.196 0.105
## funcionalidad 1.062 4.098 -7.663 9.575 0.575 0.308
## Salud ~
## sintomas -5.424 7.438 -21.445 8.033 -1.782 -0.943
## funcionalidad -0.685 4.652 -10.656 7.920 -0.371 -0.196
## regimensalud 0.290 0.315 -0.332 0.904 0.290 0.074
## Rhat Prior
##
## 1.001 normal(0,10)
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.001 normal(0,10)
## 1.001 normal(0,15)
##
## 1.001 normal(-10,10)
## 1.001 normal(0,10)
## 1.000 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.373 0.108 2.158 2.588 2.373 3.568
## .F_c30 2.481 0.144 2.195 2.765 2.481 3.019
## .S_br23 1.765 0.063 1.642 1.889 1.765 3.148
## .S_c30 2.163 0.090 1.986 2.339 2.163 2.580
## .CV_Gral 0.910 0.391 0.163 1.685 0.910 0.487
## .Salud 3.772 0.640 2.495 5.018 3.772 1.995
## .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.214 0.149 0.338
## .F_c30 0.080 0.027 0.030 0.138 0.080 0.119
## .S_br23 0.206 0.036 0.148 0.288 0.206 0.657
## .S_c30 0.095 0.034 0.019 0.162 0.095 0.135
## .CV_Gral 0.437 0.101 0.212 0.636 0.437 0.125
## .Salud 1.546 0.321 0.960 2.224 1.546 0.433
## .funcionalidad 0.007 0.011 0.000 0.041 0.024 0.024
## sintomas 0.108 0.041 0.041 0.202 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.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, fit5.0_6.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 916.925
##
## WAIC difference & SE:
## -1.583 1.170
##
## LOO estimates:
## object1: 914.152
## object2: 917.392
##
## LOO difference & SE:
## -1.620 1.188
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 8.107
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 ~ sintomas + Comorbilidad
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad
Salud ~ prior("normal(-10,10)")*sintomas + 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 -865.309 0.130
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.297 0.608
## F_c30 1.421 0.157 1.153 1.768 0.423 0.820
## sintomas =~
## S_br23 1.000 0.311 0.545
## S_c30 -1.607 9.079 -27.735 3.265 -0.500 -0.855
## Rhat Prior
##
##
## 1.026 normal(0,15)
##
##
## 3.533 normal(0,15)
##
## Regressions:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad ~
## sintomas 0.920 5.839 -2.294 17.606 0.963 0.963
## Comorbilidad 0.034 0.090 -0.123 0.187 0.115 0.054
## CV_Gral ~
## Salud 0.682 0.118 0.399 0.859 0.682 0.771
## sintomas -1.213 7.711 -17.039 12.566 -0.377 -0.254
## funcionalidad 0.441 4.384 -8.867 8.586 0.131 0.088
## Salud ~
## sintomas -4.829 11.827 -26.462 13.562 -1.503 -0.895
## funcionalidad 1.055 6.986 -13.146 11.747 0.314 0.187
## Rhat Prior
##
## 3.608 normal(0,10)
## 1.054 normal(0,10)
##
## 1.029 normal(0,10)
## 1.008 normal(0,10)
## 1.009 normal(0,15)
##
## 1.055 normal(-10,10)
## 1.025 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.285 0.166 1.988 2.594 2.285 4.670
## .F_c30 2.354 0.228 1.950 2.772 2.354 4.565
## .S_br23 1.766 0.064 1.641 1.891 1.766 3.095
## .S_c30 2.165 0.090 1.989 2.342 2.165 3.703
## .CV_Gral 0.714 0.420 -0.024 1.603 0.714 0.480
## .Salud 3.497 0.584 2.273 4.517 3.497 2.083
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.043 normal(0,32)
## 1.050 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.001 normal(0,10)
## 1.025 normal(0,10)
##
##
##
## Variances:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 0.151 0.029 0.101 0.217 0.151 0.631
## .F_c30 0.087 0.028 0.035 0.147 0.087 0.328
## .S_br23 0.229 0.069 0.146 0.414 0.229 0.703
## .S_c30 0.092 0.036 0.011 0.162 0.092 0.268
## .CV_Gral 0.416 0.107 0.166 0.618 0.416 0.188
## .Salud 1.372 0.345 0.650 2.057 1.372 0.486
## .funcionalidad 0.006 0.010 0.000 0.036 0.070 0.070
## sintomas 0.097 0.057 0.001 0.207 1.000 1.000
## Rhat Prior
## 1.014 gamma(1,.5)[sd]
## 1.031 gamma(1,.5)[sd]
## 1.753 gamma(1,.5)[sd]
## 1.025 gamma(1,.5)[sd]
## 1.021 gamma(1,.5)[sd]
## 1.019 gamma(1,.5)[sd]
## 1.097 gamma(1,.5)[sd]
## 1.528 gamma(1,.5)[sd]
blavCompare(fitref, fit7.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 924.195
##
## WAIC difference & SE:
## -5.218 2.224
##
## LOO estimates:
## object1: 914.152
## object2: 924.513
##
## LOO difference & SE:
## -5.181 2.236
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 345.315
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 ~ sintomas
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad + Estado_del_tumor
Salud ~ prior("normal(-10,10)")*sintomas + 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)
## 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.556 0.137
##
## 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.154 1.170 1.774 0.772 0.939
## sintomas =~
## S_br23 1.000 0.331 0.588
## S_c30 2.353 0.499 1.662 3.575 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 -1.609 0.357 -2.478 -1.093 -0.990 -0.990
## CV_Gral ~
## Salud 0.752 0.087 0.577 0.908 0.752 0.754
## sintomas -0.825 7.949 -16.926 15.970 -0.273 -0.148
## funcionalidad 0.272 5.085 -10.032 11.141 0.146 0.079
## Estado_del_tmr -0.158 0.170 -0.491 0.177 -0.158 -0.041
## Salud ~
## sintomas -5.867 8.231 -22.998 9.157 -1.940 -1.047
## funcionalidad -1.063 5.264 -12.072 8.676 -0.572 -0.308
## Rhat Prior
##
## 1.000 normal(0,10)
##
## 1.000 normal(0,10)
## 1.001 normal(0,10)
## 1.001 normal(0,15)
## 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.343 0.072 2.201 2.485 2.343 3.535
## .F_c30 2.438 0.087 2.267 2.609 2.438 2.963
## .S_br23 1.765 0.063 1.642 1.888 1.765 3.137
## .S_c30 2.164 0.089 1.990 2.338 2.164 2.586
## .CV_Gral 1.051 0.449 0.224 1.951 1.051 0.570
## .Salud 4.337 0.205 3.934 4.737 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.001 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.027 0.030 0.138 0.080 0.119
## .S_br23 0.207 0.037 0.147 0.290 0.207 0.655
## .S_c30 0.095 0.033 0.023 0.160 0.095 0.136
## .CV_Gral 0.428 0.110 0.155 0.631 0.428 0.126
## .Salud 1.538 0.326 0.922 2.214 1.538 0.448
## .funcionalidad 0.006 0.010 0.000 0.036 0.020 0.020
## 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.000 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]
blavCompare(fitref, fit8.0)
##
## WAIC estimates:
## object1: 913.759
## object2: 914.846
##
## WAIC difference & SE:
## -0.543 0.991
##
## LOO estimates:
## object1: 914.152
## object2: 915.233
##
## LOO difference & SE:
## -0.540 1.012
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 3.562
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 ~ sintomas + Comorbilidad
CV_Gral ~ Salud + sintomas + prior("normal(0,15)")*funcionalidad + Estado_del_tumor
Salud ~ prior("normal(-10,10)")*sintomas + 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.888 0.112
##
## Latent Variables:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## funcionalidad =~
## F_br23 1.000 0.542 0.814
## F_c30 1.409 0.151 1.148 1.739 0.763 0.931
## sintomas =~
## S_br23 1.000 0.339 0.600
## S_c30 2.280 0.457 1.636 3.345 0.774 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.583 0.332 -2.355 -1.096 -0.992 -0.992
## Comorbilidad 0.025 0.091 -0.127 0.179 0.045 0.021
## CV_Gral ~
## Salud 0.670 0.124 0.371 0.853 0.670 0.682
## sintomas -1.100 7.557 -16.707 11.767 -0.373 -0.207
## funcionalidad 0.317 4.873 -9.487 8.974 0.172 0.095
## Estado_del_tmr -0.175 0.167 -0.502 0.153 -0.175 -0.046
## Salud ~
## sintomas -3.120 11.549 -24.644 14.266 -1.059 -0.576
## funcionalidad 0.681 7.459 -13.249 12.151 0.369 0.201
## Rhat Prior
##
## 1.000 normal(0,10)
## 1.008 normal(0,10)
##
## 1.001 normal(0,10)
## 1.007 normal(0,10)
## 1.007 normal(0,15)
## 1.000 normal(0,10)
##
## 1.008 normal(-10,10)
## 1.008 normal(0,10)
##
## Intercepts:
## Estimate Post.SD pi.lower pi.upper Std.lv Std.all
## .F_br23 2.301 0.168 1.998 2.603 2.301 3.457
## .F_c30 2.378 0.229 1.967 2.781 2.378 2.900
## .S_br23 1.765 0.063 1.641 1.889 1.765 3.122
## .S_c30 2.165 0.089 1.990 2.339 2.165 2.599
## .CV_Gral 0.931 0.498 0.050 1.988 0.931 0.516
## .Salud 3.437 0.597 2.211 4.492 3.437 1.870
## .funcionalidad 0.000 0.000 0.000
## sintomas 0.000 0.000 0.000
## Rhat Prior
## 1.006 normal(0,32)
## 1.007 normal(0,32)
## 1.000 normal(0,32)
## 1.000 normal(0,32)
## 1.001 normal(0,10)
## 1.002 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.338
## .F_c30 0.090 0.028 0.040 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.025 0.162 0.095 0.136
## .CV_Gral 0.405 0.108 0.146 0.606 0.405 0.124
## .Salud 1.346 0.351 0.607 2.035 1.346 0.398
## .funcionalidad 0.004 0.007 0.000 0.022 0.015 0.015
## sintomas 0.115 0.042 0.047 0.211 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.001 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.428
##
## WAIC difference & SE:
## -0.665 2.709
##
## LOO estimates:
## object1: 914.152
## object2: 912.751
##
## LOO difference & SE:
## -0.700 2.742
##
## Laplace approximation to the log-Bayes factor
## (experimental; positive values favor object1): 47.894