[R-SIG-Finance] VaRTest in rugarch package version 1.4.9 returns NaN

Ayla @y|@@@ug@t @end|ng |rom goog|em@||@com
Thu May 18 10:49:29 CEST 2023


Dear contributors, dear Alexios Galanos,

I'm using the rugarch package version 1.4.9 to backtest a calculated value
of risk vector against my log returns with the VaRTest function from the
package.

However, in some situations, the test returns NA. I found an example where
the test returns NA for the full vector of VaRs and log returns but when I
perform the test without the very last value in the vector, it returns an
output.
It does not help to put the data and the VaR explicitly to numeric
(`as.numeric()`).

Data for the example can be found here:
https://drive.google.com/file/d/1YAvWpDJT93PnVDrvHuMZoBmQ8BEnB2cu/view?usp=sharing
and here:
https://drive.google.com/file/d/1qPQXOqZL9lancBnW_q2aa_I75wd5loTM/view?usp=share_link

This is my code:

```
## load data
rm(list = ls())

require(rugarch)

# load the data
filename = "bugreport_var_test_var.csv"
var = read.csv(file = filename)
filename = "bugreport_var_test_log_reg.csv"
data = read.csv(file = filename)

# try the test with full data
VaRTest(
  alpha=0.05,
  actual=data[,1],
  VaR=var[,1]
)

# try the test without last data point
VaRTest(
  alpha=0.05,
  actual=data[1:(nrow(data)-1),1],
  VaR=var[1:(nrow(var)-1),1]
)
```

Thanks a lot in advance!
Best,
Ayla

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list