0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 function f = check_estimation_result(R, x_true, C0, s0q_sample, x_sample, S, text)
0022
0023
0024 U = length(x_true);
0025
0026 K = length(find(s0q_sample(:) > 0));
0027
0028 disp('++++++++++++++++++++++++++++++++++++++++++++++++')
0029 disp(strcat('Checks for ', text))
0030 disp(['Number U of unknown parameters = ', num2str(U)]);
0031 disp(['Redundancy R = ', num2str(R)]);
0032 disp(['Number K of samples = ', num2str(K)]);
0033 disp('-------------------------------------------------')
0034
0035
0036 me = mean(x_sample);
0037 dx = me'-x_true;
0038 Ce = cov(x_sample);
0039
0040
0041 if sum(s0q_sample) ~= K
0042 mean_s02 = mean(s0q_sample);
0043 F_tol_o = finv(1 - (1 - S) / 2, K * R, 100000);
0044 F_tol_u = finv((1 - S) / 2, K * R, 100000);
0045
0046 if mean_s02 > F_tol_u && mean_s02 < F_tol_o
0047 disp(['variance factor s_0^2 ok: mean(s_0^2) = ', ...
0048 num2str(mean_s02, '% 12.4f'), ' in [', ...
0049 num2str(F_tol_u, '% 12.4f'), ',', num2str(F_tol_o, '% 12.4f'), ']']);
0050 else
0051 disp(['variance factor s_0^2 not ok: mean(s_0^2) = ', ...
0052 num2str(mean_s02, '% 12.4f'), ' not in [', ...
0053 num2str(F_tol_u, '% 12.4f'), ',', num2str(F_tol_o, '% 12.4f'), '] *****']);
0054 end
0055
0056
0057 screensize = plot_init;
0058 f = figure('Color', 'w', 'Position', [20 20 screensize / 2]);
0059 hold on
0060
0061 N_bin = ceil(sqrt(K));
0062
0063 hist(s0q_sample, N_bin);
0064
0065 [~, r] = hist(s0q_sample, N_bin);
0066
0067 range = abs(r(N_bin) - r(1)) * N_bin / (N_bin - 1);
0068
0069 plot(r, N_bin * range * fpdf(r, R, 10000), '-r', 'LineWidth', 2);
0070 title(['Histogram of ', num2str(K), ' variance factors with reference density (', text, ')']);
0071 end
0072
0073
0074
0075
0076
0077 [lambda, T] = sugr_check_CovM(Ce, C0, K, S);
0078
0079 if lambda > T(2) && lambda < T(1)
0080 disp(['covariance matrix C_xx ok: lambda = ', ...
0081 num2str(lambda, '% 12.4f'), ' in [', num2str(T(2), '% 12.4f'), ...
0082 ',', num2str(T(1), '% 12.4f'), ']']);
0083 else
0084 disp(['covariance matrix C_xx not ok: lambda = ', ...
0085 num2str(lambda, '% 12.4f'), ' not in [', num2str(T(2), '% 12.4f'), ...
0086 ',', num2str(T(1), '% 12.4f'), '] *****']);
0087 end
0088
0089
0090
0091 X_mean = K * dx' * inv(Ce) * dx;
0092 X_mean_tol_h = chi2inv(1 - (1 - S) / 2, U);
0093 X_mean_tol_l = chi2inv((1 - S) / 2, U);
0094
0095 if X_mean < X_mean_tol_h && X_mean > X_mean_tol_l
0096 disp(['mean of parameters x ok: mean(dx) = ', ...
0097 num2str(X_mean, '% 12.4f'), ' in [', ...
0098 num2str(X_mean_tol_l, '% 12.4f'), ',', num2str(X_mean_tol_h, '% 12.4f'), ']']);
0099 else
0100 disp(['mean of parameters x not ok: mean(dx) = ', ...
0101 num2str(X_mean, '% 12.4f'), ' not in [', ...
0102 num2str(X_mean_tol_l, '% 12.4f'), ',', num2str(X_mean_tol_h, '% 12.4f'), ']', ' *****']);
0103 end
0104