[R-SIG-Finance] Error check on "pspd" function from SPD package

Gareth McEwan mcewan.gareth at gmail.com
Wed Oct 14 09:20:58 CEST 2015


Hi all

I used the "pspd" function from the SPD package last year and I'm running
the code again, but it seems to throw an error now.

I checked with data from the "rugarch" package and the error is still
thrown.

data(sp500ret)   # in the "rugarch" package
sp = sp500ret
class(sp)   # is a "data.frame" class
sp=as.ts(sp)  #  I tried with and without this step

# standard GARCH model:
spec = ugarchspec(variance.model=list(model="sGARCH",garchOrder=c(1,1),
            submodel=NULL,external.regressors=NULL,variance.targeting=F),

mean.model=list(armaOrder=c(0,0),include.mean=T,external.regressors=NULL),
            distribution.model="std")
tempgarch = ugarchfit(spec=spec,data=sp,solver="hybrid")

# fitting the SPD:
(1)
std.resid.sp = residuals(tempgarch,standardize=T)
class(std.resid.sp) #  "xts"  "zoo"

(2)
stdResid.sp = as.ts(std.resid.sp)  #  NOTE: I tried (1) with and (2)
without this step
class(stdResid.sp)  #  "ts"

# the problem:
(1)
fit.sp = spdfit(std.resid.sp, upper=0.9, lower=0.1, tailfit="GPD",
type="mle", kernelfit="normal",
            information="observed", title=NULL, description=NULL)
sp.unif.variates = pspd(std.resid.sp, fit.sp, linear=T)

Error in UseMethod("pspd") :
  no applicable method for 'pspd' applied to an object of class "c('xts',
'zoo')"

(2)
fit.sp = spdfit(stdResid.sp, upper=0.9, lower=0.1, tailfit="GPD",
type="mle", kernelfit="normal",
            information="observed", title=NULL, description=NULL)
sp.unif.variates = pspd(stdResid.sp, fit.sp, linear=T)

Error in UseMethod("pspd") :
  no applicable method for 'pspd' applied to an object of class "ts"

>From sessionInfo(), I have SPD package version as: spd_2.0-1 (i.e., it
seems to be up to date).

I don't think Can anyone help out with a solution?

Many thanks
Gareth


Additional:
packageDescription("spd")
Package: spd
Type: Package
Title: Semi Parametric Distribution
Version: 2.0-1
Date: 2015-07-02
...

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list