www.pudn.com > tfarma10.rar > granger.m, change:2005-01-05,size:909b


clear;tfpm;
N    = 256;
MAR  =   3;
LAR  =   2;
MMA  =   0;
LMA  = LAR;
re_im= 'r';
mo_no= 'n';
F    =   2;
filename= sprintf('vtfar%02d%02d%02d%04d', MAR, LAR, F, N)
load(filename);
%-------------
alpha= 1/2;
beta = 1/2;
AML0= AML;
B0L0= B0L;

E0= randn(N, F);
X= real(vtfarma_gen(E0, AML, B0L, F, alpha));


%-------------

x= X(:, 1);
y= X(:, 2);

[Aml_x, B0l_x]= tfar(x, 5, 3);
[Aml_y, B0l_y]= tfar(y, 5, 3);

[AML_X, B0L_X]= vtfar(X, 5, 3);

[Mx, Lx]= param_dim(Aml_x)
[My, Ly]= param_dim(Aml_y)
[MX, LX]= param_dim(AML_X)

b0x= real(param_expand(B0l_x, N)).^2;
b0y= real(param_expand(B0l_y, N)).^2;

bji= real(param_expand(reshape(B0L_X(2, 1, :, :), 2*LX+1, 1), N)).^2;

bjj= real(param_expand(reshape(B0L_X(2, 2, :, :), 2*LX+1, 1), N)).^2;


GCij= log(b0y./(bji + bjj));

figure(1);clf;
subplot(4, 1, 1);plot(X(:, 1))
subplot(4, 1, 2);plot(X(:, 2))
subplot(4, 1, 3);plot(X)
subplot(4, 1, 4);plot(GCij)