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