covariog.m
来自「Neural Network in Finance (神经网络在金融界:赢得预言」· M 代码 · 共 25 行
M
25 行
function c=covariog(X,maxtau);
%COVARIOG Computes covariograms.
% c=covariog(x,maxtau) calculates the covariogram for each
% column of the T x n matrix X where
%
% c(tau,:)=cov( X(t,:), X(t-tau,:) ), tau=-maxtau,...,maxtau
%
% Thus, the ith column of c is the covariogram for the ith
% column of X, i=1,...n.
% Ellen R. McGrattan, 11-13-87
%
[T,n]=size(X);
if T-maxtau<=0;
str='The number of observations in the time series must be larger than tau';
error(str);
end;
for i=1:n;
for j=1:maxtau+1;
vcov=cov([X(j:T,i),X(1:T-j+1,i)]);
c(j,i)=vcov(2,1);
end;
end;
c=[c(maxtau+1:-1:2,:);c];
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?