### Decision and Risk Exercise 9

#### Question 1

Let *X _{t} *denote a daily log-return of a particular stock at time

*t*. The historical record of log-returns over the last 5 days is as follows:

*X*_{1} = *−*2*.*2*, X*_{2} = 2*.*1*, X*_{3} = 0*.*4*, X*_{4} = *−*3*.*4*, X*_{5} = *−*2*.*6

Find the corresponding probability of log-return, *Y*_{6}, on day six being below 3. Use a Generalised Pareto Distribution (GPD) to approximate the distribution of the log-returns below the threshold *u *= 2. You can use the method of moments to find point estimates for the GPD parameters.

#### Question 2

In the lecture, we saw that the terrorism data-set showed there were around 2000 deadly attacks per year, in the years 2002-2007. In actual fact, here are the number of attacks per year:

Year | Number of Attacks |

2002 | 883 |

2003 | 648 |

2004 | 960 |

2005 | 2361 |

2006 | 3555 |

2007 | 2763 |

There hence seems to be a large amount of variation in the number of attacks. Suppose that we now want to model how many attacks occur each year (so we want to ask questions such as ”What is the probability of more than 2500 attacks occurring in a single year). I want you to construct a Bayesian model to answer this question.

We will treat the number of attacks each year between 2002-2007 as independent random variables from some distribution. Let *Y _{i} *denote the number of attacks per year, where

*Y*

_{1}is the number of attacks in 2002, and

*Y*

_{6}is the number of attacks in 2007 (we ignore the years prior to 2002, since the 9/11 event in 2001 changed terrorist behaviour substantially).

- A commonly used distribution for this sort of data is the Poisson distribution, i.e. we assume that
*Y*_{1}*, . . . , Y*_{6}is an independent sample from a Poisson distribution with parameter*λ*. This means that:

*Y **p*(*Y **|**λ*) = *Y *! *e*^{−}

The conjugate prior for the Poisson distribution is the Gamma(*α, β*) distribution (as it was for the Exponential). So:

*p*(*λ*) = *β**α *Γ(*α*) *λ**α**−*1*e**−**βλ*

If we have *n *observations *Y*_{1}*, . . . , Y _{n}*, show that the corresponding posterior distribution is:

*n **p*(*λ**|**Y *) = *Gamma*(*α *+*Y _{i}, β *+

*n*)

*i*=1

- Since we only have 6 years of data (i.e. only 6 values of
*Y*), the prior we choose will make a lot of difference – remember that the prior has more impact when there is only a small amount of data. Ideally, we want to use an informative prior since there are so few observations, so having some sensible prior knowledge will allow us to get a better_{i}

Suppose that an analyst has told you that based on his expert knowledge of terrorism, he believes that the average number of attacks is 1000, with a standard deviation of 700. We now want to choose the parameters *α *and *β *of the Gamma prior to reflect this.

If a random variable *X *has a Gamma(*α, β*) distribution, then its mean and variance are:

*α α*

*E*[*X*] = *β , **V ar*[*X*] = *β*2

Using this information, work out the values of *α *and *β *that would reflect the prior beliefs of the analyst (i.e. rearrange the above equations). Plot the resulting Gamma prior in R.

Note: you can check that you have found the right values of *α *and *β *by simulation a large number (e.g. 10000) observations from a Gamma distri- bution with your computed parameter values, using the rgamma() function in R. In other words if you think *α *= *a *and *β *= *b*, then doing mean(rgamma(10000, a,b)) should return around 1000, and sd(rgamma(10000,a,b)) should be around 700.

- Using the above, write down the posterior distribution of
*λ*based on the 6 years of data, and the analyst’s prior

- Find the posterior probability of there being more than 1900 attacks in a single Recall from the lecture that:

*p*(*Y*˜ *>* *D*) = ∫ *p*(*Y*˜ *>* *D**|**λ*)*p*(*λ**|**Y* )*dλ*

- Find the probability of there being more than 1900 attacks in a single year when we treat
*λ*as being known and equal to the maximum likelihood estimator, rather than estimating it. Note that the maximum likelihood estimate of*λ*in a Poisson distribution is;

*n**λ*ˆ = *Y _{i }*

*n*

*i*=1

The ppois() function in R can be used to evaluate the tail probability (remember that typing ?ppois will give you the function documentation).

- Now find the probability of there being more than 2500 attacks in a given year given that
*λ*is equal to the maximum likelihood estimate. What can you conclude about the choice of the Poisson distribution for*p*(*Y**|**λ*) here?

**SAMPLE SOLUTION FOR EXERCISE 9**

**
**