To determine p-values and or standard errors for estimates, we combine the estimation method for COGARCH in yuima with the bootstrap methodology. Here you can find an example of the code tha we used in our work “Discrete‐Time Approximation of a Cogarch(p,q) Model and its Estimation”.
library(yuima) Cog13<-setCogarch(p=1,q=3, measure=list(intensity="1", df=list("dnorm(z, 0, 1)")), measure.type = "CP",XinExpr = TRUE) par13 <- list(a0=6.77e-04,a1=1.93,b1=10.6 ,b2=35.54,b3=37.5, y01=1.903289e-05,y02=0,y03=0) check13 <- Diagnostic.Cogarch(Cog13, param = par13) sampCP <- setSampling(0, Terminal = 3200, n = 64000) set.seed(123) simCP13 <- simulate(object = Cog13, true.parameter = par13, sampling = sampCP, method = "euler") x11() plot(simCP13) system.time( res13 <- qmle(yuima = simCP13,start = par13, method="Nelder-Mead", grideq=TRUE, Est.Incr ="Incr") ) coef(res13) summary(res13) Diagnostic.Cogarch(res13) } library(doSNOW) library(foreach) numbCores <- 4 cl<-makeCluster(numbCores, type="SOCK") registerDoSNOW(cl) clusterSetupRNG(cl, seed = c(1,251,501,751)) estCoeff13 <- foreach(i=1:numbCores, .combine = rbind) %dopar%{ library(yuima) cog13 <- setCogarch(p = 1,q = 3, measure = list(intensity = "1", df = list("dnorm(z, 0, 1)")), measure.type = "CP", XinExpr=TRUE) par13 <- list(a0=6.77e-04,a1=1.93,b1= 10.6 ,b2=35.54,b3=37.5, y01=1.903289e-05,y02=0,y03=0) samp13 <- setSampling(0, 3200, n=64000) nRep <- 250 RESforCor <- matrix(NA,nRep,5) for(j in c(1:nRep)){ sim13 <-simulate(object = cog13, true.parameter = par13, sampling = samp13, method="euler") res13 <- NULL res13 <- tryCatch(qmle(yuima = sim13, start = par13, grideq=TRUE, method = "SANN", control=list(maxit=15000)), error = function(par13){NULL}) if(is.null(res13)){ RESforCor[j,] <- matrix(NaN, 1, 5) }else{ namecoef <- c("a0", "a1", "b1", "b2", "b3") cond <- sum((coef(res13)[namecoef]- unlist(par13)[namecoef])^2)==0 if(cond){ res13a <- tryCatch(qmle(yuima = sim13, start = par13, grideq=TRUE, method = "Nelder-Mead"), error = function(par13){NULL}) res13<-res13a } RESforCor[j,] <- coef(res13)[c("a0", "a1", "b1", "b2", "b3")] } } RESforCor } stopCluster(cl) colnames(estCoeff13) <- c("a0 = 6.77e-04", "a1 = 1.93", "b1 = 10.6", "b2 = 35.54", "b3 = 37.5") write.csv(x=estCoeff13,file = "cog13_CPSANNACC.csv") colMeans(estCoeff13) View(estCoeff13) sd(estCoeff13[,1]) sd(estCoeff13[,3]) sd(estCoeff13[,4]) sd(estCoeff13[,5]) sd(estCoeff13[,6]) write.csv(x = estCoeff13, file = "COG13_CP.csv")
You may also like
YSS2019: Computational and Statistical Methods for Stochastic Process
The first YUIMA Summer School on Computational and Statistical Methods for Stochastic Process This 4 days course aims at introducing researchers, PhD students and practitioners to several aspects of numerical and statistical analysis of time series…
Simulation and Inference for Stochastic Processes with YUIMA
Contains both theory and code with step-by-step examples and figures. Uses YUIMA package to implement the latest techniques available in the literature of inference for stochastic processes. Shows how to create the description of very abstract models in…
The YUIMA Project: A Computational Framework for Simulation and Inference of Stochastic Differential Equations
Abstract. The YUIMA Project is an open source and collaborative effort aimed at developing the R package yuima for simulation and inference of stochastic differential equations. In the yuima package stochastic differential equations can be of very…
On CARMA estimation in YUIMA
Q: Can YUIMA manage with statistical inference the following model? # yuima.model object model <- setModel(drift = c("-3*x1","x1*x2"), diffusion = matrix(c("1","0"),2,1), state.variable = c("x1","x2"),…
Lévy CARMA models for shocks in mortality
Abstract. Recent literature on mortality modeling suggests to include in the dynamics of mortality rates the effects of time, age, the interaction of these two and a term for possible shocks. In this paper we investigate models that use Legendre…