Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Random Variables ◦ Learn about population Aim: ◦ Available information: observed data x1, . . . , xn Problem: ◦ Data affected by chance variation ◦ New set of data would look different Suppose we observe/measure some characteristic (variable) of n individuals. The actual observed values x1, . . . , xn are the outcome of a random phenomenon. Random variable: a variable whose value is a numerical outcome of a random phenomenon Remark: Mathematically, a random variable is a real-valued function on the sample space S: X S −−−−→ ω 7−→ x = X(ω) ◦ SX = X(S) is the sample space of the random variable. ◦ The outcome x = X(ω) is called realisation of X. ◦ X induces a probability P (B) = ability distribution of X (X ∈ B) on SX , the prob Example: Roll one die Outcome ω Realization X(ω) Random Variables, Jan 28, 2003 1 2 3 4 5 6 -1- Random Variables Example: Roll two dice ◦ X1 - number on the first die ◦ X2 - number on the second die ◦ Y = X1 + X2 - total number of points (a function of random variables is again a random variable) Table of outcomes: Outcome (X1 , X2 ) (1,1) (1,2) (1,3) (1,4) (1,5) (1,6) (2,1) (2,2) (2,3) (2,4) (2,5) (2,6) (3,1) (3,2) (3,3) (3,4) (3,5) (3,6) Random Variables, Jan 28, 2003 Y 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 Outcome (X1 , X2 ) (4,1) (4,2) (4,3) (4,4) (4,5) (4,6) (5,1) (5,2) (5,3) (5,4) (5,5) (5,6) (6,1) (6,2) (6,3) (6,4) (6,5) (6,6) Y 5 6 7 8 9 10 6 7 8 9 10 11 7 8 9 10 11 12 -2- Random Variables Two important types of random variables: • Discrete random variable ◦ takes values in a finite or countable set • Continuous random variable ◦ takes values in a continuum, or uncountable set ◦ probability of any particular outcome x is zero (X = x) = 0 for all x ∈ SX Example: Ten tosses of a coin Suppose we toss a coin ten times. Let ◦ X be the number of heads in ten tosses of a coin ◦ Y be the time it takes to toss ten times Random Variables, Jan 28, 2003 -3- Discrete Random Variables Suppose X is a discrete random variables with values x1, x2, . . .. Example: Roll two dice Y = X1 + X2 total number of points y 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 5 4 3 2 1 (Y = y) 36 36 36 36 36 36 36 36 36 36 36 Frequency function: The function p(x) = (X = x) = ({ω ∈ S|X(ω) = x}) is called the frequency function or probability mass function. Note: p defines a probability on SX = {x1 , x2, . . .}: P P (B) = p(x) = (X ∈ B). x∈B We call P the (probability) distribution of X. Properties of a discrete probability distribution ◦ p(x) ≥ 0 for all values of X P ◦ i p(xi ) = 1 Random Variables, Jan 28, 2003 -4- Discrete Random Variables Example: Roll one die Let X denote the number of points on the face turned up. Since all numbers are equally likely we obtain ½1 if x ∈ {1, . . . , 6} p(x) = (X = x) = 6 . 0 otherwise Example: Roll two dice The probability mass function of the total number of points Y = X1 + X2 can be written as: p(y) = (Y = y) = ½ 1 36 0 ¡ 6 − |y − 7| ¢ if y ∈ {2, . . . , 12} otherwise Example: Three tosses of a coin Let X be the number of heads in three tosses of a coin. There are ¡3¢ x outcomes with x heads and 3 − x tails, thus µ ¶ 3 1 p(x) = . x 8 Random Variables, Jan 28, 2003 -5- Continuous Random Variables For a continuous random variable X, the probability that X falls in the interval (a, b ] is given by (a < X ≤ B) = Z b f (x)dx, a where f is the density function of X. Note: The density defines a probability on : ¡ ¢ ¡ ¢ Zb P [a, b] = f (x) dx = X ∈ [a, b] a We call P the (probability) distribution of X. Remark: The definition of P can be extended to (almost) all B ⊆ . Example: Spinner Consider a spinner that turns freely on its axis and slowly comes to a stop. ◦ X is the stopping point on the circle marked from 0 to 1. ◦ X can take any value in SX = [0, 1). ◦ The outcomes of X are uniformly distributed over the interval [0, 1). Then the density function of X is ½ 1 if 0 ≤ x < 1 f (x) = . 0 otherwise Consequently ¡ ¢ X ∈ [a, b] = b − a. Note that for all possible outcomes x ∈ [0, 1) we have ¡ ¢ X ∈ [x, x] = x − x = 0. Random Variables, Jan 28, 2003 -6- Independence of Random Variables Recall: Two events A and B are independent if (A ∩ B) = (A) (B) Independence of Random Variables Two discrete random variables X and Y are independent if (X ∈ A, Y ∈ B) = (X ∈ A) (Y ∈ B) for all A ⊆ SX and B ⊆ SY . Remark: It is sufficient to show that (X = x, Y = y) = pX (x) pY (y) = (X = x) (Y = y) for all x ∈ SX and y ∈ SY . More generally, X1 , X2 , . . . are independent if for all n ∈ (X1 ∈ A1 , . . . , Xn ∈ An ) = (X1 ∈ A1 ) · · · (Xn ∈ An ). for all Ai ⊆ Xi . Example: Toss coin three times Consider Xi = ½ 1 0 if head in ith toss of coin otherwise X1 , X2 , and X3 are independent: (X1 = x1 , . . . , X3 = x3 ) = Random Variables, Jan 28, 2003 1 = 8 (X1 = x1 ) (X2 = x2 ) (X3 = x3 ) -7- Multivariate Distributions: Discrete Case Discrete Case Let X and Y be discrete random variables. Joint frequency function of X and Y pXY (x, y) = (X = x, Y = y) = ({X = x} ∩ {Y = y}) Marginal frequency function of X pX (x) = P pXY (x, yi) i Marginal frequency function of Y pY (y) = P pXY (xi, y) i The random variables X and Y are independent if and only if pXY (x, y) = pX (x) pY (y) for all possible values x ∈ SX and y ∈ SY . Conditional probability of X = x given Y = y (X = x|Y = y) = pX|Y (x|y) = pXY (x, y) pY (y) = (X = x, Y = y) (Y = y) where pX|Y (x|y) is the conditional frequency function. Random Variables, Jan 28, 2003 -8- Multivariate Distributions Discrete Case Example: Three Tosses of a Coin ◦ X - number of heads on the first toss (values in {0, 1}) ◦ Y - total number of heads (values in {0, 1, 2, 3}) The joint frequency function pXY (x, y) is given by the following table x\y 0 1 2 3 0 1 8 0 1 8 2 8 3 8 0 1 2 8 1 8 3 8 1 8 1 8 1 8 1 2 1 2 1 Marginal frequency function of Y pY (0) = (Y = 0) = (Y = 0, X = 0) + (Y = 0, X = 1) = 81 + 0 = 1 8 pY (1) = (Y = 1) = (Y = 1, X = 0) + (Y = 1, X = 1) = 82 + 81 = ... Random Variables, Jan 28, 2003 3 8 -9- Multivariate Distributions Continuous Case Let X and Y be continuous random variables. Joint density function of X and Y : fXY such that Z Z A fXY (x, y) dy dx = (X ∈ A, Y ∈ B) B Marginal density function of X: fX (x) = Z fXY (x, y) dy Marginal density function of Y fY (y) = Z fXY (x, y) dx The random variables X and Y are independent if and only if fXY (x, y) = fX (x) fY (y) for all possible values x ∈ SX and y ∈ SY . Conditional density function of X given Y = y fX|Y (x|y) = fXY (x, y) fY (y) Conditional probability of X ∈ A given Y = y (X ∈ A|Y = y) = Random Variables, Jan 28, 2003 Z fX|Y (x|y) dx A - 10 -