[Pomp-commits] r433 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Feb 18 04:02:29 CET 2011


Author: kingaa
Date: 2011-02-18 04:02:28 +0100 (Fri, 18 Feb 2011)
New Revision: 433

Modified:
   pkg/src/blowfly.c
Log:
- allow for variable delta.t


Modified: pkg/src/blowfly.c
===================================================================
--- pkg/src/blowfly.c	2011-02-16 22:58:59 UTC (rev 432)
+++ pkg/src/blowfly.c	2011-02-18 03:02:28 UTC (rev 433)
@@ -18,20 +18,20 @@
 #define EPS         (x[stateindex[4]]) // survival noise
 
 // Ricker model with log-normal process noise
-void _blowfly_simulator (double *x, const double *p, 
+void _blowfly_model_simulator (double *x, const double *p, 
 			 const int *stateindex, const int *parindex, const int *covindex,
 			 int covdim, const double *covar, 
 			 double t, double dt)
 {
-  double var_p = exp(2*LOG_SIGMAP);
-  double var_d = exp(2*LOG_SIGMAD);
+  double var_p = exp(2*LOG_SIGMAP)/dt;
+  double var_d = exp(2*LOG_SIGMAD)/dt;
   double e = (var_p > 0.0) ? rgamma(1.0/var_p,var_p) : 1.0;
   double eps = (var_d > 0.0) ? rgamma(1.0/var_d,var_d) : 1.0;
   double P = exp(LOG_P);
   int tau = (int) TAU;
   int k;
-  R = rpois(P*N[tau]*exp(-N[tau]/exp(LOG_NZERO))*e);
-  S = rbinom(N[0],exp(-exp(LOG_DELTA)*eps));
+  R = rpois(P*N[tau]*exp(-N[tau]/exp(LOG_NZERO))*dt*e);
+  S = rbinom(N[0],exp(-exp(LOG_DELTA)*dt*eps));
   E = e;
   EPS = eps;
   for (k = tau; k > 0; k--) N[k] = N[k-1];



More information about the pomp-commits mailing list