Decision and Risk Exercise 1

Bayes Theorem

Question 1

You are planning a vacation in Italy.  Before packing, you hear that there might be an earthquake the day you arrive.

After consulting Google, you learn that in recent years there have been (on average) five earthquakes a year in the part of the country you are visiting (ignore leap years). Moreover, you learn that when there is an earthquake, the earthquake forecast service has correctly predicted it 90% of the time. However, when there was no earthquake, the forecast service incorrectly predicted 10% of the time that there would be one.

What is the probability that there will be an earthquake on the day you arrive given forecast of an earthquake?

Question 2

Consider a woman who has a brother with haemophilia, but whose father does not have haemophilia. This implies that her mother must be a carrier of the haemophilia gene on one of her X chromosomes and that her father is not a carrier. The woman herself thus has a fifty-fifty chance of having the gene.

The situation involving uncertainty is whether or not the woman carries the haemophilia gene. The parameter of interest θ can take two states:

  • Carries the gene (θ = 1)
  • Does not carry the gene (θ = 0).
  1. Write down the prior distribution for θ using the above information
    1. The data Y is the number of the woman’s sons who are infected. Suppose she has two sons, neither of whom is affected. Assuming the status of the two sons is independent, write down the likelihood function p(Y θ) (if the woman is not a carrier then her sons cannot be affected, but if she is a carrier they each have a 50% chance of being effected).

Find the corresponding posterior distribution for θ.

Bernoulli/Binomial Distribtuion

 Question 3

  • Items are produced on an assembly line and the probability that any item is defective is given by θ. A uniform prior on θ  is assumed (i.e.  Beta(1,1)).  An item is selected from the line and What is the posterior distribution for θ if the item is
  • defective?
  • non defective?
  • The uniform prior is here used to represent the state of having no prior knowledge about θ – i.e. that any value is equally likely. An alternative way to represent lack of knowledge is the Haldane’s prior which is given here by

1/ p(θ) ∝ 1/(θ(1 − θ))

Write this prior as a Beta distribution, and hence find the posterior given that there are Y defective items in a batch of N items. Give a point estimate for θ using the mean of this posterior distribution.

Exponential Distribution

 Question 4

 In the lectures, we started discussing how to perform Bayesian inference for the times between earthquakes. We will now finish the example.

Let Y denote the time between two successive earthquakes that follows the exponential distribution with rate parameter λ, i.e. Y Exponential(λ).  Sup- pose a sample of observations y = (y1, . . . , yn) is available. Then the likelihood function is as follows:

Derive the posterior distribution for λ using the conjugate Gamma(α, β) prior, in a similar way as I did in the lectures using the Beta prior for the Binomial distribution.

Key hint: since the prior is conjugate, the posterior is also going to be a Gamma distribution. You can perform the p(y) = p(y λ)p(λ)integral in the pos- terior denominator using the same ’trick’ we used in the lectures by taking everything that isn’t dependent on λ outside the integral, and ’recognising’ that everything left inside has the same form as the Gamma distribution (which integrates to 1, since it is a probability distribution).

Decision and Risk – Exercise 2

Question 1

 Suppose that a parameter θ can take only two values, θ = 0 or θ = 1. Your prior on θ before observing any data is p(θ = 1) = 0.6. A random variable Y is observable and has the following distribution:

Y |θ = 0 ∼ Gamma(3, 2)

Y |θ = 1 ∼ Gamma(3, 1)

Your task is to estimate the θ. Let action a0 correspond to claiming that θ = 0, and action a1 correspond to claiming that

θ = 1.

The losses corresponding to each action and values of θ are represented by the following loss matrix :

For example, the loss associated with action a1 when the true value of θ = 0 is

L(θ = 0, a1) = 8.

You obtain one observation of Y = 3. Compute the Bayesian expected loss associated with both actions given this observation, and decide which action to take.

Question 2

Consider a drug company deciding whether or not to market a new pain reliever. One of the many factors affecting its decision is the proportion of the market θ the drug will capture. The company desires to estimate θ. Since θ is a proportion, it is clear that Θ =   θ : 0   θ    1   = [0, 1].  Since the goal is to estimate θ, the action taken is simply the choice of a number as an estimate for θ. Hence     = [0, 1]. If a company underestimates demand, i.e. θ     a      0, the loss incurred is θ   a.  However, if a company overestimates demand, i.e. θ a 0, then it is twice as costly as underestimating the demand with the cost being 2(a θ). Assume no data is obtained, however there is a prior information about θ arising from previous introductions of new similar drugs into the market. In the past drugs tended to capture between 1 and 1 of the market, with all values between  1  and 1 being equally likely.

  1. Write down the prior density p(θ) that will reflect this prior
  2. Using the prior density from part a) compute the Bayesian expected loss ρ(π, a) of an action a.