[Yuima-commits] r815 - pkg/yuima/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 6 00:42:53 CEST 2022


Author: lorenzo
Date: 2022-09-06 00:42:53 +0200 (Tue, 06 Sep 2022)
New Revision: 815

Modified:
   pkg/yuima/src/pseudoLogLikCogarchIrregularGrid.cpp
Log:
Fixed pseudoLogLikCogarchIrregularGrid.cpp

Modified: pkg/yuima/src/pseudoLogLikCogarchIrregularGrid.cpp
===================================================================
--- pkg/yuima/src/pseudoLogLikCogarchIrregularGrid.cpp	2022-08-29 14:12:30 UTC (rev 814)
+++ pkg/yuima/src/pseudoLogLikCogarchIrregularGrid.cpp	2022-09-05 22:42:53 UTC (rev 815)
@@ -44,7 +44,7 @@
               arma::vec DeltaG2, arma::vec Deltat) {
   double res = 0;
   double VarDeltaG = 0;
-  double penal = 100000.123;
+  double penal = 1000000000;
   arma::mat I = arma::eye<arma::mat>(B.n_rows, B.n_rows);
 // for(i in c(1:(lengthObs))){
   for(int i=0;i<lengthObs;i++){
@@ -51,11 +51,12 @@
     arma::mat DeltatB1 = expmat(B * Deltat[i]);
     arma::mat DeltatB2 = expmat(Btilde * Deltat[i]);
     VarDeltaG = a0 * Deltat[i] * bq / (bq - a1) + arma::as_scalar(ta * DeltatB2 * InvBtilde * (I - DeltatB2) * (state - stateMean));
-    state <- (I + DeltaG2[i] / V * e * ta) * DeltatB1 * state+a0 * DeltaG2[i] / V * e;
+    state = (I + DeltaG2[i] / V * e * ta) * DeltatB1 * state+a0 * DeltaG2[i] / V * e;
+    V = arma::as_scalar(a0 + ta*state);
   if(VarDeltaG>0){
-    res =res - 0.5*(arma::as_scalar((DeltaG2[i] / VarDeltaG )) + log(VarDeltaG) + log(2 * 3.141593));//
+    res = res - 0.5*(DeltaG2[i] / VarDeltaG  + log(VarDeltaG) + log(2 * 3.141593));
   }else{
-    res = res+VarDeltaG-penal;
+    res = res-penal;
   }
 }
 return res;



More information about the Yuima-commits mailing list