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

Revision 1001, 1.9 kB (checked in by smidl, 14 years ago)

pf example

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