Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/Kalman/learn_AR.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function [coef, C] = learn_AR(data, k) | |
2 % Find the ML parameters of a vector autoregressive process of order k. | |
3 % [coef, C] = learn_AR(k, data) | |
4 % data{l}(:,t) = the observations at time t in sequence l | |
5 | |
6 warning('learn_AR seems to be broken'); | |
7 | |
8 nex = length(data); | |
9 obs = cell(1, nex); | |
10 for l=1:nex | |
11 obs{l} = convert_to_lagged_form(data{l}, k); | |
12 end | |
13 | |
14 % The initial parameter values don't matter, since this is a perfectly observable problem. | |
15 % However, the size of F must be set correctly. | |
16 y = data{1}; | |
17 [s T] = size(y); | |
18 coef = rand(s,s,k); | |
19 C = rand_psd(s); | |
20 [F,H,Q,R,initx,initV] = AR_to_SS(coef, C, y); | |
21 | |
22 max_iter = 1; | |
23 fully_observed = 1; | |
24 diagQ = 0; | |
25 diagR = 0; | |
26 [F, H, Q, R, initx, initV, loglik] = ... | |
27 learn_kalman(obs, F, H, Q, R, initx, initV, max_iter, diagQ, diagR, fully_observed); | |
28 | |
29 [coef, C] = SS_to_AR(F, Q, k); | |
30 |