[Yuima-commits] r116 - pkg/yuima/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 21 05:16:35 CEST 2010


Author: hinohide
Date: 2010-07-21 05:16:35 +0200 (Wed, 21 Jul 2010)
New Revision: 116

Modified:
   pkg/yuima/man/cce.Rd
Log:
add an example of cce

Modified: pkg/yuima/man/cce.Rd
===================================================================
--- pkg/yuima/man/cce.Rd	2010-07-20 15:05:31 UTC (rev 115)
+++ pkg/yuima/man/cce.Rd	2010-07-21 03:16:35 UTC (rev 116)
@@ -65,6 +65,44 @@
 cat(sprintf("theta =\%.5f\n", theta))
 
 names(psample at zoo.data)
+
+
+
+
+
+
+# Example. A stochastic differential equation with nonlinear feedback. 
+
+## Set a model
+drift.coef.1 <- function(x1,x2) x2
+drift.coef.2 <- function(x1,x2) -x1
+drift.coef.vector <- c("drift.coef.1","drift.coef.2")
+diff.coef.1 <- function(t,x1,x2) sqrt(abs(x1))*sqrt(1+t)
+diff.coef.2 <- function(t,x1,x2) sqrt(abs(x2))
+cor.rho <- function(t,x1,x2) 1/(1+x1^2)
+diff.coef.matrix <- matrix(c("diff.coef.1(t,x1,x2)", "diff.coef.2(t,x1,x2) * cor.rho(t,x1,x2)","", "diff.coef.2(t,x1,x2) * sqrt(1-cor.rho(t,x1,x2)^2)"), 2, 2) 
+cor.mod <- setModel(drift = drift.coef.vector, diffusion = diff.coef.matrix,solve.variable = c("x1", "x2"))
+
+## Generate a path of the process
+set.seed(111) 
+yuima.samp <- setSampling(Terminal = 1, n = 10000) 
+yuima <- setYuima(model = cor.mod, sampling = yuima.samp) 
+yuima <- simulate(yuima, xinit=c(2,3)) 
+plot(yuima)
+
+
+## The "true" value of the quadratic covariation.
+cce(yuima)
+
+## We use the function poisson.random.sampling to generate nonsynchronous observations by Poisson sampling.
+psample<- poisson.random.sampling(yuima, rate = c(0.2,0.3), n = 3000) 
+
+## cce takes the psample to return an estimated value  of the quadratic covariation. The off-diagonal elements are the value of the Hayashi-Yoshida estimator. 
+cce(psample)
+
+
+
+
 }
 \seealso{\link{setModel}}
 \keyword{ts}



More information about the Yuima-commits mailing list