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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 27 17:44:41 CET 2021


Author: lorenzo
Date: 2021-12-27 17:44:40 +0100 (Mon, 27 Dec 2021)
New Revision: 776

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

Modified: pkg/yuima/R/qmleLevy.R
===================================================================
--- pkg/yuima/R/qmleLevy.R	2021-12-27 12:19:30 UTC (rev 775)
+++ pkg/yuima/R/qmleLevy.R	2021-12-27 16:44:40 UTC (rev 776)
@@ -590,7 +590,7 @@
       minusloglik <- function(para){
         para[length(para)+1]<-1
         names(para)[length(para)]<-yuima at model@time.variable
-        -sum(dens(mylaw, res.incr, param = para, log = T), 
+        -sum(dens(object=mylaw, x=res.incr, param = para, log = TRUE), 
            na.rm = T)
         }
       }else{
@@ -597,7 +597,7 @@
         minusloglik <- function(para){
           para[length(para)+1] <- yuima at sampling@delta
           names(para)[length(para)]<-yuima at model@time.variable
-          -sum(dens(mylaw, res.incr, param = para, log = T), 
+          -sum(dens(object=mylaw, x=res.incr, param = para, log = TRUE), 
                na.rm = T)
         }
       }
@@ -620,9 +620,9 @@
       }
       mypar<-res at coef[oldyuima at model@parameter at measure]
       mypar[oldyuima at model@measure$df at time.var]<-1
-      fdataeta<-dens(oldyuima at model@measure$df,x=ures,mypar)# f(eps, eta)
+      fdataeta<-dens(object=oldyuima at model@measure$df,x=ures,param=mypar)# f(eps, eta)
       del <- 10^-3
-      fdatadeltaeta<- dens(oldyuima at model@measure$df,x=ures+del,mypar) # f(eps + delta, eta)
+      fdatadeltaeta<- dens(object=oldyuima at model@measure$df,x=ures+del,param=mypar) # f(eps + delta, eta)
       dummy <- t(rep(1,length(mypar[oldyuima at model@measure$df at param.measure])))
       myeta<- as.matrix(mypar[oldyuima at model@measure$df at param.measure])%*%dummy
       myetapert <- myeta+del*diag(rep(1,dim(myeta)[1])) 
@@ -629,13 +629,13 @@
       fdataetadelta<-sapply(X=1:dim(myeta)[1],FUN = function(X){
         par<-myetapert[,X]
         par[oldyuima at model@measure$df at time.var]<-1
-        dens(oldyuima at model@measure$df,x=ures,par)
+        dens(object=oldyuima at model@measure$df,x=ures,param=par)
       }
       )# f(eps, eta+delta)
       fdatadeltaetadelta<-sapply(X=1:dim(myeta)[1],FUN = function(X){
         par<-myetapert[,X]
         par[oldyuima at model@measure$df at time.var]<-1
-        dens(oldyuima at model@measure$df,x=ures+del,par)
+        dens(object=oldyuima at model@measure$df,x=ures+del,param=par)
       }
       ) # f(eps +deta, eta+delta) 
       term1<-1/(fdataeta)
@@ -690,6 +690,7 @@
       res at vcov <-InvIn%*%MatSigmaHat1%*%t(InvIn)/Ter
     }else{
       res at vcov<-cbind(res at vcov,matrix(NA,ncol=length(esti$par),nrow=dim(res at vcov)[1]))
+      res at vcov<-rbind(res at vcov,matrix(NA,nrow=length(esti$par),ncol=dim(res at vcov)[2]))
     }
     colnames(res at vcov)<-names(res at fullcoef)
     #res at vcov<-rbind(res at vcov,matrix(NA,nrow=length(esti$par),ncol=dim(res at vcov)[2]))
@@ -716,7 +717,7 @@
           assign(mymeasureparam, para, envir = tmp.env)
           sum(eval(exlogdens, envir = tmp.env))
         }
-        dens <-function(para){
+        mydens <-function(para){
           exdens <- parse(text = sprintf("d%s", dist))
           assign(myjumpname, ures, envir = tmp.env)
           assign(mymeasureparam, para, envir = tmp.env)
@@ -736,7 +737,7 @@
           -sum(eval(exlogdens, envir = tmp.env),na.rm = T)
         }
         
-        dens <-function(par,x){
+        mydens1 <-function(par,x){
           exdens <- parse(text = sprintf("d%s", dist))
           assign(myjumpname, x, envir = tmp.env)
           assign(mymeasureparam, par, envir = tmp.env)
@@ -759,9 +760,9 @@
           }
           mypar<-res at coef[oldyuima at model@parameter at measure]
           #mypar[oldyuima at model@measure$df at time.var]<-1
-          fdataeta<-dens(par=mypar,x=ures)# f(eps, eta)
+          fdataeta<-mydens1(par=mypar,x=ures)# f(eps, eta)
           del <- 10^-3
-          fdatadeltaeta<- dens(par=mypar,x=ures+del) # f(eps + delta, eta)
+          fdatadeltaeta<- mydens1(par=mypar,x=ures+del) # f(eps + delta, eta)
           dummy <- t(rep(1,length(mypar[lev.names])))
           myeta<- as.matrix(mypar[lev.names])%*%dummy
           myetapert <- myeta+del*diag(rep(1,dim(myeta)[1])) 
@@ -768,13 +769,13 @@
           fdataetadelta<-sapply(X=1:dim(myeta)[1],FUN = function(X){
             par<-myetapert[,X]
             #par[oldyuima at model@measure$df at time.var]<-1
-            dens(par=par,x=ures)
+            mydens1(par=par,x=ures)
           }
           )# f(eps, eta+delta)
           fdatadeltaetadelta<-sapply(X=1:dim(myeta)[1],FUN = function(X){
             par<-myetapert[,X]
             #par[oldyuima at model@measure$df at time.var]<-1
-            dens(par=par,x=ures+del)
+            mydens1(par=par,x=ures+del)
           }
           ) # f(eps +deta, eta+delta) 
           term1<-1/(fdataeta)



More information about the Yuima-commits mailing list