Thank you.
Have amended the code, which seems to be working now, what do you think of it now (see below)?
I know it reports some indices more than once but that is ok for me.
---------------------------
# Install and load the required package
if (!require(blavaan)) install.packages("blavaan", dependencies = TRUE)
library(blavaan)
# Example dataset with 4 variables and 11 observations
set.seed(123)
data <- data.frame(
var1 = sample(1:100, 11, replace = TRUE),
var2 = sample(1:100, 11, replace = TRUE),
var3 = sample(1:100, 11, replace = TRUE),
var4 = sample(1:100, 11, replace = TRUE)
)
# Define a simple null model (no relationships)
null_model <- '
var1 ~~ var1
var2 ~~ var2
var3 ~~ var3
var4 ~~ var4
'
# Fit the model using Bayesian estimation with blavaan
fit_null <- blavaan(null_model, data = data)
# Print model fit summary
summary_fit_null <- summary(fit_null)
print(summary_fit_null)
# Report additional fit indices (WAIC, BIC, etc.)
fit_measures <- fitmeasures(fit_null, fit.measures = c("waic", "bic", "margloglik"))
print(fit_measures)
# Use lavaan (which blavaan builds upon) to get a collection of indices reported in a group
library(lavaan)
fitMeasures(fit_null)
----------------------------
I'm most interested in BIC because it is my understanding that knowing that for the alternative hypothesis and null models I can then get a BF10 value (using =exp((BIC_differential)/-2)). Which I can then multiply with another BF10 factor I have from another experiment.
Moreover, because when I run the alternative hypothesis model in JASP I get the following error messages with the returned results:
Warning: WAIC estimate unreliable - at least one effective parameter estimate (p_waic) larger than 0.4. We recommend using LOO instead.
Warning: LOO estimate unreliable - at least one observation with shape parameter (k) of the generalized Pareto distribution higher than 0.5.
But I've been told by EJ (one of developers of JASP) that in that case the BIC should still be reliable.
Of course, any comment(s) on anything here very gratefully received and appreciated.
Thank you again.