Question 1

You poll 1000 people and ask 2 questions:

  1. Are you physically active?
  2. Have you ever had a heart attack?

You get the following information - 10% of people get a heart attack - 60% of people who had a heart attack were not physically active - 70% of people who did not have a heart attack were physically active

  1. Convert these statement to marginal and conditional probabilities.

\(P(attack) = 0.1\)

\(P(not~active|attack) = 0.6\)

\(P(active|no~attack) = 0.7\)

  1. Compute the probability to have no heart attack.

\(P(no~attack) = 0.9\)

  1. Compute the probability to be active given a heart attack.

\(P(active|attack) = 1 - 0.6 = 0.4\)

  1. Compute the probability to be not active given no heart attack.

\(P(not~active|no~attack) = 1 - 0.7 = 0.3\)

  1. Create a tree diagram

First level: attack

Second level: active|attack

  1. Compute all joint probabilities (four probabilities in total).

\(P(active\cap attack) = 0.1 \cdot 0.4 = 0.04\)

\(P(not~active\cap attack) = 0.1 \cdot 0.6 = 0.06\)

\(P(active\cap no~attack) = 0.9 \cdot 0.7 = 0.63\)

\(P(not~active\cap no~attack) = 0.9 \cdot 0.3 = 0.27\)

  1. Compute all marginal probabilities (four probabilities in total).

\(P(attack) = 0.1\)

\(P(no~attack) = 0.9\)

\(P(active) = 0.04 + 0.63 = 0.67\)

\(P(not~active) = 0.06 + 0.27 = 0.33\)

  1. What is the probability to have a heart attack given that you are active?

\(P(attack|active) = 0.04/0.67 = 0.0597\)

  1. Apply the Bayesโ€™ rule and make sure you get the same answer.

Question 2

  1. Compute the expectation of a Bernoulli random variable with p = 0.1.

\(E(X) = 0\cdot 0.9+1\cdot0.1 = 0.1\)

  1. What is the general formula for arbitrary p?

\(E(X) = 0\cdot(1-p)+1\cdot p = p\)

  1. Compute the variance of a Bernoulli random with p = 0.1.

\(Var(X) = (0 - 0.1)^2\cdot0.9+(1-0.1)^2\cdot0.1 = 0.01\cdot0.9+0.81\cdot0.1 = 0.009+0.081 = 0.09\)

  1. What is the general formula for arbitrary p?

\(Var(X) = (0-p)^2\cdot (1-p)+(1-p)^2\cdot p = p^2\cdot(1-p)+(1-p)^2\cdot p = p\cdot(1-p)(p+1-p) = p\cdot(1-p)\)

Question 3

You have a bag with 7 items, the probability of an item to be defective is 0.2.

  1. What type of random variable can be used to represent defectiveness of one item?

Bernoulli with p = 0.2. X = 1 if defective and X = 0 if not defective.

  1. What type of random variable can be used to represent the number of defective items among these 7?

Binomial with p = 0.2 and n = 7.

  1. Use the table (see Files/Tables on Quercus) to find the probability to have 3 out of 7 defective items?

The probability is 0.1147

  1. Use the table to draw the distribution diagram the number of defective items.

  2. How would you use this table if I ask you to find the probability to have 3 out of 7 defective items if the probability for a an item to be defective is 0.8?

It is the same as the probability to have 4 out of 7 not defective* items if the probability for an item to be not defective is 0.2. Using the table we get 0.0287.