-
Notifications
You must be signed in to change notification settings - Fork 4
/
BINGO_main.m
38 lines (28 loc) · 916 Bytes
/
BINGO_main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
%% === BINGO ===
addpath('./BINGO_files/')
%initialization
[data,state,parameters]=BINGO_init(data);
% MCMC Burn-in
[~,chain,~,state,stats]=BINGO(data,state,parameters);
disp_stats(' BURN-IN COMPLETE',stats,chain,parameters.its)
% Actual sampling
parameters.its=10000;
[Plink,chain,xstore,state,stats]=BINGO(data,state,parameters);
disp_stats(' SAMPLING COMPLETE',stats,chain,parameters.its)
%The end result:
confidence_matrix=Plink/chain;
%% Collect more samples
%Store old information
chain_old=chain;
Plink_old=Plink;
xstore_old=xstore;
%Run new iterations
parameters.its=10000;
[Plink,chain,xstore,state,stats]=BINGO(data,state,parameters);
%Combine old and new results
xstore=chain_old/(chain+chain_old)*xstore_old+chain/(chain+chain_old)*xstore;
Plink=Plink_old+Plink;
chain=chain_old+chain;
disp_stats(' SAMPLING COMPLETE',stats,chain,parameters.its)
%The end result:
confidence_matrix=Plink/chain;