R/StepFRM.R

Defines functions StepFRM

Documented in StepFRM

StepFRM <- function(N)
{
  S = t(N$Post-N$Pre)
  v = ncol(S)
  return(
         function(x0, t0, deltat, ...)
         {
           x = x0
           t = t0
           termt = t0+deltat
           repeat {
             h = N$h(x, t, ...)
             pu = rexp(v,h)
             j = which.min(pu)
             t = t+pu[j]
             if (t >= termt)
               return(x)
             x = x+S[,j]
           }
         }
         )		
}	


# eof

Try the smfsb package in your browser

Any scripts or data that you put into this service are public.

smfsb documentation built on May 2, 2019, 5:13 a.m.