In the near future, when solving an exponential distribution of sample processing problems, do a if, then need to do a small experiment to confirm based on if and simply deduced the correctness of the theory.
The first is if: given a sample set with a total number of N, the elements in the sample set conform to the exponential distribution, that is, the value of each element X in the sample sets S conforms to the exponential distribution X~exp (lambda) of the lambda. Well, if I were given another length n. To intercept all the sample elements, that is, to pick out all elements whose X is less than or equal to N.
The question is: 1) How many of these elements are represented by N0? 2) What is the number of all the elements that have been intercepted and expressed in l?
A. Simple derivation:
1) The first small problem, my idea is this: first of all, the probability of the cumulative distribution of element x is not greater than N (n, Lambda), and then the number of all elements not greater than n is the total number of samples in F (n, Lambda) embodiment. That
2) The second way of thinking is: first to find all elements less than equal to n the expected E (x<=n), and then L is expected E (x<=n) in the overall sample embodiment. That
Of F (X) is the probability density function of exponential distribution.
B. Next, experiment to verify.
1) code. 2) effect; 3) conclusion.
1)
clear%----1) generate S with exprnd () s = [];cnt_elements = 1e6; Mu = 5; s= exprnd (mu,1,cnt_elements);%----2) countingn_threshold = 3;selected_elements_idx = [];SELECTED_ELEMENTS_IDX = Find (S <= n_threshold);%--A. Count of selected elements within threshold. cnt_selected = size (SELECTED_ELEMENTS_IDX);%--B. Sum of the selected Elements.sum_sel_ones = SUM (S (selected_elements_id x));%-----3) Analysis of N0:lam = 1.0/mu;n = N_threshold; N = cnt_elements; N0 = N * (1-exp ( -1*lam*n));%-----4) Analysis of L.L = (n/lam) * (1-(lam*n + 1)/exp (lam*n));%-----5) Compare Cnt_selec Ted with N0. cnt_selectedn0%-----6) Compare Sum_sel_ones with L.sum_sel_onesl
2) Output:
cnt_selected =
1 451172
N0 =
4.5119e+005
Sum_sel_ones =
6.0934e+005
L =
6.0951e+005
3) from the output, the experimental results are broadly in line with theoretical derivation.
Davy_h
2014-7-15
Theory and experiment of intercepting part of sample with exponential distribution