Skip to content

A sampling-based implementation of the Bayesian model-selection method of Stephan et al. (2009) in NeuroImage.

License

Notifications You must be signed in to change notification settings

modirshanechi/MCMCbasedBayesianMS.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCMCbasedBayesianMS.jl

This package provides a sampling-based implementation of the Bayesian model-selection method of Stephan et al. (2009) in NeuroImage. Earlier versions of this code were used for the analyses in Modirshanechi et al. (2025a) and Modirshanechi et al. (2025b).

Theory

The theoretical details behind the implementation of the package are provided in theory.pdf.

Preview

Installation

using Pkg; Pkg.add(url = "https://github.com/modirshanechi/MCMCbasedBayesianMS.jl", rev="main")

Usage

using MCMCbasedBayesianMS

# generating a synthetic data set
#   20 subjects * 2 models
#   LMatrix[n,m] = log-prob of subject n under model m
LMatrix = (rand(20,2) .- 1) * 10;
#   assigning the first 15 to model 1 and the rest to model 2
LMatrix[1:15,1] .+= 10; LMatrix[16:20,2] .+= 10; 

# Bayesian Model Selection (BMS) object with 10 chains and 100K samples per chain
BMS = BMSObj(LMatrix, 
        bms_basechain = BMSBase(n_chains = 10, n_samples = 100000),
        bms_borsamp = BMSBorSampNaive(n_samples = 100000))

# performing inference
InfResults = doBMSinference(BMS)

# plotting the statistics
plotstats(InfResults)

Expected outcome: PDF Preview

# plotting the density of model frequency for different chains
plotrsamples(InfResults,figsize=(500,300))

Expected outcome: PDF Preview

About

A sampling-based implementation of the Bayesian model-selection method of Stephan et al. (2009) in NeuroImage.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages