Random Variables, Probability

Rasim Muzaffer Musal

Goals

  • Study Problems: {Binomial Distribution, Poisson Distribution, Normal Distribution}

Problem Context 1

  • Milk cows can yield about 180-210 gallons a milk a month. Even though they can live up to 20 years in captivity, due to isues of profitability they are sent for slaughter at approximately 5 years of age due to drop in milk yields. Assume you are a farmer with 10 cows at the beginning of the year. Also assume that milk yields follow a normal distribution with mean 195 gallons with a standard deviation of 12.5 gallons of milk.

Problem Context 2

  • You would like to come up with a very basic model that will predict before the cows become inefficient so that you can plan the calving season. Therefore you decide that if a cow yields less than 170 gallons for a month, you will send her to the slaughterhouse at end of month.

Basic Study Questions

  • Define the random variable that will allow you to answer the question that a cow is going to yield less than 170 gallons of milk a month.

  • Answer: X \(\equiv\) Gallons of milk a cow yields in a month.

  • Note: The latin letter X is arbitrary, Y,Z,T \(\ldots\) are all acceptable.

  • Describe the probability with probability notation that a cow is going to yield less than 170 gallons of milk a month.

  • Answer: \(P(X<170)\)

Basic Study Questions

  • Evaluate the probability that the cow is going to yield less than 170 gallons of milk a month.

  • The problem defined this as a quantity which has a normal distribution. This of course is not really realistic but these sort of assumptions can easily be relaxed.

  • Now we know X has a normal distribution, let us write its’ distribution in the probabilistic format:

\[X \sim N(195,12.5)\]

Basic Study Questions

\[P(X<170|\mu=175,\sigma=12.5)\]

Basic Study Questions

\[P(X<170|\mu=175,\sigma=12.5)\]

Basic Study Questions

\[P(X<170|\mu_{x}=175,\sigma_{x}=12.5)=P(Z<-2|\mu_{z}=0,\sigma_{z}=1)\]

[1] 1 2

Basic Study Questions

  • \(P(X<170|\mu=195,\sigma=12.5)=P(Z<-2)\)

  • In Excel: =NORM.S.DIST(-2,TRUE) = 0.02275

  • In the excel function TRUE allows you find the area to the left of z-score -2 which gives you the same result.

  • In R: pnorm(-2) = 0.02275

Basic Study Questions

  • You start the month with 20 cows. What is the probability that you will have at least 18 cows at the end of the month?

  • Define the random variable to answer the question.

  • Y\(\equiv\) Number of cows that survive to the end of month.

  • What distribution does this random variable have?

  • Binomial distribution. We can conceptualize survival/death of the house as a Bernoulli distribution and there are exactly 20 of them.

Basic Study Questions

  • Write the question with probability notation.

  • P(Y \(\ge\) 18 |n=20,p=1-0.02275=0.97725)

  • Explanation: Another way to write P(Y \(\ge\) 18) is P(Y=18)+P(Y=19)+P(Y=20).

  • Evaluate the probability that there will be at least 18 cows at end of month.

  • This would require 3 separate calculations in excel, P(Y=18)+P(Y=19)+P(Y=20). Takes too much time. Instead:

Basic Study Questions

  • P(Y \(\le\) 17)+P(Y \(\ge\) 18)=1 so if we can evaluate P(Y \(\le\) 17) we can subtract the result from 1 and have the answer.

  • In excel P(Y \(\le\) 17) is =BINOM.DIST(17,20,0.97725,TRUE)=0.01005

  • \(\therefore\) P(Y \(\ge\) 18) = 1-0.01005=0.98995

  • In R P(Y \(\le\) 17) is pbinom(17,20,0.97725) = 0.1005.

  • \(\therefore\) P(Y \(\ge\) 18) = 1-0.01005=0.98995.

Basic Study Questions

  • Patients arrive at an emergency room with a variance of 5 per hour. Assume arrivals happen with a Poisson distribution. Remember in Poisson distributions \(\lambda\) is the mean and variance of random variable.

  • Define the random variable to answer the following question: Find the probability that there will be more than 3 patients arriving within the hour.

  • X \(\equiv\) Number of patients arriving per hour.

Basic Study Questions

  • Write the question in probability notation “Find the probability that there will be more than 3 patients arriving within the hour”

  • Remember that Poisson distribution is discrete and therefore X being more than 3 means X can be 4 or more.

  • \(P(X>3 | \lambda=5)=P(X \ge 4 | \lambda=5)\)

Basic Study Questions

  • Evaluate the probability that there will be more than 3 patients arriving within the hour.

  • \(P(X>3 | \lambda=5)=P(X \ge 4|\lambda=5)\) and since Poisson random variables can hypothetically take values from 0 up to \(\infty\) we can not calculate each probability of X that is greater than 3.

  • Instead we need to think in terms of compliments again: \(P(X \le 3) + P(X \ge 4) = 1\)

Basic Study Questions

  • \(P(X \ge 4 |\lambda=5)=?\)
  • \(P(X \ge 4 |\lambda=5)=1-P(X \le 3 |\lambda=5)\)
  • In Excel \(P(X \le 3 |\lambda=5)\): =POISSON.DIST(3,5,TRUE)=0.265
  • In R \(P(X \le 3 |\lambda=5)\): ppois(3,5)=0.265
  • \(\therefore\) 1-0.265 = 0.735.

Basic Study Questions

  • Define the random variables to answer that there will be 5 arrivals to the E.R. in between 7-8 pm and 9 arrivals between 8-9 pm.

  • \(X_{1}\) = Number of arrivals between 7-8 pm

  • \(X_{2}\) = Number of arrivals between 8-9 pm

  • Write with probability notation that there will be 5 arrivals to the E.R. in between 7-8 pm and 9 arrivals between 8-9 pm.

  • \(P(X_{1}=5,X_{2}=9)|\lambda=5)\)

Basic Study Questions

  • Calculate the probability that there will be 5 arrivals to the E.R. in between 7-8 pm and 9 arrivals between 8-9 pm.

  • We need to assume that \(X_{1}\) and \(X_{2}\) are probabilistically independent of each other given information of poisson distribution.

  • \(P(X_{1}=5,X_{2}=9)|\lambda=5)=\)

  • \(P(X_{1}=5|\lambda=5)*P(X_{1}=9|\lambda=5)\)

Basic Study Questions

  • In Excel: \(P(X_{1}=5|\lambda=5)=\)POISSON.DIST(5,5,FALSE)=0.175 and \(P(X_{1}=9|\lambda=5)=\)POISSON.DIST(9,5,FALSE)=0.0363.
  • In R: \(P(X_{1}=5|\lambda=5)=\)dpois(5,5)=0.175 and \(P(X_{1}=9|\lambda=5)=\)dpois(9,5)=0.0363.
  • \(\therefore\) 0.175*0.0363 \(\approx\) 0.006.