This repository hosts the code for reproducing the results of the manuscript "Reliable model selection in the presence of parameter non-identifiability" (arXiv preprint). Bayesian model selection is performed by computing model posterior probabilities exhaustively, which requires the evidence of each model to be approximated deterministically or estimated with Monte Carlo methods. The following methods for computing model evidence are implemented:
- Bayesian information criterion (BIC),
- Laplace importance sampling (Laplace IS),
- standard adaptive multiple importance sampling (standard AMIS),
- robust adaptive multiple importance sampling (robust AMIS), and
- bridge sampling.
N.B. This code repository is not compatible with versions of PEtab.jl beyond v3.11.3, due to breaking changes in how PEtab.jl v4 handles parameter transformations. This compatibility requirement is reflected in the Project.toml of this repository.
The example in Section 5.1 is adapted from Simpson et al. (2022). Model selection is performed over three sigmoidal growth models based on 11 time series observations of coral re-growth. The results are obtained by running the following scripts.
-
Running
coral/download_data.jldownloads the dataset from the Github repository SigmoidGrowth and saves it ascoral/data.xlsx. -
Running
coral/fit_MAP.jlfinds the maximum a posteriori estimate and its corresponding Hessian for all three models and saves the results incoral/output/MAPs.jld2. -
Running
coral/laplace_IS.jlperforms Laplace IS for all three models. The script takes in the repeat index[n](1 to 100) as a command line argument, and saves the result for model[m]incoral/output/seed[n]/laplace_IS_[m].jld2. Standard AMIS and robust AMIS are run similarly using the scriptscoral/orig_AMIS.jlandcoral/robust_AMIS.jlinstead. -
Running
coral/MCMC_chains.jlruns MCMC to sample from the parameter posterior distributions of all three models. The script takes in the repeat index[n](1 to 100) as a command line argument, and saves the result for model[m]incoral/output/seed[n]/chains_[m].jld2. -
Running
coral/bridge_sampling.jlpost-processes the MCMC samples for bridge sampling. The script takes in the repeat index[n](1 to 100) as a command line argument, and saves the result for model[m]incoral/output/seed[n]/BS_[m].jld2. -
The scripts
coral/plot_logistic_richards.jl,coral/plot_errors_K.jl,coral/plot_data.jl,coral/plot_indiv_posteriors.jlreproduce Figure 1, Figure 2, Figure S1, Figure S2, respectively.
The example in Section 5.2 features a hypothetical insect with egg, larva, and adult life stages. Each possible model consists of three core mechanisms (life stage transition and reproduction) and a subset out of six candidate death mechanisms. Model selection is performed over
-
Running
insect/generate_datasets.jlgenerates 44 synthetic datasets of the populations of each life stage. Ground truth parameters are tuned such that they have an order of magnitude close to$10^0$ , the trajectories of all datasets end at a similar state, and the final-time derivatives are not too large. Each dataset corresponds to a different model; 20 models are excluded as they are unable to sustain a stable positive equilibrium. The ground truth parameters are saved ininsect/params.jld2, while the datasets are saved ininsect/data.jld2. -
Running
insect/fit_MAP.jlfinds the maximum a posteriori estimate and its corresponding Hessian for all 64 models. The script takes in the dataset index[d](1 to 44) as a command line argument, and saves the result (all models) for dataset[d]ininsect/output/data[d]/MAP.jld2andinsect/output/data[d]/MAP_hess.jld2. -
Running
insect/laplace_IS.jlperforms Laplace IS for all 64 models. The script takes in the dataset index[d](1 to 44) as a command line argument, and saves the result (all models) for dataset[d]and model[m]ininsect/output/data[d]/laplace_IS_model[m].jld2. Standard AMIS and robust AMIS are run similarly using the scriptsinsect/orig_AMIS.jlandinsect/robust_AMIS.jlinstead. -
Running
insect/MCMC_chains.jlruns MCMC to sample from the parameter posterior distributions of all 64 models. The script takes in the dataset index[d](1 to 44) as a command line argument, and saves the result (all models) for dataset[d]and model[m]ininsect/output/data[d]/chains_model[m].jld2. -
Running
insect/bridge_sampling.jlpost-processes the MCMC samples for bridge sampling. The script takes in the dataset index[d](1 to 44) as a command line argument, and saves the result (all models) for dataset[d]and model[m]ininsect/output/data[d]/BS_model[m].jld2. -
The scripts
insect/plot_comparison.jl,insect/plot_model_posterior.jl,insect/plot_data.jl,insect/plot_param_posteriors.jlreproduce Figure 3, Figure 4, Figure S3, Figure S4, respectively. The variables namedLOAD_XXXininsect/plot_comparison.jlshould be set tofalsewhen running the script for the first time.