% diagnostics 1d given all parameters of a linearized estimation problem determine the essential diagnostic values assuming the number N of observations is small enough (requires several NxN matrices) r_U = index set for parameters to be estimated (others are nuisance) Am = Jacobian Cov_ll = CovM of observations W_ll = WeightM of observations Cov_xx = CovM of all estimated parameters W_xx = WeightM of all estimated parameters vv = residuals riv = redundancy numbers zv = standardized test statistics nabla_lv = lowe bound for detectable outliers muv = influence factor for all parameters muv1 = influence factor for parameters specified by r_U uv1q = diagonal elements of \bar U_1 (numerator of muv1^2) uv2 = diagonal elements of U2 Wolfgang Förstner 10/2016 wfoerstn@uni-bonn.de
0001 %% diagnostics 1d 0002 % 0003 % given all parameters of a linearized estimation problem 0004 % determine the essential diagnostic values 0005 % assuming the number N of observations is small enough 0006 % (requires several NxN matrices) 0007 % 0008 % r_U = index set for parameters to be estimated (others are nuisance) 0009 % Am = Jacobian 0010 % Cov_ll = CovM of observations 0011 % W_ll = WeightM of observations 0012 % Cov_xx = CovM of all estimated parameters 0013 % W_xx = WeightM of all estimated parameters 0014 % vv = residuals 0015 % 0016 % riv = redundancy numbers 0017 % zv = standardized test statistics 0018 % nabla_lv = lowe bound for detectable outliers 0019 % muv = influence factor for all parameters 0020 % muv1 = influence factor for parameters specified by r_U 0021 % uv1q = diagonal elements of \bar U_1 (numerator of muv1^2) 0022 % uv2 = diagonal elements of U2 0023 % 0024 % Wolfgang Förstner 10/2016 0025 % wfoerstn@uni-bonn.de 0026 0027 function [riv,zv,nabla_lv,muv,muv1,uv1q,uv2] = ... 0028 diagnostics_GMM_1d(r_U,Am,Cov_ll,W_ll,Cov_xx,W_xx,vv) 0029 0030 % non-centrality parameter for alpha_0 = 0.001, beta_0 = 0.8 0031 delta_0 = 4.13; 0032 0033 [N,U] = size(Am); 0034 %% observations: detectatbility, statistical test 0035 Rm = eye(N)-Am*Cov_xx*Am'*W_ll; % redundancy matrix 0036 riv = diag(Rm); % redundancy numbers 0037 zv = vv./sqrt(riv.*diag(Cov_ll)+eps); % normalized residuals 0038 nabla_lv = delta_0 * sqrt(1./riv); 0039 0040 %% sensitivity wrtall parameters 0041 muv = sqrt((1-riv)./(riv+eps)); % sensitivity factors 0042 0043 %% sensitivity wrt selected parameters 0044 if ~isempty(r_U) 0045 % ranges 0046 r_C= r_U; 0047 r_D= setdiff(1:U,r_U); 0048 % partitioned design matrix A=[C,D] 0049 Cm = Am(:,r_C); 0050 Dm = Am(:,r_D); 0051 % reduced design matrix 0052 Cmr = Cm - Dm * inv(W_xx(r_D,r_D)) * W_xx(r_D,r_C); %#ok<*MINV> % C_reduced 0053 Cov_11 = Cov_xx(r_C,r_C); 0054 % effect onto parameters 0055 U1q = Cmr * Cov_11 * Cmr' * W_ll; % U_C_bar 0056 uv1q = diag(U1q); % u_C_bar 0057 U2 = Dm * inv(W_xx(r_D,r_D)) * Dm' * W_ll; % U_D 0058 uv2 = diag(U2) ; % u_D 0059 % sensitivity factors 0060 muv1 = sqrt(uv1q ./ riv); 0061 0062 % check = uv1q+uv2+riv; % should be ones 0063 end