How can I calculate the probability of false detection?

4 Ansichten (letzte 30 Tage)
Suleyman Aliyev
Suleyman Aliyev am 9 Mär. 2025
Kommentiert: Suleyman Aliyev am 16 Mär. 2025
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 Kommentar
Torsten
Torsten am 9 Mär. 2025
You are aware that you chose a logarithmic scale for the y-axis ?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sam Chak
Sam Chak am 9 Mär. 2025
Verschoben: Sam Chak am 9 Mär. 2025
@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 Kommentare
Torsten
Torsten am 16 Mär. 2025
Bearbeitet: Torsten am 16 Mär. 2025
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.
Suleyman Aliyev
Suleyman Aliyev am 16 Mär. 2025
Everything worked out! Thank you all very much for your help!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by