-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainScriptOU.m
More file actions
53 lines (36 loc) · 837 Bytes
/
mainScriptOU.m
File metadata and controls
53 lines (36 loc) · 837 Bytes
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
clc
clear
close all
includeFolders = genpath('include');
addpath( includeFolders );
data = load("data/OU/ou.mat");
x = data.X( 1, :);
x = x(:);
nData = length( x );
% Ground truth values
gt = {};
gt.k = 0.5;
gt.sigma = 1;
settings.dt = 0.1;
settings.nParticles = 1000;
dataOU = struct();
dataOU.x = data.X( 1, :);
ssFun = @(theta, data) -2 * ouParticleLikelihood( data, theta, settings);
model = struct();
model.ssfun = ssFun;
model.sigma2 = 1.0;
model.N = nData;
nIterations = 1000;
optionsAM.nsimu = nIterations;
optionsAM.updatesigma = 0;
optionsAM.waitbar = 1;
optionsAM.verbosity = 0;
optionsAM.method = 'dram';
parameters = {
{'Mean reversion rate: k', 0.5}
{'Random walk noise level: sigma', 1, 0}
};
tic
[~, chainAM] = mcmcrun( model, dataOU, parameters, optionsAM);
toc
saveResults( "ou", chainAM, x);