MatlabDiffNestAlg

작성자: Weston Roda
This software is a Matlab implementation of the Brewer, Partay, Csanyi, Foreman-Mackey Diffusive Nested Sampling algorithm
업데이트 날짜: 2022/2/28
MatlabDiffNestAlg
Copyright (C) 2022 Weston C. Roda and Donglin Han
Diffusive Nested Sampling Matlab implementation
License
GNU General Public License v3.0
----------
V1.2
- In the first phase, keep track of the time to create each level and the total time elapsed to create the current highest level, and added time estimate for the time remaining to reach the maximum level specified
-In the second phase, keep track of the total time elapsed and added time estimate for the time remaining to finish sampling
- Added an index when the string array 'par_names' is displayed that indicates the order of the parameter in the parameter vector
- In “TheoreticalExample2”, added the calculation for the Bayesian p-value that measures the evidence against the null hypothesis that the model predictions fit the data
- A reference to the fitting plot is now passed to the "Diff_Nest_Alg" function for users to quickly reference their own model visualization
- The logarithm of the evidence (log Z) is now calculated instead of the evidence (Z) since in many applications the evidence is a very small number
V1.1
- Added a string array called 'par_names' that displays the names of the parameters along with their current best fit values as the diffusive nested sampling is occurring
- Saved the generated disease data figure plot in the "generated_disease_data" .fig file
- Corrected the logarithm prior function in Theoretical Example 2 (since the prior distribution used in “TheoreticalExample2” is a product of uniform distributions, the resulting joint distribution already integrates to one)
----------
Derived Work
This software is a Matlab implementation of the Brewer, Partay, Csanyi, Foreman-Mackey Diffusive Nested Sampling algorithm based off of elements of DNest5 ((c) 2020 Brendon J. Brewer) and the following papers:
Brewer BJ, Partay LB, Csanyi G (2011) Diffusive Nested Sampling. Stat Comput 21(4):649-656. https://doi.org/10.1007/s11222-010-9198-8
Brewer BJ, Foreman-Mackey D (2016) DNest4: Diffusive Nested Sampling in C++ and Python. J Stat Softw 86(7):1-33. http://dx.doi.org/10.18637/jss.v086.i07
Skilling J (2006) Nested Sampling for General Bayesian Computation. Bayesian Anal. 1(4): 833-859. https://doi.org/10.1214/06-BA127
The Chen-Shao Highest Posterior Density (HPD) Estimation Algorithm is used for finding the lower and upper bounds of the Highest Posterior Density for each estimated parameter. This algorithm can be found in the following book:
Chen M, Shao Q, Ibrahim JG (2000) Monte Carlo Methods in Bayesian Computation. New York-New York: Springer-Verlag.
The Bayesian p-value (posterior predictive p-value) is used for testing the goodness of fit of the model to the data. The description of this statistical test is found in the following references:
Gelman A, Meng XL, Stern HS (1992) Bayesian Tests for Goodness of Fit Using Tail Area Probabilities. Technical Report No. 372. University of California Berkeley.
Gelman A, Carlin JB, Stern HS, Dunson DB, Vehtari A, Rubin DB (2013) Bayesian Data Analysis (3rd ed.). Chapman and Hall/CRC.
There are two main folders contained in this code.
Sampling_Code:
This folder contains 11 Matlab function .m files:
Diff_Nest_Alg.m
fitting_plot.m
getLogZ.m
HPD.m
jumpDNS.m
median_function.m
move.m
multnbinrnd.m
randh.m
renormalise_visits_matrix.m
wrapper_function.m
The “Diff_Nest_Alg” .m file is the main function that runs the Diffusive Nested Sampling algorithm. The “Diff_Nest_Alg” .m file explains the input and output functions of this Software. The “HPD” .m file is used after the Diffusive Nested Sampling algorithm is completed to find the lower and upper bounds of the Highest Posterior Density for each estimated parameter. (Please see the Examples.) This Diffusive Nested Sampling Matlab implementation is designed to use uniform prior distributions for each parameter. The width of the uniform prior distributions specified for each parameter are used inside of the algorithm to generate proposals for that parameter during the particle’s “move” phase. This Diffusive Nested Sampling Matlab implementation also assumes that the integration of the prior over the parameter space equals 1. Since the prior distribution used in “TheoreticalExample1” and “TheoreticalExample2” is a product of uniform distributions, the resulting joint distribution does integrate to one.
Examples:
This folder contains two different example subfolders: “TheoreticalExample1”, which is a theoretical example from Section 5 of Brewer’s 2011 paper cited above; and “TheoreticalExample2” is a theoretical example from Roda’s 2020 paper cited below.
Roda WC (2020) Bayesian inference for dynamical systems. Infect Dis Model 5:221-232. https://doi.org/ 10.1016/j.idm.2019.12.007
TheoreticalExample1:
This folder contains 3 Matlab function .m files and 5 Matlab figure .fig files:
Brewer_Sec_5_script.m
Brewer_Sec_5_log_Z.fig
freq_x1.fig
level_diff_log_X.fig
log_X_log_l.fig
loglike_Sec_5.m
logprior_Sec_5.m
post_surf_x1.fig
The “Brewer_Sec_5_script” .m script file walks through using the “Diff_Nest_Alg” function and how to find posterior quantities of interest.
TheoreticalExample2:
This folder contains 2 Matlab function .m files, 9 Matlab figure .fig files, and 1 Matlab data .mat file:
disease_model_log_Z.fig
freq_N.fig
freq_p.fig
freq_r.fig
freq_x0.fig
generated_disease_data.fig
Logistic_script.m
LogisticData.mat
max_post_solution.fig
post_predictive_solution.fig
true_logistic_model.fig
x_func.m
The “Logistic_script” .m script file walks through using the “Diff_Nest_Alg” function for fitting an ODE model to simulated disease data and how to find posterior quantities of interest.

인용 양식

Roda, Weston Christopher, and Donglin Han. MatlabDiffNestAlg: V1.1. Zenodo, 2021, doi:10.5281/ZENODO.5167973.

양식 더 보기
MATLAB 릴리스 호환 정보
개발 환경: R2019b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!