%% nclexample.tex 
%%    GRS - 09/10/09 (updated to current format)
%%    GRS - 12/10/06 (updated to current format)
%%    DJW - 17/10/98
%% Example of using the nclexam style fle with latex2e:
%%  needs style file nclexam.sty .
%% (Style file also works with old latex.)

\documentclass[11pt,a4paper]{article}
%% NB: 11 pt is needed for most verbose front-page instructions.
%\documentclass[11pt,a4paper]{article}

\usepackage{nclexam,amsmath,amssymb,psfrag}
\usepackage{graphicx,ifthen,color,microtype}

%%ngrs:  set write-on paper booleans to false here
%%  (set appropriately below, if nec., with appropriate rubrics)
\newboolean{writeon} 
\setboolean{writeon}{false}
\newboolean{writeonsectaonly}
\setboolean{writeonsectaonly}{false}

\newcommand{\expt}{\mathsf{E}}
\newcommand{\var}{\mathsf{var}}
\newcommand{\cov}{\mathsf{cov}}

%% Declare exam information here

\moduleno{MAS8306: Solutions (Q1--Q4)}
\modulename{Topics in Statistics Specimen Paper} %% Use mixed case
\semester{2}              %% Use 0 for resits
\year{2015/2016}
%\month{AUGUST}           %% Upper case. Needed only for resits (\semester{0})
%\year{2010}              %% Just use year in August for resits
\prof{Fawcett}             %% Module leader (not currently used)

%% Choose the rubric appropriate for the paper:
%%   Rubric A: Stage 1, Stage 4 papers w/ no choice.
%%     (No sections, all compulsory.)
%%   Rubric B: Stage 2-3 papers, plus Stage 4 variants of Stage 3 papers
%%     (with different Section A:B splits).
%%     (Sections A and B, all compulsory.)
%%   Rubric D: Stage 4 papers w/ choice.
%%     (No sections, some choice.)
%%   Rubric E: MAS8114 only.
%%     (Compulsory section A, choose 1 of 3 in Section B.)

\rubric{A}                %% NB: need comment out \sect{A}, \sect{B}, below.
\numquestions{SIX}       %% Upper case. Number of questions.
%% Write time in hours and minutes
%\time{1 hour 30 minutes}  %% For Stage 1
%\time{2 hour 15 minutes}  %% For Stage 4 module w/o significant ICA
\time{2 hours}             %% For Stage 4 module w/ significant ICA
%% Set booleans to true for write-on format.
%% roughpages are only added if writeon is true
%% (nb: roughpages must be defined if writeon is true, even if 0 are needed)
\setboolean{writeon}{false}  %% Set to true (false) for (non-)write-on format
%\roughpages{0}            %% No. of rough work pages at end of paper

%\rubric{B}
%\numSectA{FOUR}            %% Upper case.  Number of section A questions.
%\numSectB{THREE}            %% Upper case.  Number of section A questions.
%\time{1 hour 30 minutes}  %% For 10 credit papers. Write in hours and minutes.
%\time{2 hour 15 minutes}  %% For 20 credit papers. Write in hours and minutes.
%\setboolean{writeon}{true}  %% Set to true (false) for (non-)write-on format
%\setboolean{writeonsectaonly}{true}  %% Subsidiary choice
%\roughpages{0}              %% No. of rough work pages at end of paper

%\rubric{D}                %% NB: need comment out \sect{A}, \sect{B}, below.
%% Should be either:
%%  4 of 6 questions for 2 1/4 hour exam (Stage 4 module w/o significan ICA);
%%  3 of 4 questions for 2 hour exam     (Stage 4 module w/  significan ICA).
%\numquestions{SIX}       %% Upper case.  Number of questions.
%\attempt{FOUR}             %% Upper case.  Number of questions to attempt.
%\time{2 hour 15 minutes} %% Write in hours and minutes
%\numquestions{FOUR}       %% Upper case.  Number of questions.
%\attempt{THREE}             %% Upper case.  Number of questions to attempt.
%\time{2 hour} %% Write in hours and minutes

%\rubric{E}
%\time{2 hours 15 minutes} %% Write in hours and minutes

%% Use one of these (or define new combinations), if needed.
\extrainstructions{}  
%\extrainstructions{Calculators may be used.}
%\extrainstructions{Calculators may not be used.}

%\extrainstructions{Graph paper and statistical tables will be provided.} 
%\extrainstructions{Graph paper will be provided.} 
%\extrainstructions{Statistical tables will be provided.} 

\extrainfo{} % usually blank
\briefextrainfo{} % usually blank

% for further details, see the style file itself.

%%ngrs: add macro for answer gap.  
%% NB: Only inserts gap if writeon is true
\newcommand{\answergap}[1]{\ifthenelse{\boolean{writeon}}{         

\parbox[c][0.7cm][c]{\textwidth}{\bf Answer:} 
\parbox[c][#1][c]{\textwidth}{}
}{}
}

%%%ngrs: add macro for margins for write-on papers
\definecolor{MyGray}{rgb}{0.7,0.7,0.7}
\newcommand\marginline{
\setlength{\unitlength}{1.0cm}
\begin{picture}(0,0)
  \put(0,2){\textcolor{MyGray}{\line(0,-1){40}}}
\end{picture}
}

%%%ngrs: add macro for subsection marks, for questions worth > 20 marks
\newcommand{\submarks}[1]{\ \newline \makebox[5.39truein]{\ \hfill [\bf #1\ marks]}}
\newcommand{\subsinglemark}[1]{\ \newline \makebox[5.39truein]{\ \hfill [\bf #1\ mark]}}
\begin{document}
\makefront % produce the front page

%%%ngrs: change fancyhdr to add margins for write-on pages
\ifthenelse{\boolean{writeon}}{\fancyhead[L]{{\marginline}\textcolor{MyGray}{Please leave margins blank}}}{}

\vspace{1cm}

\textbf{Exponential distribution}:

\vspace{0.05cm}

If $X\sim Exp(\lambda)$, then it has distribution function
\[
F_{X}(x;\lambda)=1-e^{-\lambda x},
\]
$x>0,\lambda>0$.

\vspace{1cm}

\textbf{Generalised Extreme Value distribution}:

\vspace{0.05cm}

If $X\sim GEV(\mu,\sigma,\xi)$ then it has distribution function
\[
G_{X}(x;\mu,\sigma,\xi)=\left\{ \begin{array}{c c}
\textrm{exp}\left\{-\left[1+\xi\left(\displaystyle \frac{x-\mu}{\sigma}\right)\right]_{+}^{-1/\xi}\right\}, &\xi \neq 0; \\
& \\
\textrm{exp}\left\{-\textrm{exp}\left(\displaystyle \frac{x-\mu}{\sigma}\right)\right\}, &\xi=0, \end{array} \right.
\]
$-\infty<\mu<\infty,-\infty<\xi<\infty, \sigma>0, a_{+}=\textrm{max}(0,a).$

\vspace{1cm}

\textbf{Generalised Pareto distribution}:

\vspace{0.05cm}

If $X\sim GPD(\tilde{\sigma},\xi)$ then it has distribution function
\[
H_{X}(x;\tilde{\sigma},\xi)= \left\{ \begin{array}{c c} 
             1-\left(1+\displaystyle \frac{\xi x}{\tilde{\sigma}}\right)_{+}^{-1/\xi}, &\xi\neq 0; \\
& \\
             1-\textrm{exp}\left(-\displaystyle \frac{x}{\tilde{\sigma}}\right) &\xi=0,\end{array} \right.
\]
$-\infty<\xi<\infty, \tilde{\sigma}>0, a_{+}=\textrm{max}(0,a)$. 

\vspace{1cm}



\newpage

\vspace{-1.3cm}

%\sect{A} % begin Section A 
\begin{longquestion}{Total Q1: 20}
\vspace{-1.25cm}
\begin{itemize}
\item [(a)]
If there exist sequences of constants $a_{n}>0$ and $b_{n}$ such that, as $n \to \infty$,
\[
\textrm{Pr}\left\{(M_{n}-b_{n})/a_{n}\leq x\right\} \to G(x) 
\]
for some non--degenerate distribution $G$, then $G$ is of the same type as one of the following distributions:
\[\mbox{\textrm{\it I}}: G(x) = \textrm{ exp}\left\{-\textrm{ exp}(-x)\right\} \qquad -\infty<x<\infty; 
\] 
\[
\mbox{\textrm{\it II}}:G(x) = \left\{ \begin{array}{ll}
0	&x \leq 0 \\
\textrm{ exp}(-x^{-\alpha})	&x>0, \alpha>0;
\end{array} \right.
\] 
\[
\mbox{\textrm{\it III}}:G(x) = \left\{ \begin{array}{ll}
\textrm{ exp}\left\{-(-x)^{\alpha}\right\} &x<0, \alpha>0 \\
1	&x \geq 0.
\end{array} \right. 
\]
\submarks{4}

\vspace{0.5cm}

\item [(b)] We know that
\[
\textrm{Pr}\left\{M_{n}\leq x\right\} = F^{n}(x) \approx G(x) = \textrm{exp}\left\{-\left[1+\xi\left(\frac{x-\mu}{\sigma}\right)\right]_{+}^{-1/\xi}\right\},
\]
for some parameters $\mu$, $\sigma$ and $\xi$.   Hence 
\[
n\textrm{log }F(x) \approx -\left[1+\xi\left(\frac{x-\mu}{\sigma}\right)\right]_{+}^{-1/\xi} \qquad (\ddagger)  
\] 
Substitution of the result given, into $(\ddagger)$, gives 
\begin{eqnarray*}
     1-F(u)                     &\approx& \frac{1}{n}\left[1+\xi\left(\frac{u-\mu}{\sigma}\right)\right]_{+}^{-1/\xi} 
\end{eqnarray*}
for large $u$.   Similarly, for $y>0$,  
\[
1-F(u+y)    \approx \frac{1}{n}\left[1+\xi\left(\frac{u+y-\mu}{\sigma}\right)\right]_{+}^{-1/\xi}.
\]
Then
\begin{eqnarray*}
\textrm{Pr}\left\{X>u+y|X>u\right\} &= & \frac{1-F(u+y)}{1-F(u)}  \\
& & \\
                                  &\approx& \frac{\frac{1}{n}\left[1+\xi\left(\frac{u+y-\mu}{\sigma}\right)\right]_{+}^{-1/\xi}}{\frac{1}{n}\left[1+\xi\left(\frac{u-\mu}{\sigma}\right)\right]_{+}^{-1/\xi}}  \\
&=& \left[\frac{1+\xi\left(\frac{u-\mu}{\sigma}\right) + \xi \frac{y}{\sigma}}{1+\xi\left(\frac{u-\mu}{\sigma}\right)}\right]_{+}^{-1/\xi}  \\
&=&\left[1+\frac{\xi y}{\tilde{\sigma}}\right]_{+}^{-1/\xi}, \qquad \textrm{as required},
\end{eqnarray*}
where $\tilde{\sigma} = \sigma+\xi(u-\mu)$. \submarks{8}

\vspace{0.5cm}

\item [(c)]
\begin{itemize}
\item [(i)] The $r$ year return level, $z_{r}$, is the value we can expect to be exceeded once, on average, every $r$ years. \submarks{2}
\item [(ii)] 
\begin{eqnarray*}
\textrm{Pr}(X>u+y|X>u) \approx \left[1+\frac{\hat{\xi} y}{\hat{\sigma}}\right]_{+}^{-1/\hat{\xi}},
\end{eqnarray*}
Now
\[
\textrm{Pr}(X>u+y|X>u)   =\frac{\textrm{Pr}(X>u+y)}{\textrm{Pr}(X>u)},
\]
giving
\[
\textrm{Pr}(X>u+y)  = \lambda_{u}\textrm{Pr}(X>u+y|X>u),
\]
where $\lambda_{u}=\textrm{Pr}(X>u)$.  
Thus,
\begin{eqnarray*}
\textrm{Pr}(X>u+y)  &\approx& \lambda_{u}\left[1+\frac{\xi y}{\sigma}\right]_{+}^{-1/\xi} \qquad \textrm{i.e.} \\
\textrm{Pr}(X>x)    &\approx& \lambda_{u}\left[1+\xi\left(\frac{x-u}{\sigma}\right)\right]_{+}^{-1/\xi}.
\end{eqnarray*}
Equating the RHS of the above expression to $1/t$ and solving for $x=z_{t}$ gives the $t$--\underline{observation} return level:
\begin{eqnarray*}
 z_{t}&\approx& u+\frac{\sigma}{\xi}\left[(t\lambda_{u})^{\xi}-1\right];
\end{eqnarray*}
On an annual scale, we now replace $t$ with $r \times n_{y}$ to get the $r$--\underline{year} return level $z_{r}$:
\[
z_{r} =  u+\frac{\sigma}{\xi}\left[(rn_{y}\lambda_{u})^{\xi}-1\right],
\]
as required.  \submarks{6}
              
\end{itemize}
\end{itemize}
\end{longquestion}

\newpage

\begin{question}{Total Q2: 9}
\begin{itemize}
\item [(a)] Model \texttt{M2} allows for a linear trend in the location parameter, that is
\[
\mu(t) = \beta_{0}+\beta_{1} t,
\]
where $t=1, 2, \ldots, 51$.  In fact, the slope term $\beta_{1}$ corresponds to the annual rate of change in annual maximum sea surges at Grand Isle. It is positive, suggesting increasing levels of sea surge extremes over time.  
\\
\\
Model \texttt{M1} assumes the location parameter is constant. \submarks{3} 
\item [(b)] We have
\[
D = 2\left\{-41.74466-(-48.40894)\right\} = 13.32856,
\]
which is large relative to $\chi^{2}_{1}(0.05)=3.841$.  Thus,  the linear trend component explains a substantial amount of the variation in the data, and is likely to be a genuine effect in the sea surge process.  \submarks{2}

\item [(c)] 
\begin{itemize}
\item [(i)] The 95\% confidence interval is $-0.028\pm 1.96 \times 0.083 = (-0.191, 0.135)$ which suggests a Gumbel--type tail (unbounded).  \submarks{2}
\item [(ii)]
For the GEV, we have 
\[
z_{r} = \mu+\frac{\sigma}{\xi}\left[\left(-\textrm{log}\left(1-r^{-1}\right)\right)^{-\xi}-1\right].
\]
Here, we have $t=59$ for the year 2020, giving:
\begin{eqnarray*}
\hat{\mu} &=& 3.182+0.0185\times 59 = 4.2735, \\
\hat{\sigma} &=&0.4780, \\
\hat{\xi} &=&-0.0278.
\end{eqnarray*}
Substitution in the return level equation (with $r=100$)
\[
\hat{z}_{100} = 4.2735 - \frac{0.4780}{0.0278}\left[\left(-\textrm{log}(1-1/100)\right)^{0.0278}-1\right] = 6.34 \textrm{ feet}. 
\] \submarks{2}
\end{itemize}
\end{itemize}
\end{question}

\newpage

\begin{question}{Total Q3: 11}
\begin{itemize}
\item [(a)] Now the variance--covariance matrix for $(\hat{\sigma},\hat{\xi})$ is given by
\begin{eqnarray*}
(-H)^{-1} &=& \frac{1}{38.21\times 2027.11 - 256.7^{2}}\left( \begin{array}{c c}
                                                      2027.11  &-256.7\\
                                                      -256.7   &38.21 \end{array}
\right) \\
              & & \\
                 &=&\left( \begin{array}{c c}
                               0.175   &-0.022 \\
                               -0.022    &0.003 
                               \end{array} \right).
\end{eqnarray*}
Also, 
\[
\textsf{var}(\hat{\lambda}_{u}) = \hat{\lambda}_{u}(1-\hat{\lambda}_{u})/N = \frac{235}{30581}\left(1-\frac{235}{30581}\right)/30581 = 2.49\times 10^{-7},
\]
giving
\[
V=\left(\begin{array}{c c c} 
                  2.49\times 10^{-7}   &0  &0 \\
                   0                   &0.175 &-0.022 \\
                   0                   &-0.022&0.003 \end{array} \right).
\] \submarks{5}
\item [(b)] We have 
\[
\hat{z}_{50} = 30 - \frac{5.10}{0.44}\left[(50\times 365.25 \times0.00768)^{-0.44}-1\right] = 40.27^{\textrm{o}}\textrm{C}.
\] \submarks{2}

\item [(c)] From the plot, using a cut-off of $0.5\times \chi^{2}_{1}(0.05) = 1.921$, gives
\[
(39.75^{\textrm{o}}\textrm{C}, 41.4^{\textrm{o}}\textrm{C}).
\] \submarks{2}

\item [(d)] Problems: 
\begin{itemize}
\item How do we choose $\kappa$?
\item $\kappa$ too large $\longrightarrow$ too few cluster peaks
\item $\kappa$ too small $\longrightarrow$ independence assumption violated
\item Sensitivity of estimates of $\sigma$ and $\xi$ (and possible return levels) on the choice of $\kappa$ (e.g. Fawcett and Walshaw (2012)!)
\end{itemize} \submarks{2}
\end{itemize}
\end{question}

\newpage

\begin{question}{Total Q4: 10}
\begin{itemize}
\item [(a)] Example: Often, it is the combination of extremes of many environmental variables that cause destruction/devastation.  For example, during a hurricane, it might be the combination of (i) extremely strong winds, and (ii) extremely heavy rain, that results in sea--surge and mass flooding.  \submarks{2}
\item [(b)] 
\begin{itemize}
\item [(i)] The assumptions are that $X_{i}$ and $Y_{i}$, $i=1, 2, \ldots, n$ are unit Fr\'{e}chet distributed.  In practice, this is achieved by marginally fitting the GPD to excesses of $u_{x}$ for $X$ and excesses of $u_{y}$ for $Y$, and then transforming to unit Fr\'{e}chet using the fitted GPD parameters $(\hat{\sigma}_{x},\hat{\xi}_{x})$ and $(\hat{\sigma}_{y},\hat{\xi}_{y})$. \submarks{2}  
\item [(ii)] The parameter $\alpha$ controls the degree of extremal dependence between $X$ and $Y$.  For independent extremes, $\alpha=1$; as $\alpha \to 1$ we have increasing levels of extremal dependence. \submarks{2} 
\item [(iii)] If $x_{i}<u_{x}$ and $y_{i}>u_{y}$, then we have 
\begin{eqnarray*}
\frac{\partial H}{\partial y}\Bigg|_{(u_{x},y_{i})}&=& y_{i}^{-(1/\alpha+1)}\left(u_{x}^{-1/\alpha}+y_{i}^{-1/\alpha}\right)^{\alpha-1}\textrm{exp}\left\{-\left(u_{x}^{-1/\alpha}+y_{i}^{-1/\alpha}\right)^{\alpha}\right\} 
\end{eqnarray*}
\submarks{4}
\end{itemize}
\end{itemize}
\end{question}

\theend
\end{document}

