-
Notifications
You must be signed in to change notification settings - Fork 0
/
ARstdsub.m
37 lines (30 loc) · 974 Bytes
/
ARstdsub.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
%----------------------------------------------------
%
% LS for AR(p) models With missing data
%
%----------------------------------------------------
%
% Parameter inference in AR processes with missing data
%
% Authors: Johan Dahlin, Fredrik Lindsten,
% Thomas B. Schön
%
% Presented at ERNSI workshop.
% Maastricht, NL, 2012
%
%----------------------------------------------------
function output = ARstdsub(sys,data,svar,opt)
if (svar.outliers==1)
m=armax(iddata(data.ye'),[opt.na 0],'LimitError',1.5);
output.thetahatSTD=-m.ParameterVector;
end
if (svar.missingdata==1)
output.thetahatSTD=BuildPhi(data.ye,sys.n)\data.ye';
end
output.yhatSTD=BuildPhi(data.yt,data.ye,sys.n)*output.thetahatSTD;
output.mfSTD=1-norm(data.yt'-output.yhatSTD)/norm(data.yt'-mean(data.yt'));
output.mseSTD=mean((output.thetahatSTD'-sys.a).^2);
end
%-----------------------------------------------
% End of File
%-----------------------------------------------