[Yuima-commits] r720 - in pkg/yuima: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 6 22:53:04 CET 2020


Author: iacus
Date: 2020-02-06 22:53:03 +0100 (Thu, 06 Feb 2020)
New Revision: 720

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/NEWS
   pkg/yuima/R/simCP.R
Log:
fixing for cran and speed up code

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2020-02-05 16:24:46 UTC (rev 719)
+++ pkg/yuima/DESCRIPTION	2020-02-06 21:53:03 UTC (rev 720)
@@ -1,7 +1,7 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project Package for SDEs
-Version: 1.9.6
+Version: 1.9.7
 Depends: R(>= 2.10.0), methods, zoo, stats4, utils, expm, cubature,
         mvtnorm
 Imports: Rcpp (>= 0.12.1), boot (>= 1.3-2), glassoFast

Modified: pkg/yuima/NEWS
===================================================================
--- pkg/yuima/NEWS	2020-02-05 16:24:46 UTC (rev 719)
+++ pkg/yuima/NEWS	2020-02-06 21:53:03 UTC (rev 720)
@@ -62,4 +62,6 @@
            modified cce.R, hyavar.R, llag.R, sim.euler.R
 2019/4/8: modified adaBayes.R
 2019/7/19: added cce.factor.R, cce.factor.Rd
-           modified llag.test.Rd, bns.test.Rd, hyavar.R, mpv.Rd, mllag.Rd, llag.Rd, cce.Rd, spectralcov.R, JBtest.Rd, snr.Rd
\ No newline at end of file
+           modified llag.test.Rd, bns.test.Rd, hyavar.R, mpv.Rd, mllag.Rd, llag.Rd, cce.Rd, spectralcov.R, JBtest.Rd, snr.Rd
+2020/2/6: fixed length(class(matrix))>2 issue. Code for simPoi fastened.
+

Modified: pkg/yuima/R/simCP.R
===================================================================
--- pkg/yuima/R/simCP.R	2020-02-05 16:24:46 UTC (rev 719)
+++ pkg/yuima/R/simCP.R	2020-02-06 21:53:03 UTC (rev 720)
@@ -64,16 +64,28 @@
       
       ell <- optimize(f=.CPintensity, interval=c(Initial, Terminal), maximum = TRUE)$objective
       ellMax <- ell * 1.01
+      
 
-
       time <- Initial
       E <- Initial
       
-      while(time < Terminal) {
-          time <- time - 1/ellMax * log(runif(1))
-          if(runif(1) < .CPintensity(time)/ellMax)
-          E <- c(E, time)
-      }
+      # heuristic code to avoid loops
+      nLAMBDA <- ceiling(ellMax*(Terminal-Initial)*1.2)
+      ru1 <- runif(nLAMBDA)
+      ru2 <- runif(nLAMBDA)*ellMax
+      
+      tLAMBDA <- Initial+cumsum( -log(ru1)/ellMax )
+      idxLAMBDA <- which(tLAMBDA<=Terminal)
+      testLAMBDA <- ru2[idxLAMBDA]<.CPintensity(tLAMBDA[idxLAMBDA])
+      E <- c(Initial,tLAMBDA[testLAMBDA])
+      
+      
+      #   while(time < Terminal) {
+      #    ellMax <- ell(time)*1.01
+      #    time <- time - 1/ellMax * log(runif(1))
+      #    if(runif(1) < .CPintensity(time)/ellMax)
+      #    E <- c(E, time)
+      #}
       N_sharp <- length(E)-1
       
       F.env <- new.env(parent=env)



More information about the Yuima-commits mailing list