semplicecorr.m

来自「统计工具软件」· M 代码 · 共 44 行

M
44
字号
function [delta,dev,cor,C] = semplicecorr(DX,DR,legame)%SEMPLICECORR	correlation between risk factors and assets (normal method).%%	[delta,dev,cor,C] = semplicecorr(DX,DR,legame) calculates the vector%   of delta coefficients, the standard deviation of risk factors, the%   correlation matrix and the variance-covariance matrix with unit%   ponderation of data. DX is the matrix of asset yields, DR is the matrix%   of risk factors yields.%   The vector legame set the relations between assets and risk factors.%   Given 2 risk factors and 4 assets the vector (1 1 1 2) means that the%   first three assets are related with the first risk factors, the fourth%   asset with the second risk factor.%%	All data must be in columns.%%	See RENDIMENTI%%	Copyright (c) 2004 by Flavio Bazzana%   Department of Computer and Management Sciences%   University of Trento%   38100 - Trento ITALY%   flavio.bazzana@economia.unitn.it% calculation of the correlation matrix and standard deviations% of risk factors with null averagen = size(DR,1);C = DR'*DR/(n-1);dev = sqrt(diag(C));cor = C./(dev*dev');% calculation of delta coefficientsn = size(DX,2);for i=1:n	h = legame(i);	p = polyfit(DR(:,h),DX(:,i),1);	delta(i) = p(1);enddelta = delta';

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?