-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdlmplotcomp.m
48 lines (40 loc) · 998 Bytes
/
dlmplotcomp.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
39
40
41
42
43
44
45
46
47
48
function out = dlmplotcomp(dlm, t, ys, yind)
%DLMPLOTCOMP Default plot for some DLM model components
% dlmplotcomp(dlm, t, ys, yind)
% dlm - output from dlmsmo
% t - time axis for plots
% ys - optional y axis scale factor for plots
% yind - which series to plot, default = 1
% Marko Laine <[email protected]>
% $Revision: 0.0 $ $Date: 2013/07/12 12:00:00 $
if nargin<2
t = (1:size(dlm.y,1))'; % yscale for plots
end
if nargin<3
ys = 1; % yscale for plots
end
if nargin<4
yind = 1; % which obs column to plot
end
y = dlm.y; % obs
s = dlm.V; % obs std
p = size(dlm.F,1); % data columns
m = size(dlm.G,1); % states
mm = m/p; % states / obs columns
dlmconf = @(dlm,ind,t,ys) confband(t,ys.*dlm.x(ind,:)',ys.*dlm.xstd(:,ind));
% level and trend
ind = 1 + mm*(yind-1);
subplot(2,1,1);
dlmconf(dlm,ind,t,ys);
grid
title('level');
xlim([min(t),max(t)]);
ind = 2 + mm*(yind-1);
subplot(2,1,2);
dlmconf(dlm,ind,t,ys);
grid
title('trend');
xlim([min(t),max(t)]);
if nargout>1
out = [];
end