如何在matlab中编码向量自回归模型?

时间:2014-12-09 21:27:26

标签: matlab machine-learning data-mining autoregressive-models causality

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

0 个答案:

没有答案