Continuous Distributions 1.8-1.9: Continuous Random Variables
1.10.1: Uniform Distribution (Continuous)
1.10.4-5 Exponential and Gamma Distributions: Distance between crossovers
Prof. Tesler
Math 283 Fall 2015
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 1 / 24 Continuous distributions
Example Pick a real number x between 20 and 30 with all real values in [20, 30] equally likely. Sample space: S = [20, 30] Number of outcomes: |S| = Probability of each outcome: P(X = x) = 1 = 0 ∞ Yet, P(X 6 21.5) = 15% ∞
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 2 / 24 Continuous distributions The sample space S is often a subset of Rn. We’ll do the 1-dimensional case S ⊂ R.
The probability density function (pdf) fX(x) is defined differently than the discrete case:
fX(x) is a real-valued function on S with fX(x) > 0 for all x ∈ S.
fX(x) dx = 1 (vs. PX(x) = 1 for discrete) S x∈S R P The probability of event A ⊂ S is P(A) = fX(x) dx (vs. PX(x)). A x∈A In n dimensions, use n-dimensional integralsR instead. P Uniform distribution Let a < b be real numbers. The Uniform Distribution on [a, b] is that all numbers in [a, b] are “equally likely.” 1 b−a if a 6 x 6 b; More precisely, fX(x) = 0 otherwise.
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 3 / 24 Uniform distribution (real case)
The uniform distribution on [20, 30] We could regard the sample space as [20, 30], or as all reals. ) x 0.10 ( X 1/10 for 20 6 x 6 30; f fX(x) =
0 otherwise. 0.00 0 10 20 30 40
x 20 21.5 1 x 21.5 P(X 6 21.5) = 0 dx + dx = 0 + 10 10 20 Z− Z20 21.5 − 20 = ∞ ) x
10 0.10 ( X = .15 = 15% f 0.00 0 10 20 30 40
x Prof. Tesler Continuous Distributions Math 283 / Fall 2015 4 / 24 Cumulative distribution function (cdf)
The Cumulative Distribution Function (cdf) of a random variable X is
FX(x) = P(X 6 x) For a continuous random variable, x 0 FX(x) = P(X 6 x) = − fX(t) dt and fX(x) = FX (x) R The integral cannot have “x∞” as the name of the variable in both of
FX(x) and fX(x) because one is the upper limit of the integral and the other is the integration variable. So we use two variables x, t.
We can either write x FX(x) = P(X 6 x) = fX(t) dt − or Z t ∞ FX(t) = P(X 6 t) = fX(x) dx Z−
∞
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 5 / 24 CDF of uniform distribution
Uniform distribution on [20, 30] x For x < 20: FX(x) = − 0 dt = 0 For 20 x < 30: F (x) = 20 0 dt + x 1 dt = x−20 6 X R−∞ 20 10 10 For 30 x: F (x) = 20 0 dt + 30 1 dt + x 0 dt = 1 6 X R−∞ R20 10 30 Together: R ∞ R R 0 if x < 20 0 if x < 20 F (x)= x−20 f (x)=F 0(x)= 1 X 10 if 20 6 x 6 30 X X 10 if 20 6 x 6 30 1 if x > 30 0 if x > 30
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 6 / 24 PDF vs. CDF
Probability density function Cumulative distribution function 1 ) x ) ( x 0.10 0.5 X ( F X f 0
0.00 0 10 20 30 40 0 10 20 30 40
x x F (x) = .1 if 20 6 x 6 30; X fX(x)= 0 otherwise. 0 if x < 20; It’s discontinuous at x = 20 (x − 20)/10 if 20 6 x 6 30; and 30. 1 if x > 30. PDF is derivative of CDF: CDF is integral of PDF: 0 x fX(x) = FX (x) FX(x) = fX(t) dt Z−
∞
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 7 / 24 PDF vs. CDF: Second example
Probability density function Cumulative distribution function 1
(r) 0.6 R
0.4 (r) R 0.5 F 0.2 density f 0 0 0 1 2 3 0 1 2 3 r r 2r/9 if 0 r < 3; 0 if r < 0; f (r)= 6 R 0 if r 0 or r > 3 ( ) = 2 6 FR r r /9 if 0 6 r 6 3; It’s discontinuous at r = 3. 1 if r > 3. PDF is derivative of CDF: CDF is integral of PDF: 0 r fR(r) = FR (r) FR(r) = fR(t) dt Z−
Prof. Tesler Continuous Distributions ∞ Math 283 / Fall 2015 8 / 24 Probability of an interval Compute P(−1 6 R 6 2) from the PDF and also from the CDF
Computation from the PDF 2 0 2 P(−1 6 R 6 2) = fR(r) dr = fR(r) dr + fR(r) dr Z−1 Z−1 Z0 0 2 2r = 0 dr + dr 9 Z−1 Z0 2 2 ! 2 2 r 2 − 0 4 = 0 + = = 9 r=0 9 9
Computation from the CDF
− P(−1 6 R 6 2) = P(−1 < R 6 2) 22 4 = F (2) − F (−1−) = − 0 = R R 9 9
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 9 / 24 Continuous vs. discrete random variables Cumulative distribution function Cumulative distribution function 1 1 (r) (x) R 0.5 X 0.5 F F
0 0 0 1 2 3 !1 0 1 2 r x In a continuous distribution: The probability of an individual point is 0: P(R = r) = 0. − So, P(R 6 r) = P(R < r), i.e., FR(r) = FR(r ). The CDF is continuous. (In a discrete distribution, the CDF is discontinuous due to jumps at the points with nonzero probability.) P(a < R < b)= P(a 6 R < b) = P(a < R 6 b) = P(a 6 R 6 b) = FR(b) − FR(a)
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 10 / 24 Cumulative distribution function (cdf) The Cumulative Distribution Function (cdf) of a random variable X is
FX(x) = P(X 6 x) Continuous case x FX(x) = − fX(t) dt Weakly increasing. R ∞ Varies smoothly from 0 to 1 as x varies from − to . 0 To get the pdf from the cdf, use fX(x) = FX (x). ∞ ∞ Discrete case F (x) = P (t) X t6x X Weakly increasing.P Stair-steps from 0 to 1 as x goes from − to .
The cdf jumps where PX(x) , 0 and is constant in-between. ∞ ∞ − To get the pdf from the cdf, use PX(x) = FX(x) − FX(x ) (which is positive at the jumps, 0 otherwise).
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 11 / 24 CDF, percentiles, and median
The kth percentile of a distribution X is the point x where k% of the probability is up to that point:
FX(x) = P(X 6 x) = k% = k/100
2 Example: FR(r) = P(R 6 r) = r /9 (for 0 6 r 6 3) r2/9 = (k/100) ⇒ r = p9(k/100) 75th percentile: r = p9(.75) ≈ 2.60 Median (50th percentile): r = p9(.50) ≈ 2.12 0th and 100th percentiles: r = 0 and r = 3 if we restrict to the range 0 6 r 6 3. But they are not uniquely defined, since
FR(r) = 0 for all r 6 0 and FR(r) = 1 for all r > 3.
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 12 / 24 Expected value and variance (continuous r.v.) Replace sums by integrals. It’s the same definitions in terms of “E(·)”:
2 µ = E(X) = x · f (x) dx σ = Var(X) X 2 2 2 Z−∞ = E((X − µ) ) = E(X ) − (E(X))
E(g(X)) = ∞ g(x) fX(x) dx Z−∞ µ and σ for the∞ uniform distribution on [a, b] (with a < b)
b 2 b 2 2 1 x /2 (b − a )/2 b + a µ = E(X) = x · dx = = = b − a b − a b − a 2 Za x=a b 3 b 3 3 2 2 1 x /3 (b − a )/3 b + ab + a E(X2) = x2 · dx = = = b − a b − a b − a 3 Za x=a b2 + ab + a2 b + a2 (b − a)2 σ2 = Var(X) = E(X2) − (E(X))2 = − = 3 2 12 √ σ = SD(X) = (b − a)/ 12
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 13 / 24 Exponential distribution
How far is it from the start of a chromosome to the first crossover? How far is it from one crossover to the next? Let D be the random variable giving either of those. It is a real number > 0, with the exponential distribution −λ d λ e if d > 0; fD(d) = 0 if d < 0. where crossovers happen at a rate λ = 1 M−1 = 0.01 cM−1. General case Crossovers Mean E(D) = 1/λ = 100 cM = 1 M Variance Var(D) = 1/λ2 = 10000 cM2 = 1 M2 Standard Dev. SD(D) = 1/λ = 100 cM = 1 M
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 14 / 24 Exponential distribution
Exponential distribution
0.012 µ µ±! 0.01 Exponential: "=0.01
0.008
pdf 0.006
0.004
0.002
0 0 100 200 300 400 d
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 15 / 24 Exponential distribution
In general, if events occur on the real number line x > 0 in such a way that the expected number of events in all intervals [x, x + d] is λ d (for x > 0), then the exponential distribution with parameter λ models the time/distance/etc. until the first event.
It also models the time/distance/etc. between consecutive events.
Chromosomes are finite; to make this model work, treat “there is no next crossover” as though there is one but it happens somewhere past the end of the chromosome.
Prof. Tesler Continuous Distributions Math 283 / Fall 2015 16 / 24 Proof of pdf formula
Let d > 0 be any real number.
Let N(d) be the # of crossovers that occur in the interval [0, d].
D>d N(d)=0
¨
¦ ¤
§ ¥ ¨©
¡
¦ ¤
§ ©
¥ D ¢ £ D Prof. Tesler Continuous Distributions Math 283 / Fall 2015 17 / 24 Discrete and Continuous Analogs Discrete Continuous “Success” Coin flip at a position Point where is heads crossover occurs Rate Probability p per flip λ (crossovers per Morgan) # successes Binomial distribution: Poisson distribution: # heads out of n flips # crossovers in dis- tance d Wait until 1st success Geometric Exponential distribution distribution Wait until rth success Negative binomial Gamma distribution distribution Prof. Tesler Continuous Distributions Math 283 / Fall 2015 18 / 24 Gamma distribution How far is it from the start of a chromosome until the rth crossover, for some choice of r = 1, 2, 3,...? Let Dr be a random variable giving this distance. It has the gamma distribution with pdf λr r−1 −λ d (r−1)! d e if d > 0; fD (d) = r 0 if d < 0. Mean E(Dr) = r/λ (D ) = r/λ2 Variance Var r √ Standard deviation SD(Dr) = r/λ The gamma distribution for r = 1 is the same as the exponential distribution. The sum of r i.i.d. exponential variables, Dr = X1 + X2 + ··· + Xr, each with rate λ, gives the gamma distribution. Prof. Tesler Continuous Distributions Math 283 / Fall 2015 19 / 24 Gamma distribution ! µ µ±! "