[Yuima-commits] r758 - pkg/yuima/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 28 21:51:15 CEST 2021


Author: lorenzo
Date: 2021-09-28 21:51:15 +0200 (Tue, 28 Sep 2021)
New Revision: 758

Modified:
   pkg/yuima/R/qmleLevy.R
Log:
Bug Fixed

Modified: pkg/yuima/R/qmleLevy.R
===================================================================
--- pkg/yuima/R/qmleLevy.R	2021-09-24 10:58:35 UTC (rev 757)
+++ pkg/yuima/R/qmleLevy.R	2021-09-28 19:51:15 UTC (rev 758)
@@ -9,8 +9,10 @@
 qmleLevy<-function(yuima,start,lower,upper,joint = FALSE,third = FALSE,
                    Est.Incr = "NoIncr",
                    aggregation = TRUE)
-{
-  if(!(Est.Incr %in% c("NoIncr","Incr","IncrPar")))
+{
+  myjumpname <- yuima at model@jump.variable
+  mymeasureparam <- yuima at model@parameter at measure
+  if(!(Est.Incr %in% c("NoIncr","Incr","IncrPar")))
   	stop("Argument'Est.Incr' must be one of \"NoIncr\",\"Incr\" or \"IncrPar\"")
   call <- match.call()
   truestart<-start
@@ -365,7 +367,7 @@
     #parameter<-yuima at model@parameter at all
     
     
-    resi<-double(s.size-1) 
+    #resi<-double(s.size-1) 
     assign(modeltime,yuima at sampling@delta,envir=tmp.env)
     h<-yuima at sampling@delta
     assign(modelstate,pX,envir=tmp.env)
@@ -377,10 +379,13 @@
     if(length(drif.term)==1){
       drif.term <- rep(drif.term, s.size)
     } # vectorization (note. if an expression type object does not include state.variable, the length of the item after "eval" operation is 1.)
-    for(s in 1:(s.size-1)){
-      nova<-sqrt((jump.term)^2) # normalized variance
-      resi[s]<-(1/(nova[s]))*(inc[s]-h*drif.term[s])
-    }
+    
+    # for(s in 1:(s.size-1)){
+    #   nova<-sqrt((jump.term)^2) # normalized variance
+    #   resi[s]<-(1/(nova[s]))*(inc[s]-h*drif.term[s])
+    # }
+    nova<-sqrt((jump.term)^2)
+    resi<-(1/(nova[1:(s.size-1)]))*(inc[1:(s.size-1)]-h*drif.term[1:(s.size-1)])
     if(aggregation){
       Ter <- yuima at sampling@Terminal
       ures <- numeric(floor(Ter))
@@ -491,7 +496,7 @@
       colnames(res.incr)<-paste0(sdeModel at jump.variable,c(1:dim(res.incr)[2]))
     }
     Incr.Lev <- zooreg(data=res.incr)
-    Incr.Lev<- setData(original.data = Incr.Lev,)
+    Incr.Lev<- setData(original.data = Incr.Lev)
   }else{
     Incr.Lev <- zoo(res.incr,order.by=yuima at sampling@grid[[1]][-1])
     Incr.Lev <- setData(original.data=Incr.Lev)
@@ -552,8 +557,8 @@
       if(length(startjump) == 1){
         logdens <- function(para){
           exlogdens <- parse(text = sprintf("log(d%s)", dist))
-          assign(yuima at model@jump.variable, ures, envir = tmp.env)
-          assign(yuima at model@parameter at measure, para, envir = tmp.env)
+          assign(myjumpname, ures, envir = tmp.env)
+          assign(mymeasureparam, para, envir = tmp.env)
           sum(eval(exlogdens, envir = tmp.env))
         }
         intervaljump <- c(lowerjump[[1]], upperjump[[1]])



More information about the Yuima-commits mailing list