# Define a data frame with information criteria from model fits
# (this is a sub-data.frame from an output of fitRTConfModels with
# 8 subjects, three models and rounded information criteria)
fits <- data.frame(
participant = rep(1:8, each=3),
model = rep(c("dynaViTE", "2DSD", "PCRMt"), 8),
BIC = c(5318, 5665, 1659, 3856, 5508, 3982, 3950, 3998,
4114, 4216, 4314, 4419, 3170, 3489, 3256, 1950,
1934, 2051, 3194, 3317, 3359, 9656, 10161, 4024),
AIC = c(5211, 5577, 1577, 3750, 5420, 3899, 3843, 3911,
4031, 4109, 4226, 4337, 3063, 3401, 3173, 1844,
1847, 1969, 3087, 3229, 3277, 9549, 10074, 3942),
AICc = c(5212, 5578, 1577, 3751, 5421, 3900, 3844, 3911,
4032, 4110, 4227, 4337, 3064, 3402, 3174, 1845,
1848, 1970, 3088, 3230, 3277, 9550, 10074, 3942))
# Compute subject-wise model probabitilities based on different ICs
subject_modelweights(fits, measure = "BIC")
subject_modelweights(fits, measure = "AIC")
subject_modelweights(fits, measure = "AICc")
# Conduct group-level Bayesian model selection based on BIC
group_BMS_fits(fits, measure="BIC")
## General group-level Bayesian model selection based on any marginal log-probabilities
# Compute marginal log-likelihood based on BIC from fits
mlp <- matrix(NA, ncol=8, nrow=3)
for (i in 1:8) mlp[,i] <- fits[(i-1)*3 + 1:3, "BIC"]
mlp <- - mlp/(2)
rownames(mlp) <- c("dynaViTE", "2DSD", "PCRMt")
# conduct group BMS:
group_BMS(mlp)
Run the code above in your browser using DataLab