Diagnosing GPD Quantile Warnings with Negative Shape Parameters
Summary
The document describes a problem in out-of-sample modeling of GARCH-filtered residuals using a semiparametric distribution with a generalized Pareto tail. When the GPD shape parameter is negative, the tail has a finite endpoint. The inverse CDF can therefore encounter an invalid logarithm if a simulated exceedance falls beyond that support boundary, producing a NaN warning.
The author checks a stored array of conditional means for NaN values and finds none, despite the warning. This mismatch motivates the question of whether the warning can be ignored. The document does not include the replies or establish the cause of the discrepancy, so its diagnostic is incomplete: checking downstream conditional means does not necessarily establish whether an intermediate inverse-CDF calculation produced invalid values, or whether those values were later transformed. The key lesson is to trace and inspect the tail quantile output and support condition at the point where the warning arises.
Key ideas
- A negative GPD shape parameter implies a finite endpoint for the modeled tail.
- The GPD quantile calculation becomes invalid when an exceedance falls beyond that endpoint.
- Warnings can arise in an intermediate calculation even if a later stored output contains no NaNs.
- Inspect the inverse-CDF results and support condition directly before deciding whether to disregard a warning.
Tags
Full text
# False warning messages in R, is it possible?
# False warning messages in R, is it possible?
I'm modeling GARCH-filtered standardized residuals via semiparametric distribution with Gaussian kernel and GPD (generalized pareto distribution) tails with thresholds at 5% and 95%. For some series I'm considering I have negative shape parameters $\xi$, which imply a finite left/right endpoint equal to $-\frac{\beta}{\xi}$.
Then, in the testing period (out-of-sample analysis) I use the quantile function to convert copula realizations into standardized residuals through the inverse CDF. I get the following warning:
> Warning messages: In log(1 + (xi * (as.vector(exceedances) - u))/beta) : Si è prodotto un NaN
NaNs are produced in the logarithm expression ($\xi$ shape parameter, $\beta$ scale parameter, $u$ threshold, $x$ value over the threshold). To check what that means, I solve $$1 + \xi \frac{(x-u)}{\beta}\leq0$$ when $\xi$ is negative $$x-u\geq-\frac{\beta}{\xi}$$ implying that somewhere in the future I have an excess over the threshold which exceeds the bound implied by negative $\xi$.
Since I manually verified that the message wasn't true (in the out-of-sample dataset I NEVER have standardized residuals which exceed the 5% and 95% thresholds by more than $-\frac{\beta}{\xi}$), I decided to verify this with R using this code:
```
p <- 0
for (i in 1:2){
for (j in 1:9){
for (z in 1:100){
if (is.nan(ronaldo[i,j,z])==TRUE) {p=1}
}
}
}
```
In ronaldo$[i,j,z]$ I've stored the results of the conditional means at day $i$ of asset $j$ obtained in simulation $z$ (obtained by: i. inverse of CDF of copula realizations; ii. insert in GARCH formula; iii. compute conditional mean). [yes, Ronaldo is my favorite player, and I mean the brazilian Fenomeno]. I should get $p=1$ if any value stored in ronaldo is NaN, right? Well, $p=0$.
Is this possible? Is it possible that R produces a message which isn't verified by the results? Already at a graphical inspection everything seemed alright (I only had numerical values stored in ronaldo), and that little trick with $p$ verifies this. Am I justified in "moving on" and ignoring the message since I don't have NaNs?Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.