Theory and Experiment of intercepting some samples conforming to exponential distribution

Source: Internet
Author: User


Recently, when solving the problem of processing samples that conform to the exponential distribution, we made a hypothesis. Then we need to make a small experiment to confirm the correctness of the theory simply derived based on the hypothesis.

First, assume that given a sample set with N as the total number, the elements in the sample set conform to the exponential distribution, that is, the value of X of each element in the sample set S conforms to the exponential distribution X ~ with the lambda parameter ~ Exp (lambda). If I specify another length of N to intercept all the sample elements, that is, all the elements whose X is less than or equal to n.

Question: 1) How many such elements are represented by N0? 2) What is the sum of all the intercepted elements, represented by L?

A. Simple Derivation:

1) the first small problem is my idea: First, find the cumulative distribution probability F (n, lambda) with element x not greater than N ), then, the number of all elements not greater than N is the embodiment of the total number of samples in F (n, lambda. That is

2) The second question is: first obtain the expected E (x <= N) of all elements less than or equal to N, and then l is the expected E (x <= N) overall sample. That is


F (x) is the probability density function of exponential distribution.


B. Next, use an experiment for verification.

1) Code; 2) effects; 3) conclusion.

1)

clear% ---- 1) generate S with Exprnd()S = [];cnt_elements = 1e6;Mu = 5;for i=1:cnt_elementsS(i)= exprnd(Mu);end% ---- 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_idx) );% ----- 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_selected with N0.CNT_selectedN0% ----- 6) Compare sum_sel_ones with L.sum_sel_onesL

2) output:

Cnt_selected =
1 451172

N0 =
4.20.9e + 005


Sum_sel_ones =
6.0934e + 005

L =
6.0951e + 005


3) the output shows that the experiment results are roughly in line with the theoretical derivation.


Davy_h

2014-10-15

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.