- #1
Chatman100
- 2
- 0
Hello dear friends,
I need your help with this probability problem.
I have random variable x1 which is normally distributed with mean m1 and standard deviation sigma1.
The vector of random variables X0 is of N elements, where each element is normally distributed with zero mean and standard deviation sigma0.
Now we do an experiment. In each experiment we cast x1 and X0. Then we compare x1 to the elements of X0. If x1 is greater than all the elements in X0 the experiment is successful, otherwise it is a failure. This experiment is repeated K times.
I would like to calculate the probability of success.
Below is the code of the MATLAB simulation:
m0 = 0; %Mean of the elements in X0
sigma0 = 1; %Standard deviation of the elements in X0
m1 = 4.3; %Mean of the elements in x1
sigma1 = 1.2; %Standard deviation of the elements in x1
N = 1000; %Number of elements in X0
K = 800; %Number of experiments
X0 = randn(K, N)*sigma0 + m0;
x1 = randn(K, 1)*sigma1 + m1;
success_flag = zeros(K, 1); %Allocation
for k = 1:K
success_flag(k) = sum(x1(k) > X0( k, : )) == N;
end
success_percentage = 100 * sum(success_flag) / K;
disp(['Success percentage sim: ' num2str(success_percentage)]);
Looking forward to your help.
I need your help with this probability problem.
I have random variable x1 which is normally distributed with mean m1 and standard deviation sigma1.
The vector of random variables X0 is of N elements, where each element is normally distributed with zero mean and standard deviation sigma0.
Now we do an experiment. In each experiment we cast x1 and X0. Then we compare x1 to the elements of X0. If x1 is greater than all the elements in X0 the experiment is successful, otherwise it is a failure. This experiment is repeated K times.
I would like to calculate the probability of success.
Below is the code of the MATLAB simulation:
m0 = 0; %Mean of the elements in X0
sigma0 = 1; %Standard deviation of the elements in X0
m1 = 4.3; %Mean of the elements in x1
sigma1 = 1.2; %Standard deviation of the elements in x1
N = 1000; %Number of elements in X0
K = 800; %Number of experiments
X0 = randn(K, N)*sigma0 + m0;
x1 = randn(K, 1)*sigma1 + m1;
success_flag = zeros(K, 1); %Allocation
for k = 1:K
success_flag(k) = sum(x1(k) > X0( k, : )) == N;
end
success_percentage = 100 * sum(success_flag) / K;
disp(['Success percentage sim: ' num2str(success_percentage)]);
Looking forward to your help.