[Yuima-commits] r164 - in pkg/yuima: . man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jul 31 11:42:37 CEST 2011


Author: kamatani
Date: 2011-07-31 11:42:37 +0200 (Sun, 31 Jul 2011)
New Revision: 164

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/man/llag.Rd
Log:
Update llag example

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2011-07-30 14:47:21 UTC (rev 163)
+++ pkg/yuima/DESCRIPTION	2011-07-31 09:42:37 UTC (rev 164)
@@ -1,8 +1,8 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project package (unstable version)
-Version: 0.1.1923
-Date: 2011-07-30
+Version: 0.1.1924
+Date: 2011-07-31
 Depends: methods, zoo, stats4, utils
 Suggests: cubature, mvtnorm
 Author: YUIMA Project Team.

Modified: pkg/yuima/man/llag.Rd
===================================================================
--- pkg/yuima/man/llag.Rd	2011-07-30 14:47:21 UTC (rev 163)
+++ pkg/yuima/man/llag.Rd	2011-07-31 09:42:37 UTC (rev 164)
@@ -27,18 +27,19 @@
 \examples{
 
 
-# generate two sample paths
+## Set a model
+diff.coef.matrix <- matrix(c("sqrt(x1)", "sqrt(3/5)*sqrt(x2)", 
+"", "sqrt(4/5)*sqrt(x2)"), 2, 2) 
+drift <- c("-x1","2*(10-x2)")
+cor.mod <- setModel(drift = drift, diffusion = diff.coef.matrix,solve.variable = c("x1", "x2")) 
 
-  rho <- 0.4   # correlation coefficiant
+set.seed(111) 
 
-  diff.coef.matrix <- matrix(c(1,rho,rho,1),2,2) 
-  drift <- c("0*x1","0*x2")
-  cor.mod <- setModel(drift = drift, diffusion = diff.coef.matrix,solve.variable = c("x1", "x2")) 
+## We use a function poisson.random.sampling to get observation by Poisson sampling.
+yuima.samp <- setSampling(Terminal = 1, n = 1200) 
+yuima <- setYuima(model = cor.mod, sampling = yuima.samp) 
+yuima <- simulate(yuima,xinit=c(1,7)) 
 
-  yuima.samp <- setSampling(Terminal = 1, n = 300) 
-  yuima <- setYuima(model = cor.mod, sampling = yuima.samp) 
-  yuima <- simulate(yuima) 
-
 # intentionally displace the second time series
 
   data2 <- yuima at data@zoo.data[[2]]
@@ -49,23 +50,21 @@
   stime <- time + theta  
   time(yuima at data@zoo.data[[2]]) <- stime
 
-# estimate lead-lag
 
- lagcce <- function(theta){
-    stime <- time2 + theta  #shifted time
-    time(dat at zoo.data[[2]]) <- stime
-    return(cce(dat))
-  }
+#sampled data by Poisson rules
+psample<- poisson.random.sampling(yuima, rate = c(0.2,0.3), n = 1000) 
 
-# true value must be -theta=0.05
-ret <- llag(yuima,verbose=TRUE)
-print(ret$opt)
-print(ret$covmat)
-print(ret$cormat)
 
-plot(ret$mat,xlab="theta",ylab="U(theta)",type="l")
+# plot
+plot(psample)
 
 
+#cce
+cce(psample)
+
+#lead-lag estimation
+llag(psample)
+
 }
 \seealso{\link{cce}}
 \keyword{ts}



More information about the Yuima-commits mailing list