% load data created by the MpdfDS_example load pdfds_results DS.class = 'MemDS'; DS.Data = Data; DS.drv = drv; %%%%%% ARX estimator conditioned on frg A1.class = 'ARXfrg'; A1.rv = y; A1.rgr = RVtimes([y,u],[-3,-1]) ; A1.log_level = 'logbounds,logevidence'; A1.frg = 0.9; A1.name = 'A1'; %%%%%% Random walk on frg - Dirichlet phi_pdf.class = 'mDirich'; % random walk on coefficient phi phi_pdf.rv = RV({'phi','1_phi'}); % 2D random walk - frg is the first element phi_pdf.k = 0.01; % width of the random walk phi_pdf.betac = [0.1 0.1]; % stabilizing elememnt of random walk %%%%%% Particle p.class = 'MarginalizedParticle'; p.parameter_pdf = phi_pdf; % Random walk is the parameter evolution model p.bm = A1; % prior on ARX %%%%%% Combining estimators in Marginalized particle filter E.class = 'PF'; E.particle = p; % ARX is the analytical part E.res_threshold = 1.0; % resampling parameter E.n = 100; % number of particles E.prior.class = 'eDirich'; % prior on non-linear part E.prior.beta = [2 1]; % E.log_level = 'logbounds,logevidence'; E.name = 'MPF'; [M,Str]=estimator(DS,{E}); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % plot results ndat = size(M.DS_u,1); figure(1); subplot(2,2,1); plotestimates(true_theta, M.MPF_apost_mean_theta, M.MPF_apost_lb_theta, M.MPF_apost_ub_theta); title(' Regression parameters \theta') set(gca,'YLim',[-1.5,1]); subplot(2,2,2); plotestimates(true_R, M.MPF_apost_mean_r,M.MPF_apost_lb_r,M.MPF_apost_ub_r); title('Variance parameters r') subplot(2,2,3); plotestimates(1, M.MPF_apost_mean_phi(:,1),M.MPF_apost_lb_phi(:,1),M.MPF_apost_ub_phi(:,1)); title('Forgetting factor')