multiple random variables, correlations

29
Multiple random variables, Correlations

Upload: others

Post on 31-Jan-2022

13 views

Category:

Documents


0 download

TRANSCRIPT

Multiple random variables,Correlations

What we learned so farā€¦ā€¢ Random Events:

ā€“ Working with events as sets: union, intersection, etc.ā€¢ Some events are simple: Head vs Tails, Cancer vs Healthyā€¢ Some are more complex: 10<Gene expression<100ā€¢ Some are even more complex: Series of dice rolls: 1,3,5,3,2

ā€“ Conditional probability:  P(A|B)=P(A āˆ© B)/P(B)ā€“ Independent events: P(A|B)=P(A) or P(A āˆ© B)= P(A)*P(B)ā€“ Bayes theorem: relates P(A|B) to P(B|A)

ā€¢ Random variables:ā€“ Mean, Variance, Standard deviation. How to work with E(g(X))ā€“ Discrete (Uniform, Bernoulli, Binomial, Poisson, Geometric, Negative 

binomial, Power law); PMF: f(x)=Prob(X=x); CDF: F(x)=Prob(Xā‰¤x);

ā€“ Continuous (Uniform, Exponential, Erlang, Gamma, Normal, Logā€normal);PDF: f(x) such that Prob(X inside A)= āˆ«A f(x)dx; CDF: F(x)=Prob(Xā‰¤x)

ā€¢ Next step: work with multiple random variablesmeasured together in the same series of random experiments

Concept of Joint Probabilities

ā€¢ Biological systems are usually described not by a single random variable but by many random variables

ā€¢ Example: The expression state of a human cell: 20,000 random variables Xi for each of its genes

ā€¢ A joint probability distribution describes the behavior of several random variables

ā€¢ We will start with just two random variables X and Y and generalize when necessary

Chapter 5 Introduction 3

Joint Probability Mass Function Defined

Sec 5ā€1.1 Joint Probability Distributions 4

The joint probability mass function of the discrete random variables š‘‹ and š‘Œ, denoted as š‘“ š‘„,š‘¦ , satifies:(1) š‘“ š‘„,š‘¦ š‘ƒ2 š‘“ š‘„,š‘¦ 0 All probabilities are non negative3 āˆ‘ āˆ‘ š‘“ š‘„,š‘¦ 1 The sum of all probabilities is 1

Montgomery Runger 5th edition Equation 5 1

Example 5ā€1:  # Repeats vs. Signal BarsYou use your cell phone to check your airline reservation. It asks you to speak 

the name of your departure city to the voice recognition system.ā€¢ Let Y denote the number of times you have to state your departure city.ā€¢ Let X denote the number of bars of signal strength on you cell phone.

Sec 5ā€1.1 Joint Probability Distributions 5

Figure 5ā€1  Joint probability distribution of X and Y.  The table cells are the probabilities.  Observe that more bars relate to less repeating.

OnceTwice3 Times4 Times

0.00

0.05

0.10

0.15

0.20

0.25

1 2 3

Prob

ability

Cell Phone Bars

Bar Chart of Number of Repeats vs. Cell 

Phone Bars1 2 3

1 0.01 0.02 0.252 0.02 0.03 0.203 0.02 0.10 0.054 0.15 0.10 0.05

x =  number of bars of signal strength

y =  number of times city 

name is stated

Marginal Probability Distributions (discrete)For a discrete joint PDF, there are marginal distributions for each random variable, formed by summing the joint PMF over the other variable.

Sec 5ā€1.2 Marginal Probability Distributions 6

š‘“ š‘„ š‘“ š‘„, š‘¦

š‘“ š‘¦ š‘“ š‘„, š‘¦

1 2 3 f Y (y ) =1 0.01 0.02 0.25 0.282 0.02 0.03 0.20 0.253 0.02 0.10 0.05 0.174 0.15 0.10 0.05 0.30f X (x ) = 0.20 0.25 0.55 1.00

x =  number of bars of signal strength

y =  number of times city name 

is stated

Figure 5ā€6  From the prior example, the joint PMF is shown in green while the two marginal PMFs are shown in purple.

Called marginal because they are written in the margins

Mean & Variance of X and Y are calculated using marginal distributions

Sec 5ā€1.2 Marginal Probability Distributions 7

1 2 3 f (y ) = y *f (y ) = y 2*f (y ) =1 0.01 0.02 0.25 0.28 0.28 0.282 0.02 0.03 0.20 0.25 0.50 1.003 0.02 0.10 0.05 0.17 0.51 1.534 0.15 0.10 0.05 0.30 1.20 4.80f (x ) = 0.20 0.25 0.55 1.00 2.49 7.61

x *f (x ) = 0.20 0.50 1.65 2.35x 2*f (x ) = 0.20 1.00 4.95 6.15

x =  number of bars of signal strength

y =  number of times city 

name is stated

Ī¼X =E(X) = 2.35;    ĻƒX2 = V(X) = 6.15 ā€“ 2.352 = 6.15  ā€“ 5.52 = 0.6275

Ī¼Y= E(Y) = 2.49;    ĻƒY2 = V(Y) = 7.61 ā€“ 2.492 = 7.61 ā€“ 16.20 = 1.4099

Conditional Probability Distributions

From Example 5ā€1P(Y=1|X=3) = 0.25/0.55 = 0.455P(Y=2|X=3) = 0.20/0.55 = 0.364P(Y=3|X=3) = 0.05/0.55 = 0.091P(Y=4|X=3) = 0.05/0.55 = 0.091

Sum = 1.00

Sec 5ā€1.3 Conditional Probability Distributions 8

Recall that š‘ƒ šµ|š“š‘ƒ š“ āˆ© šµš‘ƒ š“

1 2 3 f Y (y ) =1 0.01 0.02 0.25 0.282 0.02 0.03 0.20 0.253 0.02 0.10 0.05 0.174 0.15 0.10 0.05 0.30f X (x ) = 0.20 0.25 0.55 1.00

x =  number of bars of signal strength

y =  number of times city name 

is stated

Note that there are 12 probabilities conditional on X, and 12 more probabilities conditional upon Y.

P(Y=y|X=x)=P(X=x,Y=y)/P(X=x)==f(x,y)/fX(x)

Joint Random Variable Independenceā€¢ Random variable independence means that knowledge of the value of X does not change any of the probabilities associated with the values of Y. 

ā€¢ Opposite: Dependence implies that the values of X are influenced by the values of Y

Sec 5ā€1.4 Independence 9

Independence for Discrete Random Variables

ā€¢ Remember independence of events (slide 13 lecture 4) :  Events are independent if any one of the three conditions are met:1) P(A|B)=P(A āˆ© B)/P(B)=P(A) or 2) P(B|A)= P(A āˆ© B)/P(A)=P(B) or 3) P(A āˆ© B)=P(A) āˆ™ P(B)

ā€¢ Random variables independent if all eventsA that Y=y and B that X=x are independent if any one of these conditions is met:1) P(Y=y|X=x)=P(Y=y) for any x or 2) P(X=x|Y=y)=P(X=x) for any y or 3) P(X=x, Y=y)=P(X=x)āˆ™P(Y=y) for every pair x and y

11

X and Y are Bernoulli variables

What is the marginal PY(Y=0)?A. 1/6B. 2/6C. 3/6D. 4/6E. I donā€™t know

Get your iā€clickers

Y=0 Y=1X=0 2/6 1/6X=1 2/6 1/6

12

X and Y are Bernoulli variables

What is the conditional P(X=0|Y=1)?A. 2/6B. 1/2C. 1/6D. 4/6E. I donā€™t know

Get your iā€clickers

Y=0 Y=1X=0 2/6 1/6X=1 2/6 1/6

13

X and Y are Bernoulli variables

Are they independent?A. yesB. noC. I donā€™t know

Get your iā€clickers

Y=0 Y=1X=0 2/6 1/6X=1 2/6 1/6

14

X and Y are Bernoulli variables

Are they independent?A. yesB. noC. I donā€™t know

Get your iā€clickers

Y=0 Y=1X=0 1/2 0X=1 0 1/2

Credit: XKCD comics 

Joint Probability Density Function Defined

Sec 5ā€1.1 Joint Probability Distributions 16

1 š‘“ š‘„, š‘¦ 0 for all š‘„, š‘¦

2 š‘“ š‘„, š‘¦ š‘‘š‘„š‘‘š‘¦ 1

3 š‘ƒ š‘‹,š‘Œ āŠ‚ š‘… š‘“ š‘„, š‘¦ š‘‘š‘„š‘‘š‘¦ 5 2

Figure 5ā€2  Joint probability density function for the random variables X and Y.  Probability that (X, Y) is in the region R is determined by the volume of fXY(x,y) over the region R.

The joint probability density function for the continuous random variables X and Y, denotes as fXY(x,y), satisfies the following properties:

Joint Probability Density Function Graph

Sec 5ā€1.1 Joint Probability Distributions 17

Figure 5ā€3  Joint probability density function for the continuous random variables X and Y of expression levels of two different genes.  Note the asymmetric, narrow ridge shape of the PDF ā€“ indicating that small values in the X dimension are more likely to occur when small values in the Y dimension occur.

Marginal Probability Distributions (continuous)

ā€¢ Rather than summing a discrete joint PMF, we integrate a continuous joint PDF.

ā€¢ The marginal PDFs are used to make probability statements about one variable.

ā€¢ If the joint probability density function of random variables X and Y is fXY(x,y), the marginal probability density functions of X and Y are:

Sec 5ā€1.2 Marginal Probability Distributions 18

š‘“ š‘„ š‘“ š‘„, š‘¦ š‘‘š‘¦

š‘“ š‘¦ š‘“ š‘„, š‘¦ š‘‘š‘„ 5 3

š‘“ š‘„ š‘“ š‘„, š‘¦

š‘“ š‘¦ š‘“ š‘„,š‘¦

Conditional Probability Density Function Defined

Sec 5ā€1.3 Conditional Probability Distributions 19

Given continuous random variables š‘‹ and š‘Œ with joint probability density function š‘“ š‘„, š‘¦ , the conditional probability densiy function of š‘Œ given š‘‹ x is

š‘“ | š‘¦š‘“ š‘„, š‘¦š‘“ š‘„

š‘“ š‘„, š‘¦š‘“ š‘„, š‘¦ š‘‘š‘¦

if š‘“ š‘„ 0 5 4

which satifies the following properties:1 š‘“ | š‘¦ 0

2 š‘“ | š‘¦ š‘‘š‘¦ 1

3 š‘ƒ š‘Œ āŠ‚ šµ|š‘‹ š‘„ š‘“ | š‘¦ š‘‘š‘¦ for any set B in the range of Y

Compare to discrete: P(Y=y|X=x)=fXY(x,y)/fX(x)

Conditional Probability Distributions

ā€¢ Conditional probability distributions can be developed for multiple random variables by extension of the ideas used for two random variables.

ā€¢ Suppose p = 5 and we wish to find the distribution of X1, X2 and X3 conditional on X4=x4 and X5=x5.

Sec 5ā€1.5 More Than Two Random Variables 20

š‘“ š‘„ , š‘„ , š‘„š‘“ š‘„ , š‘„ , š‘„ , š‘„ , š‘„

š‘“ š‘„ , š‘„for š‘“ š‘„ , š‘„ 0.

Independence for Continuous Random Variables

For random variables X and Y, if any one of the following properties is true, the others are also true.  Then Xand Y are independent.

Sec 5ā€1.4 Independence 21

1 š‘“ š‘„, š‘¦ š‘“ š‘„ ā‹… š‘“ š‘¦2 š‘“ | š‘¦ š‘“ š‘¦ for all x and y with š‘“ š‘„ 03 š‘“ | š‘¦ š‘“ š‘„ for all x and y with š‘“ š‘¦ 04 P š‘‹ āŠ‚ š“,š‘Œ āŠ‚ šµ š‘ƒ š‘‹ āŠ‚ š“ ā‹… š‘ƒ š‘Œ āŠ‚ šµ for any

sets š“ and šµ in the range of š‘‹ and š‘Œ, respectively. 5 7

P(Y=y|X=x)=P(Y=y) for any x or P(X=x|Y=y)=P(X=x) for any y or P(X=x, Y=y)=P(X=x)āˆ™P(Y=y) for any x and y

26

X and Y are uniformly distributed in the disc x2+y2ā‰¤1

Are they independent?

A. yesB. noC. I could not figure it out

Get your iā€clickers

Credit: XKCD comics