Skip to content
Prev 13560 / 15274 Next

Error check on "pspd" function from SPD package

Once again, it's just a matter of reading the documentation.

1. rugarch "prefers" xts
2. spd "requires" numeric:
###########################
x,q    [pspd,dspd] -
a numeric vector of quantiles.
###########################

So I don't see any problem as the following works just fine:

library(rugarch)
library(spd)
library(xts)
data(sp500ret)   # in the "rugarch" package
sp = xts(sp500ret[,1], as.Date(rownames(sp500ret)))
# standard GARCH model:
spec =
ugarchspec(mean.model=list(armaOrder=c(0,0)),distribution.model="std")
tempgarch = ugarchfit(spec=spec,data=sp,solver="hybrid")
# fitting the SPD:
std.resid.sp = as.numeric(residuals(tempgarch,standardize=T))
fit.sp = spdfit(std.resid.sp, upper=0.9, lower=0.1, tailfit="GPD",
type="mle", kernelfit="information="observed")
sp.unif.variates = pspd(std.resid.sp, fit.sp, linear=T)


-A
On 14/10/2015 02:20, Gareth McEwan wrote: