# Anomaly Detection in Financial Time Series by Principal Component Analysis and Neural Networks +
## 7 Application to a Downstream Task: Value-at-Risk Computations
The green square represents the mean of the VaR estimates. For the four first box plots, the means are approximately on the same level, which is confirmed by the results in Table 18. The anomalies present among the time series' observed values had a non-negligible impact on the distribution parameter estimation, which ultimately caused an incorrect estimation of the VaR. Thanks to the localization of the anomalies by the suggested model and their imputation as per Section 6.1, we were able to obtain a more accurate estimation of the VaR. The \(\text{VaR}^{loc,true}\) and \(\text{VaR}^{loc,pred}\) were quite similar, which shows that the model accurately localized the anomalies. \begin{table}
\begin{tabular}{c l} \hline \hline
**VaR Estimation Name** & \(\widehat{\mu_{R}},\widehat{\Sigma_{R}}\)** **Estimated on** \\ \hline VaR\({}^{clean}\) & Time series without anomalies \\ VaR\({}^{anom}\) & Times series with anomalies \\ VaR\({}^{loc,true}\) & Time series after anomaly imputation knowing their true localization \\ VaR\({}^{loc,pred}\) & Time series after anomaly imputation based on predicted localization \\ \hline \hline \end{tabular}
\end{table} 
Table 17: Notations of VaR estimations based on the time series from which the VaR parameters were estimated. We also evaluated the errors in the VaR estimations using the mean absolute error and the mean relative error, taking the VaR\({}^{tho}\) as our benchmark. As one can see in Table 19, even when the distribution parameters were estimated from the clean time series, the VaR computed with these parameters was not exactly the same as the one computed with the theoretical parameters. This can be explained by the historical size of the observed values used to estimate the parameters. This table shows that by removing anomalies we can reduce by a factor of two the errors in the VaR estimations. Additionally, we assessed the impact on VaR\({}^{tho}\), VaR\({}^{clean}\), VaR\({}^{anom}\), VaR\({}^{loc,true}\), and VaR\({}^{loc,pred}\) of increasing \(n^{anom}\). To this end, we performed 50 simulation runs of stock paths for \(n^{anom}\) and for each of those scenarios we estimated the VaR of the portfolio. We summarize the results in Figure 18, where each curve represents the mean VaR estimation with respect to \(n^{anom}\), along with a representation of the uncertainty around each evaluated point through a confidence interval. When we computed the VaR using the abnormal time series, we noticed that the difference between VaR\({}^{anom}\) and VaR\({}^{tho}\) increased with \(n^{anom}\), which is natural to expect. However, when the time series were cleaned prior to the VaR estimations, the curves representing the VaR estimates were much closer to the ones representing VaR\({}^{tho}\) and VaR\({}^{clean}\), showing the undeniable improvement in the accuracy of the VaR estimations over the estimations based on abnormal time series. Furthermore, the VaR estimations after the imputation following the model prediction or knowing the true localization of the anomalies seemed to be quite similar for low \(n^{anom}\), whereas some discrepancies between the two became more significant as \(n^{anom}\) increased. A natural explanation could be that  
Figure 17: Box plot representation of the parametric VaR estimations for \(P\). The green squares represent the mean of the VaR estimations. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**VaR** & **VaR\({}^{clean}\)** & **VaR\({}^{loc,true}\)** & **VaR\({}^{loc,pred}\)** & **VaR\({}^{anom}\)** \\ \hline Absolute Error & 0.007995 & 0.008596 & 0.008622 & 0.02235 \\ Relative Error & 0.014620 & 0.015720 & 0.015767 & 0.04087 \\ \hline \hline \end{tabular}
\end{table} 
Table 19: Mean absolute and relative errors in VaR estimations for \(P\).