root/applications/bdmtoolbox/tutorial/userguide/frg_estim.m @ 900

Revision 900, 1.7 kB (checked in by smidl, 14 years ago)

particle bug fixing

  • Property svn:eol-style set to native
Line 
1% load data created by the MpdfDS_example
2load pdfds_results
3
4DS.class   = 'MemDS';
5DS.Data    = Data;
6DS.drv     = drv;
7
8%%%%%% ARX estimator conditioned on frg
9
10A1.class = 'ARXfrg';
11A1.rv = y;
12A1.rgr = RVtimes([y,u],[-3,-1]) ;
13A1.log_level = 'logbounds,logevidence';
14A1.frg = 0.9;
15A1.name = 'A1';
16
17
18%%%%%% Random walk on frg - Dirichlet
19phi_pdf.class = 'mDirich';         % random walk on coefficient phi
20phi_pdf.rv    = RV({'phi','1_phi'});       % 2D random walk - frg is the first element
21phi_pdf.k     = 0.01;              % width of the random walk
22phi_pdf.betac = [0.1 0.1];         % stabilizing elememnt of random walk
23
24%%%%%% Particle
25p.class = 'MarginalizedParticle';
26p.parameter_pdf = phi_pdf;         % Random walk is the parameter evolution model
27p.bm    = A1;
28
29% prior on ARX
30%%%%%% Combining estimators in Marginalized particle filter
31E.class = 'PF';
32E.particle = p;                    % ARX is the analytical part
33E.res_threshold = 1.0;             % resampling parameter
34E.n = 100;                          % number of particles
35E.prior.class = 'eDirich';         % prior on non-linear part
36E.prior.beta  = [2 1]; %
37E.log_level = 'logbounds,logevidence';
38E.name = 'MPF';
39
40[M,Str]=estimator(DS,{E});
41
42%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43% plot results
44ndat = size(M.DS_u,1);
45
46figure(1);
47subplot(2,2,1);
48plotestimates(true_theta, M.MPF_apost_mean_theta, M.MPF_apost_lb_theta, M.MPF_apost_ub_theta);
49title(' Regression parameters \theta')
50set(gca,'YLim',[-1.5,1]);
51
52subplot(2,2,2);
53plotestimates(true_R, M.MPF_apost_mean_r,M.MPF_apost_lb_r,M.MPF_apost_ub_r);
54title('Variance parameters r')
55
56subplot(2,2,3);
57plotestimates(1, M.MPF_apost_mean_phi(:,1),M.MPF_apost_lb_phi(:,1),M.MPF_apost_ub_phi(:,1));
58title('Forgetting factor')
59
Note: See TracBrowser for help on using the browser.