Closed strengejacke closed 2 months ago
This is actually an error in blavaan
:
library(bayestestR)
library(blavaan)
data("PoliticalDemocracy", package = "lavaan")
model <- "
# latent variable definitions
dem60 =~ y1 + a*y2
dem65 =~ y5 + a*y6
# regressions
dem65 ~ dem60
# residual correlations
y1 ~~ y5
"
model2 <- "
# latent variable definitions
dem60 =~ y1 + a*y2
dem65 =~ y5 + a*y6
# regressions
dem65 ~ 0*dem60
# residual correlations
y1 ~~ 0*y5
"
suppressWarnings(capture.output({
bfit <- blavaan::bsem(model,
data = PoliticalDemocracy,
n.chains = 1, burnin = 50, sample = 100
)
bfit2 <- blavaan::bsem(model2,
data = PoliticalDemocracy,
n.chains = 1, burnin = 50, sample = 100
)
}))
blavaan::blavCompare(bfit, bfit2)
#> Error in apply(diffs, 2, sum) : dim(X) must have a positive length
Opened an issue over there (https://github.com/ecmerkle/blavaan/issues/68)
This was recently discussed at the thread below, and it should be fixed on github.
So I think we can skip this test for now, but leave this issue open until that fix is on CRAN.
The main issue is fixed, but no BF is returned.
Sorry, wasn't meaning to close this.
From Ed's response it seems that there are cases where BF cannot be computed and so NA
is returned, and this is one of those cases. Should we give an error in such cases?
Also, I seem to be getting:
> insight::check_if_installed("blavaan")
Package `blavaan` is installed, but package version `0.55` is required.
Would you like to update it? [y/n]
Which seems to be coming from here:
insight:::.get_dep_version(dep = "blavaan")
#> [1] "0.55"
Which as far as I can tell is happening because the "0.5-5" is being parsed as "0.55"?
The latter issue is fixed here: https://github.com/easystats/insight/commit/144cdc15a49a102088c744dfd56cf47edd196de9
Agree on your suggestion that we should warn/error if BF is not possible to compute.
Thanks for taking care of this @strengejacke !
Can I submit?
👍
Created on 2023-10-02 with reprex v2.0.2
Originally posted by @strengejacke in https://github.com/easystats/bayestestR/issues/625#issuecomment-1742759315