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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 20 06:30:16 CET 2017


Author: lorenzo
Date: 2017-01-20 06:30:15 +0100 (Fri, 20 Jan 2017)
New Revision: 570

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/R/AuxMethodforPPR.R
   pkg/yuima/R/simulateForPpr.R
Log:
Fixed bug in simulation PPR

Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2017-01-17 09:37:44 UTC (rev 569)
+++ pkg/yuima/DESCRIPTION	2017-01-20 05:30:15 UTC (rev 570)
@@ -1,7 +1,7 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project Package for SDEs
-Version: 1.4.7
+Version: 1.4.8
 Depends: R(>= 2.10.0), methods, zoo, stats4, utils, expm, cubature, mvtnorm
 Imports: Rcpp (>= 0.12.1)
 Author: YUIMA Project Team

Modified: pkg/yuima/R/AuxMethodforPPR.R
===================================================================
--- pkg/yuima/R/AuxMethodforPPR.R	2017-01-17 09:37:44 UTC (rev 569)
+++ pkg/yuima/R/AuxMethodforPPR.R	2017-01-20 05:30:15 UTC (rev 570)
@@ -249,7 +249,9 @@
   }
   dn <- dim(lambda)
   if(dn[1]==1){
-    logLiklihood2 <- -sum(lambda*diff(time)[1])
+    #logLiklihood2 <- -sum(lambda*diff(time)[1])
+    logLiklihood2 <- -1/2*sum((lambda[1:(length(lambda)-1)]+lambda[2:(length(lambda))])*diff(time)[1])
+
     logLiklihood1 <- sum(log(lambda)*lastEnv$CountVar)
 
     # logLiklihood2 <- -sum(lambda*diff(time))

Modified: pkg/yuima/R/simulateForPpr.R
===================================================================
--- pkg/yuima/R/simulateForPpr.R	2017-01-17 09:37:44 UTC (rev 569)
+++ pkg/yuima/R/simulateForPpr.R	2017-01-20 05:30:15 UTC (rev 570)
@@ -267,79 +267,211 @@
             envir = my.env)
         }
 
+        compErrHazR2 <- function(simMod, Kern,
+                                 capitalTime, Model, my.env, ExprHaz,
+                                 Time, dN){
+          #  dummyLambda <- numeric(length=(samp at n+1))
+          if(length(Kern at variable.Integral@var.dx)==1){
+            #   MyPos <- sum(samp at grid[[1]]<=tail(Time,n=1L))
+            assign(Kern at variable.Integral@var.time, Time, envir = my.env)
+            #  cond <- -log(cost)-sum(dummyLambda)*samp at delta
 
+            assign(Model at time.variable, capitalTime, envir = my.env)
+            assign(paste0("d",Kern at variable.Integral@var.dx), dN, envir =my.env)
+            Lambda <- eval(ExprHaz[[1]], envir=my.env)
+            return(Lambda)
+          }else{
+            return(NULL)
+          }
+        }
 
         IntensityProc <- 0
 
-        cost <- runif(1)
-        while(-log(cost)<samp at delta)
-          {cost <- runif(1)}
+        dN<-0
 
-        posLeft <- 1
-        posRight <- samp at n+1
+        myhawkesP <- function(simMod, Kern,
+                              samp, Model, my.env, ExprHaz,
+                              Time){
+          noExit<-TRUE
+          const <- -log(runif(1))
+          delta <- samp at delta
+          grid <- samp at grid[[1]]
+          while(const<delta){
+            const <- -log(runif(1))
+          }
+          jumpT<-0
+          i <- 1
+          dimGrid <-length(grid)
+          cond <- const
+          allconst <- NULL
+          allcond <- NULL
+          allhaz <- NULL
+          while(noExit){
+            HazardRate<-0
+            while(cond>0 && noExit){
+              #lastJump <- tail(jumpT,n=1L)
+              lambda<-compErrHazR2(simMod, Kern, capitalTime=samp at grid[[1]][i], Model, my.env, ExprHaz,
+                                   Time=jumpT, dN)
+              # lambda<-hawkesInt(mu=mu, alpha=alpha, beta=beta,
+              #                   timet=grid[i], JumpT=jumpT)
+              incrlambda <- lambda*delta
+              HazardRate <- HazardRate+incrlambda
+              cond <- const-HazardRate
+              i<-i+1
+              if(i>=dimGrid){
+                noExit <- FALSE
+              }
 
-        posMid <- floor((posLeft+posRight)/2)
-        solveLeft <- -log(cost)
-        solveRight <- NULL
-
-        exit <- FALSE
-        prova <- NULL
-
-        globEx <- FALSE
-
-        while(tail(Time,n=1L)<(samp at Terminal-samp@delta) && !globEx){
-          while(!exit){
-            if((posMid-posLeft)==1){
-              posMid
+              cat("\n ", cond>0, i, grid[i])
             }
-            oldprova <- prova
-            prova <- SolvePpr(posMid, posLeft, posRight, solveLeft, solveRight,
-                              cost, Kern, simMod, samp, Model, ExprHaz,
-                               my.env, Time, IntensityProc)
-            if(length(prova$left)==0){
-              globEx <- TRUE
-            }else{
-            if(prova$left){
-              posMid <- floor((prova$posLeft+prova$posRight)/2)
-              posLeft <- prova$posLeft
-              posRight <- prova$posRight
-              solveRight <- prova$solveRight
-              solveLeft <- prova$solveLeft
-            }else{
-              posMid <- floor((prova$posLeft+prova$posRight)/2)
-              posLeft <- prova$posLeft
-              posRight <- prova$posRight
-              solveRight <- prova$solveRight
-              solveLeft <- prova$solveLeft
+            jumpT<-c(jumpT,grid[i])
+            dN<-c(dN,1)
+            allhaz <- c(allhaz,HazardRate)
+            allcond <- c(allcond,cond)
+            cond <- const
+            allconst <- c(allconst, const)
+            const <- -log(runif(1))
+            while(const<delta){
+              const <- -log(runif(1))
             }
-             exit<-prova$exit
           }
-              if(globEx){
-                exit <- TRUE
-                oldprova -> prova
-              }
+          return(list(jumpT=jumpT,allcond=allcond,allconst=allconst, allhaz=allhaz))
+        }
 
+        prova1<-myhawkesP(simMod, Kern,
+                          samp, Model, my.env, ExprHaz,
+                          Time)
 
-          }
-
-          cost <- runif(1)
-          while(-log(cost)<samp at delta)
-          {cost <- runif(1)}
-          exit<- FALSE
-          posRight <- samp at n+1
-          solveLeft <- -log(cost)
-           posMid <- floor((posLeft+posRight)/2)
-          # if(length(prova$VeryExit)!=0){
-          #   if(prova$VeryExit)
-          #     globEx <- TRUE
-          # }
-          if(!globEx)
-            Time <- prova$Time
-          IntensityProc <- prova$IntensityProc
-          #cat(tail(prova$Time,n=1L))
-          #cat(sprintf("\n%.5f ", posMid))
-          cat(sprintf("\n%.5f ", tail(Time,n=1L)))
-      }
+        Time<-prova1$jumpT
+      #  return(Time)
+      #   cost <- runif(1)
+      #   while(-log(cost)<samp at delta)
+      #   {cost <- runif(1)}
+      #
+      #   compErrHazR <- function(simMod, Kern,
+      #                           samp, Model, my.env, ExprHaz,
+      #                           cost, Time, dN, intensityProc){
+      #     dummyLambda <- numeric(length=(samp at n+1))
+      #     if(length(Kern at variable.Integral@var.dx)==1){
+      #       MyPos <- sum(samp at grid[[1]]<=tail(Time,n=1L))
+      #       assign(Kern at variable.Integral@var.time, Time, envir = my.env)
+      #       i<- MyPos-1
+      #       cond <- -log(cost)-sum(dummyLambda)*samp at delta
+      #       while(cond>0 && i<=(samp at n) ){
+      #         i<-i+1
+      #         LastTime <- samp at grid[[1]][-1][i]
+      #         assign(Model at time.variable, LastTime, envir = my.env)
+      #         assign(paste0("d",Kern at variable.Integral@var.dx), dN, envir =my.env)
+      #         dummyLambda[i] <- eval(ExprHaz[[1]], envir=my.env)
+      #         cond <- -log(cost)-sum(dummyLambda)*samp at delta
+      #
+      #       }
+      #
+      #       if(i<=samp at n){
+      #         NoExit<-TRUE
+      #         Time <- c(Time,LastTime)
+      #         dummydN <-  simMod at data@original.data[i+1,Kern at variable.Integral@var.dx]-simMod at data@original.data[i,Kern at variable.Integral@var.dx]
+      #         dN <- c(dN,as.numeric(dummydN))
+      #         intensityProc<-c(intensityProc,dummyLambda[MyPos:i])
+      #       }else{
+      #         NoExit<-FALSE
+      #       }
+      #       cat(sprintf("\n%.5f ", tail(Time,n=1L)))
+      #       res <- list(Time = Time, dN = dN,
+      #                   intensityProc = intensityProc, NoExit=NoExit)
+      #       return(res)
+      #     }else{
+      #       return(NULL)
+      #     }
+      #   }
+      #
+      #   NoExit<-TRUE
+      #   dN<-0
+      #   intensityProc <- NULL
+      #
+      #   while(NoExit){
+      #     ParRes <- compErrHazR(simMod, Kern,
+      #                           samp, Model, my.env, ExprHaz,
+      #                           cost, Time, dN, intensityProc)
+      #     Time <- ParRes$Time
+      #     dN <- ParRes$dN
+      #     intensityProc <- ParRes$intensityProc
+      #     NoExit <- ParRes$NoExit
+      #     cost <- runif(1)
+      #     while(-log(cost)<samp at delta)
+      #     {cost <- runif(1)}
+      #     # plot(y=intensityProc,x=samp at grid[[1]][-1][samp at grid[[1]][-1]<=tail(Time,n=1L)],type="l")
+      #     # Time
+      #     # NoExit
+      #
+      #   }
+      # {
+      # #   posLeft <- 1
+      # #   posRight <- samp at n+1
+      # #
+      # #   posMid <- floor((posLeft+posRight)/2)
+      # #   solveLeft <- -log(cost)
+      # #   solveRight <- NULL
+      # #
+      # #   exit <- FALSE
+      # #   prova <- NULL
+      # #
+      # #   globEx <- FALSE
+      # #
+      # #   while(tail(Time,n=1L)<(samp at Terminal-samp@delta) && !globEx){
+      # #     while(!exit){
+      # #       if((posMid-posLeft)==1){
+      # #         posMid
+      # #       }
+      # #       oldprova <- prova
+      # #       prova <- SolvePpr(posMid, posLeft, posRight, solveLeft, solveRight,
+      # #                         cost, Kern, simMod, samp, Model, ExprHaz,
+      # #                          my.env, Time, IntensityProc)
+      # #       if(length(prova$left)==0){
+      # #         globEx <- TRUE
+      # #       }else{
+      # #       if(prova$left){
+      # #         posMid <- floor((prova$posLeft+prova$posRight)/2)
+      # #         posLeft <- prova$posLeft
+      # #         posRight <- prova$posRight
+      # #         solveRight <- prova$solveRight
+      # #         solveLeft <- prova$solveLeft
+      # #       }else{
+      # #         posMid <- floor((prova$posLeft+prova$posRight)/2)
+      # #         posLeft <- prova$posLeft
+      # #         posRight <- prova$posRight
+      # #         solveRight <- prova$solveRight
+      # #         solveLeft <- prova$solveLeft
+      # #       }
+      # #        exit<-prova$exit
+      # #     }
+      # #         if(globEx){
+      # #           exit <- TRUE
+      # #           oldprova -> prova
+      # #         }
+      # #
+      # #
+      # #     }
+      # #
+      # #     cost <- runif(1)
+      # #     while(-log(cost)<samp at delta)
+      # #     {cost <- runif(1)}
+      # #     exit<- FALSE
+      # #     posRight <- samp at n+1
+      # #     solveLeft <- -log(cost)
+      # #      posMid <- floor((posLeft+posRight)/2)
+      # #     # if(length(prova$VeryExit)!=0){
+      # #     #   if(prova$VeryExit)
+      # #     #     globEx <- TRUE
+      # #     # }
+      # #     if(!globEx)
+      # #       Time <- prova$Time
+      # #     IntensityProc <- prova$IntensityProc
+      # #     #cat(tail(prova$Time,n=1L))
+      # #     #cat(sprintf("\n%.5f ", posMid))
+      # #     cat(sprintf("\n%.5f ", tail(Time,n=1L)))
+      # # }
+      # }
         cond <- samp at grid[[1]][-1] %in% Time[-1]
         countVar <- Model at solve.variable %in%  object at Ppr@counting.var
         increment.L[!cond, countVar]<-0
@@ -355,6 +487,8 @@
                              increment.L = t(increment.L))
         }
         object at data<-simModNew at data
+        object at sampling<-simModNew at sampling
+
         return(object)
 
       }else{
@@ -365,106 +499,106 @@
   return(NULL)
 }
 
-SolvePpr <- function(posMid, posLeft, posRight, solveLeft = NULL, solveRight = NULL,
-                     cost, Kern, simMod, samp, Model, ExprHaz,
-                      my.env, Time, IntensityProc){
+# SolvePpr <- function(posMid, posLeft, posRight, solveLeft = NULL, solveRight = NULL,
+#                      cost, Kern, simMod, samp, Model, ExprHaz,
+#                       my.env, Time, IntensityProc){
+#
+#   if((posMid+1)>=(samp at n+1)){
+#     mylist <- list(VeryExit = TRUE)
+#     return(mylist)
+#   }
+#   if((posMid+1)>=(samp at n+1)){
+#     mylist <- list(VeryExit = TRUE)
+#     return(mylist)
+#   }
+#
+#
+#    solveMid<- compErrHazR(posMid, simMod, Kern, samp, Model, my.env, ExprHaz, cost, Time)
+#    if(solveMid$solveLambda <= 0){
+#      # first check
+#      if(solveMid$solveLambda<0 ){
+#        if(posLeft == (posMid-1)){
+#          if(solveLeft*solveMid$solveLambda<0){
+#             mylist <- list()
+#             mylist$exit <- TRUE
+#             mylist$left <- TRUE
+#             mylist$posLeft <- posMid
+#             mylist$posRight <- samp at n+1
+#             mylist$solveLeft <- solveMid$solveLambda
+#             mylist$solveRight <- NULL
+#             mylist$Time <- c(Time,samp at grid[[1]][-1][posMid])
+#             mylist$IntensityProc <- c(IntensityProc, solveMid$dummyLambda)
+#
+#            return(mylist)
+#          }
+#        }
+#      solveMidLeft <- compErrHazR(posMid-1, simMod, Kern, samp, Model, my.env, ExprHaz, cost, Time)
+#       if(solveMidLeft$solveLambda >=0){
+#         mylist <- list()
+#         mylist$exit <- TRUE
+#         mylist$left <- TRUE
+#         mylist$posLeft <- posMid-1
+#         mylist$posRight <- samp at n+1
+#         mylist$solveLeft <- solveMidLeft$solveLambda
+#         mylist$solveRight <- NULL
+#         mylist$Time <- c(Time,samp at grid[[1]][-1][posMid-1])
+#         mylist$IntensityProc <- c(IntensityProc, solveMidLeft$dummyLambda)
+#         return(mylist)
+#       }else{
+#         mylist <- list()
+#         mylist$exit <- FALSE
+#         mylist$left <- TRUE
+#         mylist$posLeft <- posLeft
+#         mylist$posRight <- posMid
+#         mylist$solveLeft <- solveLeft
+#         mylist$solveRight <-solveMidLeft$solveLambda
+#         mylist$Time <- Time
+#         mylist$IntensityProc <- c(IntensityProc)
+#         return(mylist)
+#       }
+#      }
+#    }
+#      if(solveMid$solveLambda==0){
+#        mylist <- list()
+#        mylist$exit <- TRUE
+#        mylist$left <- FALSE
+#        mylist$posLeft <-posMid
+#        mylist$posRight <- samp at n+1
+#        mylist$solveLeft <- solveMid$solveLambda
+#        mylist$solveRight <- solveRight
+#        mylist$Time <- c(Time,samp at grid[[1]][-1][posMid-1])
+#        mylist$IntensityProc <- c(IntensityProc, solveMid$dummyLambda)
+#        return(mylist)
+#      }
+#      if(solveMid$solveLambda > 0 && (posMid+1) <(samp at n+1)){
+#        solveMidRight <- compErrHazR(posMid+1, simMod, Kern, samp, Model, my.env, ExprHaz, cost, Time)
+#        if(solveMidRight$solveLambda <=0){
+#          mylist <- list()
+#          mylist$exit <- TRUE
+#          mylist$left <- FALSE
+#          mylist$posLeft <- posMid+1
+#          mylist$posRight <- samp at n+1
+#          mylist$solveLeft <-  solveMidRight$solveLambda
+#          mylist$solveRight <- solveRight
+#          mylist$Time <- c(Time,samp at grid[[1]][-1][posMid+1])
+#          mylist$IntensityProc <- c(IntensityProc, solveMidRight$dummyLambda)
+#          return(mylist)
+#        }else{
+#          mylist <- list()
+#          mylist$exit <- FALSE
+#          mylist$left <- FALSE
+#          mylist$posLeft <- posMid+1
+#          mylist$posRight <- posRight
+#          mylist$solveLeft <- solveMidRight$solveLambda
+#          mylist$solveRight <-solveRight
+#          mylist$Time <- Time
+#          mylist$IntensityProc <- c(IntensityProc)
+#          return(mylist)
+#        }
+#       }
+# }
 
-  if((posMid+1)>=(samp at n+1)){
-    mylist <- list(VeryExit = TRUE)
-    return(mylist)
-  }
-  if((posMid+1)>=(samp at n+1)){
-    mylist <- list(VeryExit = TRUE)
-    return(mylist)
-  }
 
-
-   solveMid<- compErrHazR(posMid, simMod, Kern, samp, Model, my.env, ExprHaz, cost, Time)
-   if(solveMid$solveLambda <= 0){
-     # first check
-     if(solveMid$solveLambda<0 ){
-       if(posLeft == (posMid-1)){
-         if(solveLeft*solveMid$solveLambda<0){
-            mylist <- list()
-            mylist$exit <- TRUE
-            mylist$left <- TRUE
-            mylist$posLeft <- posMid
-            mylist$posRight <- samp at n+1
-            mylist$solveLeft <- solveMid$solveLambda
-            mylist$solveRight <- NULL
-            mylist$Time <- c(Time,samp at grid[[1]][-1][posMid])
-            mylist$IntensityProc <- c(IntensityProc, solveMid$dummyLambda)
-
-           return(mylist)
-         }
-       }
-     solveMidLeft <- compErrHazR(posMid-1, simMod, Kern, samp, Model, my.env, ExprHaz, cost, Time)
-      if(solveMidLeft$solveLambda >=0){
-        mylist <- list()
-        mylist$exit <- TRUE
-        mylist$left <- TRUE
-        mylist$posLeft <- posMid-1
-        mylist$posRight <- samp at n+1
-        mylist$solveLeft <- solveMidLeft$solveLambda
-        mylist$solveRight <- NULL
-        mylist$Time <- c(Time,samp at grid[[1]][-1][posMid-1])
-        mylist$IntensityProc <- c(IntensityProc, solveMidLeft$dummyLambda)
-        return(mylist)
-      }else{
-        mylist <- list()
-        mylist$exit <- FALSE
-        mylist$left <- TRUE
-        mylist$posLeft <- posLeft
-        mylist$posRight <- posMid
-        mylist$solveLeft <- solveLeft
-        mylist$solveRight <-solveMidLeft$solveLambda
-        mylist$Time <- Time
-        mylist$IntensityProc <- c(IntensityProc)
-        return(mylist)
-      }
-     }
-   }
-     if(solveMid$solveLambda==0){
-       mylist <- list()
-       mylist$exit <- TRUE
-       mylist$left <- FALSE
-       mylist$posLeft <-posMid
-       mylist$posRight <- samp at n+1
-       mylist$solveLeft <- solveMid$solveLambda
-       mylist$solveRight <- solveRight
-       mylist$Time <- c(Time,samp at grid[[1]][-1][posMid-1])
-       mylist$IntensityProc <- c(IntensityProc, solveMid$dummyLambda)
-       return(mylist)
-     }
-     if(solveMid$solveLambda > 0 && (posMid+1) <(samp at n+1)){
-       solveMidRight <- compErrHazR(posMid+1, simMod, Kern, samp, Model, my.env, ExprHaz, cost, Time)
-       if(solveMidRight$solveLambda <=0){
-         mylist <- list()
-         mylist$exit <- TRUE
-         mylist$left <- FALSE
-         mylist$posLeft <- posMid+1
-         mylist$posRight <- samp at n+1
-         mylist$solveLeft <-  solveMidRight$solveLambda
-         mylist$solveRight <- solveRight
-         mylist$Time <- c(Time,samp at grid[[1]][-1][posMid+1])
-         mylist$IntensityProc <- c(IntensityProc, solveMidRight$dummyLambda)
-         return(mylist)
-       }else{
-         mylist <- list()
-         mylist$exit <- FALSE
-         mylist$left <- FALSE
-         mylist$posLeft <- posMid+1
-         mylist$posRight <- posRight
-         mylist$solveLeft <- solveMidRight$solveLambda
-         mylist$solveRight <-solveRight
-         mylist$Time <- Time
-         mylist$IntensityProc <- c(IntensityProc)
-         return(mylist)
-       }
-      }
-}
-
-
 # SolvePpr <- function(TopposInGridIn, OldTimePoint, solveLambdaInOld,
 #                      cost, Kern, simMod, samp, Model, ExprHaz, dN,
 #                      LastTime, my.env, Time, IntensityProc, checkside = FALSE,
@@ -695,41 +829,41 @@
 #   }
 # }
 
-compErrHazR <- function(TopposInGrid, simMod, Kern,
-                        samp, Model, my.env, ExprHaz,
-                        cost, Time){
-  dummyLambda <- numeric(length=(TopposInGrid))
-  if(length(Kern at variable.Integral@var.dx)==1){
-    dN <- rep(0, TopposInGrid)
+# compErrHazR <- function(TopposInGrid, simMod, Kern,
+#                         samp, Model, my.env, ExprHaz,
+#                         cost, Time){
+#   dummyLambda <- numeric(length=(TopposInGrid))
+#   if(length(Kern at variable.Integral@var.dx)==1){
+#     dN <- rep(0, TopposInGrid)
+#
+#     con <- (samp at grid[[1]] %in% c(Time[-1],samp at grid[[1]][TopposInGrid]))
+#     dN[con[c(1:length(dN))]] <- as.numeric(simMod at data@original.data[c(FALSE, con[-length(con)]),Kern at variable.Integral@var.dx]
+#                                                      -simMod at data@original.data[con,Kern at variable.Integral@var.dx])
+#   }else{}
+#   #for(i in c(1:TopposInGrid)){
+#   #MyPos
+#   MyPos <- sum(samp at grid[[1]]<=tail(Time,n=1L))
+#   #dummyLambda <- numeric(length=TopposInGrid)
+#   assign(Kern at variable.Integral@var.time, Time, envir = my.env)
+#   for(i in c(MyPos:TopposInGrid)){
+#     posInGrid <- i
+#     LastTime <- samp at grid[[1]][-1][(posInGrid)]
+#     #LastStime <- samp at grid[[1]][c(1:posInGrid)]
+#     assign(Model at time.variable, LastTime, envir = my.env)
+#     #assign(Kern at variable.Integral@var.time, LastStime, envir = my.env)
+#     #assign(paste0("d",Kern at variable.Integral@var.dx), dN[c(1:posInGrid)], envir =my.env)
+#     assign(paste0("d",Kern at variable.Integral@var.dx), 1, envir =my.env)
+#     dummyLambda[i] <- eval(ExprHaz[[1]], envir=my.env)
+#   }
+#  # solveLambda <- -log(cost)-sum(dummyLambda[c(sum(samp at grid[[1]]<=tail(Time,n=1L)):(TopposInGrid))])*samp at delta
+#   solveLambda <- -log(cost)-sum(dummyLambda[c(MyPos:(TopposInGrid))])*samp at delta
+#   res <- list(solveLambda = solveLambda, dummyLambda = tail(dummyLambda,n=1L))
+#   return(res)
+# }
 
-    con <- (samp at grid[[1]] %in% c(Time[-1],samp at grid[[1]][TopposInGrid]))
-    dN[con[c(1:length(dN))]] <- as.numeric(simMod at data@original.data[c(FALSE, con[-length(con)]),Kern at variable.Integral@var.dx]
-                                                     -simMod at data@original.data[con,Kern at variable.Integral@var.dx])
-  }else{}
-  #for(i in c(1:TopposInGrid)){
-  #MyPos
-  MyPos <- sum(samp at grid[[1]]<=tail(Time,n=1L))
-  #dummyLambda <- numeric(length=TopposInGrid)
-  assign(Kern at variable.Integral@var.time, Time, envir = my.env)
-  for(i in c(MyPos:TopposInGrid)){
-    posInGrid <- i
-    LastTime <- samp at grid[[1]][-1][(posInGrid)]
-    #LastStime <- samp at grid[[1]][c(1:posInGrid)]
-    assign(Model at time.variable, LastTime, envir = my.env)
-    #assign(Kern at variable.Integral@var.time, LastStime, envir = my.env)
-    #assign(paste0("d",Kern at variable.Integral@var.dx), dN[c(1:posInGrid)], envir =my.env)
-    assign(paste0("d",Kern at variable.Integral@var.dx), 1, envir =my.env)
-    dummyLambda[i] <- eval(ExprHaz[[1]], envir=my.env)
-  }
- # solveLambda <- -log(cost)-sum(dummyLambda[c(sum(samp at grid[[1]]<=tail(Time,n=1L)):(TopposInGrid))])*samp at delta
-  solveLambda <- -log(cost)-sum(dummyLambda[c(MyPos:(TopposInGrid))])*samp at delta
-  res <- list(solveLambda = solveLambda, dummyLambda = tail(dummyLambda,n=1L))
-  return(res)
-}
 
 
 
-
 aux.simulatPprROldVersion <- function(object, nsim = nsim, seed = seed,
                                       xinit = xinit, true.parameter = true.parameter,
                                       space.discretized = space.discretized, increment.W = increment.W,



More information about the Yuima-commits mailing list