\chapter{Methodology}
\label{ch:method}

\section{Definitions}
With a sample of $X_1, X_2, \ldots , X_n$, write the density estimator
\begin{equation}\label{re:one}
\hat{f}(x)  =  \sum^n_{i=1}{K\left(\dfrac{x-x_i}{h_n}\right)}
\end{equation}
for $X_i =x_i$, $i=1, \ldots , n$.  The \textit{kernel function K} represents how the probability mass is assigned.  For example, for the histogram, in any particular interval, $K$ is constant.  The smoothing function $h_n$ is a positive sequence of bandwidths analogous to the bin width in a histogram.


To estimate $f$, one may use the density of the random variable $\widehat{X}+hZ$, where $\widehat{X}$ has the distribution (conditionally, given $X_1, \ldots, X_n$) and $Z$ is independent of $\widehat{X}$.  From $\eqref{re:one}$, the \textit{bandwidth} satisfies
\begin{equation}
h \equiv h_n \longrightarrow \textrm{as} \hspace{.15cm} n \rightarrow \infty
\end{equation}

$\widehat{X} + hZ$ has the density.

\begin{equation}\label{re:two}
\widehat{f_n}(x) = \frac{1}{n}\sum^n_{i=1}{K_h(x-X_i)}, 
\end{equation}
where $K_h$ is the density of $hZ$.  From $\eqref{re:two}$, using the following definition for $K_h$ below, will obtain \eqref{re:one}.  
\begin{equation}\label{re:three}
K_h(y) = \frac{1}{h}K\left(\dfrac{y}{h}\right)
\end{equation}

\newpage

The kernel function $K$ has five important properties
\begin{itemize}
\item  $K(x)  \geq 0$ \,\, $\forall \, x$ 
\item  $K(x)  =  K(-x)$ \,\, $\forall$\, $x>0$ 
\item  $\int K(u)du  =  1$ 
\item  $\int uK(u)du =  0$ 
\item  $\int u^2K(v)dv  =   \sigma^2_k < \infty $
\end{itemize}


Basic idea is that $K$ controls the shape, $h_n$ controls the spread of the kernel.  The accuracy of a density estimator can be evaluated using he mean intergrated squared error, defined as 
\begin{eqnarray} \label{re:four}
	\textrm{MISE} & = & \mathbf{E}\left( \int{(f(x) - \hat{f}(x))^2}dx\right) \nonumber\\
								& = & \int{\textrm{Bias}^2(\hat{f}(x))dx} + \int{\mathbf{V}ar(\hat{f}(x))dx}
\end{eqnarray}


To find a density estimator that minimizes the MISE under the five constraints, also will assume that $f(x)$ is continuous and twice differentiable, $h_n \rightarrow 0$ and $nh_n \rightarrow \infty$ as $n \rightarrow \infty$.  Under these conditions, 
\begin{eqnarray}
	\textrm{Bias} & = & \frac{\sigma^2_K}{2}f''(x) + O(h^4_n) \nonumber \\
	\; \nonumber\\
	\textrm{Var}\left(\hat{f}(x)\right)	& = & \frac{f(x)R(K)}{nh_n} + O(n^{-1}) 
\end{eqnarray}
where $R(g) = \int{g(u)^2du}$


Determine the minimum MISE by the choice of $h_n$.  However, choosing $h_n$ to reduce the bias will increase the variance and vice versa, there is a trade off.  The choice of the \textit{bandwidth} is important to the construction of $\hat{f}(x)$.  
\vspace{.25cm}

If $h$ is chosen to be small, the minor difference in main part of the density will be apparent.  If $h$ is choose to be large, the tails of the distribution are better modeled, but fail to see important characteristics of the middle quartiles of the data.


Using numerical integration from the distributions of the data, as well as, using R packages, VaR calculations were done on the data.  
