130 likes | 147 Views
Independent random variable Mean and variance 郭俊利 2009/03/30. 05. Continuous Random Variable. 2.7 ~ 3.3. Outline. Review Problem 2.42 Exponential random number Normal random number CDF (Cumulative Distribution Function). X 1 + X 2 + … + X n n. S n =. Problem 2.42.
E N D
Independent random variable Mean and variance 郭俊利2009/03/30 05. Continuous Random Variable
2.7 ~ 3.3 Outline • Review • Problem 2.42 • Exponential random number • Normal random number • CDF (Cumulative Distribution Function)
X1 + X2 + … + Xn n Sn = Problem 2.42 • Computational problem. Here is a probabilistic method for computingthe area of given subset S of the unit square. The method uses a sequence of independent random selections of points in the unit square [0, 1] x [0, 1], according to a uniform probability law. If the ith point belongs to the subset S the value of a random variable Xi is set to 1, and otherwise it is set to 0. Let X1, X2, … be the sequence of random variables thus defined, and for any n, let (a) Show that E[Sn] is equal to the area of the subset S, and that var(Sn) diminishes to 0 as n increases. (b) Show that to calculate Sn, it is sufficient to know Sn-1 and Xn, so the past values of Xk, k = 1, …, n – 1, do not need to be remembered. Give a formula. (c) Write a computer program to generate Sn for n = 1, 2, …, 10000, using the computer’s random number generator, for the case where the subset S is the circle inscribed within the unit square. How can you use your program to measure experimentally the value of π? (d) Use a similar computer program to calculate approximately the area of the set of all (x, y) that lie within the unit square and satisfy 0 ≦ cosπx + sinπy ≦ 1.
X1 + X2 + … + Xn n Sn = Solution 2.42 (1/3) • 我的翻譯 (my translation, 翻錯別打我): 有種機率算法是計算一個 S 的面積 (S 在給定範圍 unit square 內),每次選取的點 ith會落在 [0, 1] x [0, 1] 中 (並且 ith是 uniform 且 independent),如果點 ith落在 S 裡, Xi就等於 1,否則 Xi = 0,又 (a)計算 E[Sn] 和 var(Sn) (b)發現 Sn不用管 X1 ~ Xn – 1,可以用Sn – 1和 Xn表示 Sn (c)可以用程式語言寫一個遞迴求 Sn,設 Sn是一個圓形,從 n = 1 ~ 10000 推敲出π值 (d)算出符合 0 ≦ cosπx + sinπy ≦ 1 這樣式子的所有 (x, y) 組合成的面積
Solution 2.42 (2/3) • My solution (解錯別打我): S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i = 1 ~ n = 1 ~ 40 Xi = 1 or 0 Xi is a random variable, Sn is a random variable. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P(Xi = 1) = 18/40 P(Xi = 1) = Area(S) / 給定範圍 = Area(S) Area( [0, 1] x [0, 1] ) = 1
Uniform (Lecture 8) (1) PDF fX(x) = , a≦x≦b (2)E[X] = (3)var(X) = Continuous Random Variable ∫fX(x) dx = 1 ∫xfX(x) dx = E[X]
f(x) = 0 , x≦100 100 / x2 , x > 100 { Example 1 (PDF) • Computer’s lifetime is a random variable (unit: hour). • Five computers construct a network server (1)A computer is down at 150th hour. (2)A computer is down before 150th hour. (3)A computer is down before 200th hour. (4)A server is crash before 700th hour. = P(X ≧ a) – P(X ≧ b)
Exponential random number • f(x) = λe–λx • P(x ≧ a) =∫a∞ λe–λxdx = –e–λx | a∞ = e–λa • E[X] = 1 / λ • var(X) = 1 / λ2(E[X2] = 2 / λ2)
Example 2 (Exponential) • The spent time of work is modeled as an exponential random variable. The average time that Xiao-Ming completes the task is 10 hours. What is the probability that Xiao-Ming has done this task early (in advance)?
f(x) = (x) dFx dx Cumulative Distribution Function p(k) = P(X ≦ k) – P(X ≦ k–1) = F(k) – F(k–1)
Normal random number 0 aμ + b a2σ2
a – μ σ a – μ σ Example 3 (Normal) • Standard normal distribution • N(–a) = P(Y ≦ –a) = P(Y ≧ a) = 1 – P(Y ≦ a) N(–a) = 1 – N(a) • CDF • P(X ≦ a) = P(Y ≦ ) = N( ) • The annual rainfall is modeled as a normal random variable with a mean = 600 mm and a standard deviation = 200. What is the probability that this year’s rainfall will be at least 800 mm?