How can I calculate the probability of false detection?

3 次查看(过去 30 天)
Hello everyone!
I need to justify for my dissertation the problems of false detection of a signal by a normal distribution (Gaussian) and build a graph where I should get a decreasing exponent in the interval for P from 10^-8 to 10^-1, and for alpha squared (alpha^2) from 10 to 100. The sigma dispersion = from 10 to 100. The threshold value of the signal n2 = 1.5, from which the normal value is integrated to infinity to calculate the probability of P.
I wrote the following code:
% Given parameters
sigma2_values = linspace (0.1, 0.01, 100); % dispersion values from 0.01 to 1000
n2 = 1.5; % threshold value
P_loznoe = zeros(length(sigma2_values), 1); % Initialize array for P_false
% Calculate P_false for each value of sigma^2 for fixed n2
for j = 1: length(sigma2_values)
sigma2 = sigma2_values(j); % use current value of sigma^2
alpha2 = 1/sigma2; % Calculate alpha^2
% Calculate integral of P(x) from n2 to infinity
integrand = @(x) (1 / (sqrt(2 * pi * sigma2))) .* exp(-((x.^2) / (2 * sigma2)));
P_loznoe(j) = integral(integrand, n2, Inf); % Calculate the integral
end
% Calculate alpha^2 for each sigma^2
alpha2_values = 1 ./sigma2_values; % alpha^2 = 1/sigma^2
% Plot P_false vs. alpha^2
figure;
semilogy(alpha2_values, P_loznoe, 'r', 'LineWidth', 2); % Logarithmic scale on the Y axis
title('False discovery rate vs. \alpha^2');
xlabel('\alpha^2');
ylabel('P_{false}');
xlim([10 100]); % Set limits on the X axis
ylim([10^(-8) 10^(-1)]); % Set limits on the Y axis to expand the grid
grid on; % Grid on
But for some reason my graph is not in the specified interval and not in the form of a decreasing exponent, but in the form of a linear decrease.
How can this be fixed?
Thanks in advance!

回答(1 个)

Sam Chak
Sam Chak 2025-3-9
移动:Sam Chak 2025-3-9
@Suleyman Aliyev, Do you expect the graph to behave like this?
% Given parameters
sigma2_values = linspace(0.1, 0.01, 100); % dispersion values ​​from 0.01 to 1000
n2 = 1.5; % threshold value
P_loznoe = zeros(length(sigma2_values), 1); % Initialize array for P_false
% Calculate P_false for each value of sigma^2 for fixed n2
for j = 1:length(sigma2_values)
sigma2 = sigma2_values(j); % use current value of sigma^2
alpha2 = 1/sigma2; % Calculate alpha^2
% Calculate integral of P(x) from n2 to infinity
integrand = @(x) (1/(sqrt(2*pi*sigma2))) .* exp(-((x.^2)/(2*sigma2)));
P_loznoe(j) = integral(integrand, n2, Inf); % Calculate the integral
end
% Calculate alpha^2 for each sigma^2
alpha2_values = 1./sigma2_values; % alpha^2 = 1/sigma^2
% Plot P_false vs. alpha^2
figure;
% semilogy(alpha2_values, P_loznoe, 'r', 'LineWidth', 2); % Logarithmic scale on the Y axis
semilogx(alpha2_values, P_loznoe, 'r', 'LineWidth', 2)
title('False discovery rate vs. \alpha^2');
xlabel('\alpha^2');
ylabel('P_{false}');
xlim([10 100]); % Set limits on the X axis
% ylim([10^(-8) 10^(-1)]); % Set limits on the Y axis to expand the grid
grid on; % Grid on
  17 个评论
Torsten
Torsten 2025-3-16
编辑:Torsten 2025-3-16
I don't understand why you write "I need to switch to a logarithmic scale along the ordinate axis and a linear scale along the abscissa axis" and now refer to the graph where the abszissa has logarithmic scale and the ordinate has linear scale.
The plot you have to use is your "semilogy" plot right at the beginning from which you can easily identify the small probability values for larger abzissa values.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by