N 04 - Continuous Random Variables BIOINF 2118 p.1 of 4 A probability density function (p.d.f.) is a representation of a continuous distribution, analogous to the p.m.f. for discrete distributions. For a random variable X, a pdf f is a non-negative function that satisfies: for all a < b (including ). The integral ò means roughly “area under the curve f from a to b. The cumulative distribution function (c.d.f) of a random variable X is defined by: . C.D.F., Continuous case . . (Read as “limit as x goes to infinity”.) Properties of Continuous Random Variables Pr(X = a) = 0 for any a. (“Every answer is impossible!?!?”) Uniform Distribution A random variable X has a uniform distribution on the interval (a, b) if its pdf is given by We denote this as X ~ U(a,b) . In R, runif( ) generates a sample from the uniform distribution. BIOINF 2118 N 04 - Continuous Random Variables p.2 of 4 Normal (Gaussian) Notation: The pdf is: , for . . R function rnorm( ) generates a random sample from a normal distribution in R. The Central Limit Theorem shows that the average of i.i.d. variables tends to the normal distribution as the sample size grows. (i.i.d. means “independent, identically distributed”) See www.mathsisfun.com/data/quincunx.html BIOINF 2118 N 04 - Continuous Random Variables p.3 of 4 Exponential Notation: . The pdf is: The R function rexp( ) generates a random sample from the exponential. The exponential has a “memoriless” property. Sometimes the exponential is parametrized in terms of the half-life parameter, . Gamma distribution: Notation: The pdf is: The R function rgamma( ) generates a random sample from the gamma. FACTS: Exponential is a special case of Gamma (α = 1, like a “sample size”). Just as Bernoulli is a special case of Binomial, and Geom is a special case of Neg Binomial. And also like those cases, if you add n exponentials of the same scale b , you get Gamma(n,b ) . BIOINF 2118 Variable Type Sample Space N 04 - Continuous Random Variables p.4 of 4 Normal (Gaussian) Beta Gamma Exponential Continuous Continuous Continuous Continuous (-∞,∞) [0,1] [0,∞) [0,∞) x a-1(1- x)b-1 G(a)G(b) / G(a + b) pdf(x) (density) E(X) V(X) 2 (a,b) = set of all real numbers x such that a < x < b [a,b] = set of all real numbers x such that a < x < b (a,b] = set of all real numbers x such that a < x < b [a,b) = set of all real numbers x such that a < x < b a a+ b a/b 1/λ a / b2 1/λ2 “open interval” “closed interval” “half-open interval” “half-open interval” Beta: If a = number of heads and b = number of tails in (a + b) trials, then x is the probability of heads. Uniform: Special case of Beta where a = b = 1. Exponential: x is the time to first event. Exponential is special case of Gamma where a = 1. “Memoriless”, like the geometric. th Gamma: x is the time when the a (exponential) event happened. b = 1/λ (c.f. exponential distribution) A continuous version of the negative binomial distribution. Poisson process: 1) inter-arrival times are exponential 2) cumulative time to each event is gamma (sum of iid exponentials). (Stopping after a fixed # events, asking the time.) 3) number of events in any time interval is Poisson, the mean is proportional to interval length. (Stopping after a fixed time, asking how many events.)