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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Oct 29 01:56:34 CEST 2016


Author: lorenzo
Date: 2016-10-29 01:56:34 +0200 (Sat, 29 Oct 2016)
New Revision: 497

Modified:
   pkg/yuima/DESCRIPTION
   pkg/yuima/R/qmle.R
   pkg/yuima/src/carmafilter.c
Log:


Modified: pkg/yuima/DESCRIPTION
===================================================================
--- pkg/yuima/DESCRIPTION	2016-10-28 13:18:18 UTC (rev 496)
+++ pkg/yuima/DESCRIPTION	2016-10-28 23:56:34 UTC (rev 497)
@@ -1,7 +1,7 @@
 Package: yuima
 Type: Package
 Title: The YUIMA Project Package for SDEs
-Version: 1.2.8
+Version: 1.2.9
 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/qmle.R
===================================================================
--- pkg/yuima/R/qmle.R	2016-10-28 13:18:18 UTC (rev 496)
+++ pkg/yuima/R/qmle.R	2016-10-28 23:56:34 UTC (rev 497)
@@ -333,7 +333,12 @@
 
   if(is.CARMA(yuima)){
     if(length(yuima at model@parameter at xinit)>1){
-      fullcoef<-unique(c(fullcoef,yuima at model@parameter at xinit))
+      #fullcoef<-unique(c(fullcoef,yuima at model@parameter at xinit))
+      condIniCarma<-!(yuima at model@parameter at xinit%in%fullcoef)
+      if(sum(condIniCarma)>0){
+        NamesInitial<- yuima at model@parameter at xinit[condIniCarma]
+        start <- as.list(unlist(start)[!names(unlist(start))%in%(NamesInitial)])
+      }
     }
   }
 
@@ -1893,6 +1898,7 @@
   if(print==TRUE){
     yuima.warn(sprintf("NEG-QL: %f, %s", -QL, paste(names(param),param,sep="=",collapse=", ")))
   }
+  #cat(sprintf("\n%.5f ", -QL))
   if(is.infinite(QL)) return(1e10)
   return(as.numeric(-QL))
 

Modified: pkg/yuima/src/carmafilter.c
===================================================================
--- pkg/yuima/src/carmafilter.c	2016-10-28 13:18:18 UTC (rev 496)
+++ pkg/yuima/src/carmafilter.c	2016-10-28 23:56:34 UTC (rev 497)
@@ -44,7 +44,7 @@
 SEXP carma_tmp(SEXP V, SEXP P, SEXP A);
 
 SEXP Cycle_Carma(SEXP Y, SEXP StateVar, SEXP ExpA, SEXP Times_Obs, SEXP P,
-                SEXP Qmatr, SEXP SigMatr, SEXP Zc, SEXP Result,SEXP Kgain, 
+                SEXP Qmatr, SEXP SigMatr, SEXP Zc, SEXP Result,SEXP Kgain,
                 SEXP dum_zc, SEXP Mat22int);
 
 
@@ -113,8 +113,8 @@
 
                 int times_obs, p;
                 int i, j, h,  t;
-                
 
+
                 /* Declare pointer */
 
                 double *rY, *rStateVar, *rExpA, *rQmatr, *rSigMatr, *rZc;
@@ -122,10 +122,11 @@
                 double Uobs=0;
                 double dummy=0;
                 double dummy1=0;
+                /*FILE *fd;*/
                 /* Declare SEXP */
 
-                
 
+
                 /* Check the type of variables*/
 
               //  if(!isInteger(P)) error("`P' must be integer");
@@ -157,16 +158,16 @@
 
                 PROTECT(Zc = AS_NUMERIC(Zc));
                 rZc = REAL(Zc);
-                
+
                 PROTECT(Result = AS_NUMERIC(Result));
                 rResult = REAL(Result);
-                
+
                 PROTECT(Kgain = AS_NUMERIC(Kgain));
                 rKgain = REAL(Kgain);
-                
+
                 PROTECT(dum_zc = AS_NUMERIC(dum_zc));
                 rdum_zc = REAL(dum_zc);
-                
+
                 PROTECT(Mat22int = AS_NUMERIC(Mat22int));
                 rMat22int = REAL(Mat22int);
 
@@ -180,7 +181,7 @@
                 p = *INTEGER(P);
 
 
-               /* Main Code 
+               /* Main Code
                  Dimension of Inputs:
                 Y = Vector p dimension;
                 StateVar = matrix p x 1;
@@ -261,10 +262,19 @@
                         }
                        }
                        /*term_int = -0.5 * (log(Sd_2)+ Uobs * Uobs * 1/Sd_2)  every entries are scalars*/
+                       /*fd=fopen("dueinteri.txt", "w+");*/
+                      if(rResult[1]>0){
                       rResult[0] += -0.5 * (log(rResult[1])+ Uobs * Uobs /rResult[1]);
+                      }else{
+                        rResult[0] += -1000000;
+                      }
+                      /*printf("\n res %.5f", rResult[0]);*/
                       /* manual debug */
                    }
 
+
+                 /*fclose(fd);*/
+
                    UNPROTECT(10);
                    return Result;
 



More information about the Yuima-commits mailing list