Home > General-Functions > Statistics > check_CovM.m

check_CovM

PURPOSE ^

test CovM

SYNOPSIS ^

function [lambda, T, F] = check_CovM(C_empir, C_theor, m, S)

DESCRIPTION ^

 test CovM

 [lambda,T,F] = check_CovM(C_empir,C_theor,m,S)

 C_empir = empirical covariance matrix
 C_theor = theoretical covariance matrix
 m       = sample size for determining empirical CovM
 S       = significance level (close to 1)

 lambda  = test statistic
 T       = chi^2 threshold
 F       = refined F threshold

 Wolfgang Förstner 2/2012
 wfoerstn@uni-bonn.de

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % test CovM
0002 %
0003 % [lambda,T,F] = check_CovM(C_empir,C_theor,m,S)
0004 %
0005 % C_empir = empirical covariance matrix
0006 % C_theor = theoretical covariance matrix
0007 % m       = sample size for determining empirical CovM
0008 % S       = significance level (close to 1)
0009 %
0010 % lambda  = test statistic
0011 % T       = chi^2 threshold
0012 % F       = refined F threshold
0013 %
0014 % Wolfgang Förstner 2/2012
0015 % wfoerstn@uni-bonn.de
0016 
0017 function [lambda, T, F] = check_CovM(C_empir, C_theor, m, S)
0018 
0019 p = size(C_empir, 1);
0020 
0021 lambda = m * (log(det(C_theor) / det(C_empir)) - p + trace(C_empir * inv(C_theor))); %#ok<MINV>
0022 
0023 Tup = chi2inv(1 - (1 - S) / 2, 0.5 * p * (p + 1));
0024 Tlow = chi2inv((1 - S) / 2, 0.5 * p * (p + 1));
0025 T = [Tlow, Tup];
0026 
0027 D1 = (2 * p + 1 - 2 / (p + 1)) / (6 * m);
0028 D2 = (p - 1) * (p + 2) / (6 * m ^ 2);
0029 q1 = p * (p + 1) / 2;
0030 q2 = (q1 + 2) / (D2 - D1 ^ 2);
0031 b = q1 / (1 - D1 - q1 / q2);
0032 q2 = min(10000, q2);
0033 Fup = b * finv(1 - (1 - S) / 2, q1, q2);
0034 Flow = b * finv((1 - S) / 2, q1, q2);
0035 F = [Flow, Fup];
0036 
0037 
0038

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005