-
Notifications
You must be signed in to change notification settings - Fork 10
/
eMVAR_mos_idMVAR.m
36 lines (24 loc) · 1.11 KB
/
eMVAR_mos_idMVAR.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
%% Model Order Selection for identification strictly causal MVAR model
%%% input:
% Y, M*N matrix of time series (each time series is in a row)
% pmax, maximum tested model order
% idMode, determines estimation algorithm (0:builtin least squares, else other methods [see mvar.m from biosig package])
%%% output:
% pottaic: model order optimized with multichannel Akaike Information Criterion (AIC)
% pottaic: model order optimized with Minimum Description Length (MDL) criterion
% aic: values of AIC index as a function of the model order
% mdl: values of MDL index as a function of the model order
function [pottaic,pottmdl,aic,mdl] = eMVAR_mos_idMVAR(Y,pmax,idMode)
N=size(Y,2);
M=size(Y,1); %dimensionalità serie
% figures of merit
aic=NaN*ones(pmax,1); mdl=aic;
for p=1:pmax
[Am,S,Yp]=eMVAR_idMVAR(Y,p,idMode);
%formula multivariate AIC
aic(p)=N*log(det(S))+2*M*M*p; % S matrice di covarianza
%formula multivariate MDL
mdl(p)=N*log(det(S))+log(N)*M*M*p; % S matrice di covarianza
end
pottaic=find(aic == min(aic));
pottmdl=find(mdl == min(mdl));