VAR モデルは、単変量自己回帰 (AR) モデルを複数の時系列に一般化します。時間 t の観察に基づいて次の式を概説するベクトル自己回帰モデルを実装したいと思います。
x(t) = c + (t-1)∑(i = t + T)* a(i)x(i) + €(t)
a(i) = モデルのパラメータ €(t) = ガウス ノイズ
私が使用しているデータは非常に大きいので投稿しませんが、合成データの隣接行列を出力することは助けが必要です。これは私が持っているものです:
function [ beta, adj,results ] = granger( id, t, X, lambda, lag, param )
%GRANGER Graphical Granger Modeling
% INPUTS: id = Column with n elements of unique subject identifiers used to indicate
% measurements from the same subjects.
% t = Column with n elements of measurement times corresponding to id.
% NB: AT THE MOMENT ASSUMING EQUISPACED DATA.
% X = n-by-(p+1) Matrix of covariates corresponding to id and t.
% lambda = tunning parameter for the penalty terms.
% param = Struct of any other parameters you want to pass to your
% code.
% lag = value of time lag to look backward from current time.
% OUTPUTS: bhat = estimated effects parameters corresponding to X.
% adj = adjacency matrix among the columns of X.
% results = Struct of any other results you want to send out
% from your code.
if nargin<5; param={}; end;
% if ~isfield(param,'maxIt'); param.maxIt = 1000; end %For example, set max iterations as 1000.
% if ~isfield(param,'tol'); param.tol = 0.00001; end; % Convergence tolerance;
a = ucf.x;
b = ucf.y;
end