泊松分布与matlab

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Remakrs the linear congruential generator can generate no more than m different numbers, so m should be a large number an unfavorable choice of the parameters a, b, c may result in a very short length of the period, for example, a=c=5, and m=10
School of Finance @ ZUEL
2010-3-21
10
Generation of Discrete RVs
N-Outcome Random Variate
Two-point random variate
⎧ x1 if 0 ≤ U ≤ p X =⎨ ⎩ x2 if p ≤ U ≤ 1
School of Finance @ ZUEL
2010-3-21
3
General Considerations
【Example: Linear congruential generator】 xi +1 = axi mod m ui +1 = xi +1 / m
The multiplier a and the modulus m are inteter constants The operation mod denotes the remainder of integer division
School of Finance @ ZUEL
2010-3-21
7
Exercise
【In class part】
In Matlab, write a function for creating your own linear congruential generator with a=1229, b=1 and c=32768. Let X0=10. Using the plot function, plot the pair of point (Un, Un+1) for n=1:103. Do the points look scattered as you would like them to be? If you plot the pair of point (Un, Un+1) for n=1:105, what do you observed?
N-state random variate
⎧ x1 if 0 ≤ U ≤ p1 ⎪ ⎪ x2 if p1 ≤ U ≤ p2 X =⎨ ⎪ ⎪ ⎩ x N if pN −1 ≤ U ≤ 1
School of Finance @ ZUEL
2010-3-21
11
Generation of Discrete RVs
Random Number / Random Variable Generation
General Considerations Linear Congruential Generators Generation of Discrete RVs Generation of Continous RVs
Poisson Random Variate
Poisson random variate has an infinite number of outcomes (0, 1, 2, · · ·). Given the parameter λ, the probability density function are given by e−λ λ x
School of Finance @ ZUEL 2010-3-21 6
Linear Congruential Generators
Sufficient and necessary conditions ensuring that the generator has full period—i.e., that the number of distinct values generated form any seed x0 is m-1 c and m are relatively prime (the only common divisor is 1) For every prime number r dividing m, a-1 is a multiple of m If m is a multiple of 4, then also a-1 is a multiple of 4
School of Finance @ ZUEL 2010-3-21 1
General Considerations
Properties of Truly Random Numbers Ui
Each Ui uniformly distributed between 0 and 1 Vales uniformly distributed between 0 and 1/2 would be useful Uniform random variables on the unit interval can be transformed into samples from any other distribution All Ui are mutually independent All pairs of values should be uncorrelated The value of Ui should not be predicated from U1 , U2 , U3, …, Ui-1
School of Finance @ ZUEL
2010-3-21
9
ExerciseΒιβλιοθήκη Baidu
2. Pick one of these 20 numbers with equal probability, 1/20. This will require generating another random number from a different stream, V1. Assign the picked random number from the U stream, say U3, to W, i.e. W1 = U3. 3. Replace the random number picked from the first stream, say U3, with the next random number in the sequence, i.e. U21. 4. Repeat steps 2-3. This results in a shuffled sequence of random numbers, W, of the initial sequence, U.
p( x ) = x!
Algorithm Step 1: Set s1=0, s2=p1, j=1. And generate a uniform random number U; Step 2: Check If s1≤U≤s2, then x=j. And exit. Step 3: Else Update s1=s2, s2=s2+pj+1, j=j+1; Go to Step 2.
School of Finance @ ZUEL 2010-3-21 2
General Considerations
Effective Random Number Generator
Produces values that appear consistent with the two properties above Uniformity: if the number of values K is large, the fraction of values falling in any subinterval of the unit interval should be approximately the length of the subinterval Independence: there should be no discernible pattern among variables (or, statistical tests for independence should not be easily rejected)
If a=6 and m=11 (m should be large in practice), we get the following sequence Starting from x0 =1 :
1, 6, 3, 7, 9,10, 5, 8, 4, 2,1, 6, If a=3, m=11, x0 =1 , we get the following sequence: 1, 3, 9, 5, 4,1, 3, If a=3, m=11, x0 =2 , we get the following sequence: 2, 6, 7,10, 8, 2, 6,
School of Finance @ ZUEL 2010-3-21 4
General Considerations
Considerations
Long period LCG has a looping characteristic. The period which is defined as the smallest positive integer p which satisfies Xi+p = Xi for all i≥0. A 32-bit linear congruential generator will have a period less than 232. Good statistical properties, such as apparent independence Computational and storage efficiency Reproducibility (for same seed)
School of Finance @ ZUEL 2010-3-21 5
Linear Congruential Generators
Primary Relation xi +1 = (axi + b )mod c ui +1 = xi +1 / c
This is sometime called a mixed linear congruential generator and the case in the previous example a pure linear congruential generator
School of Finance @ ZUEL 2010-3-21 12
Generation of Continuous RVs
Inverse Transform Method
School of Finance @ ZUEL
2010-3-21
8
Exercise
【After class part】
Write a new function to implement a shuffling scheme on the numbers generated by the LCG. Repeat the previous plot. Does this alleviate the bias? Shuffling Procedure: attempts to introduce more randomness in a deterministic output of a random number generator. Steps of the procedure are as follows, 1. Generate 20 or more random numbers from one random number stream: U1, ...,U20.
相关文档
最新文档