builtfunc evaluates all the functions describing a generic Gaussian Diffusion process X(t) (drift, infinitesimal variance, mean, variance and first derivative of the transition density); it also evaluates the threshold function and its time derivative, both required in the evaluation of the kernel function of the Volterra integral equation for the FPT pdf (Buonocore 1987).
The FPT density g0 and distribution function gg0 are evaluated up to a fixed time T on N1max gridpoints by numerical integration of the Volterra integral equation given in Buonocore 1987. Note that this time may not correspond to the final time Tfin when full reconstruction of the FPT density by quadrature is not required (quadflag set to 0 in the input parameters list).
FPTsimul generates M spikes (times of first boundary crossing) for the Gaussian Diffusion proces X(t) by implementing the Hazard Rate Method, based on the instantaneous firing rate, defined as the ratio between the probability density function and the survival function of the process. The asymptotic firing rate is also estimated to shorten computations. histplot then produced an histogram of the simulated times and plot it against the approximated FPT density as obtained by FPTdensity_byint
vectorsetup evaluates the vectors mp (mean of the process) and the two covariance factors up and vp (i.e. covariance of the process is given by up*vp) in the interval [t0, Tfin] with timestep deltat
diffusion creates an object of class “diffusion” from the set of provided values. is.diffusionchecks if its argument is an object of class “diffusion”. print shows an object of class “diffusion”.
This function creates the plots of the approximate density function and the approximate distribution function for the FPT problem at hand. It also creates an additional plot for the corresponding hazard rate function, representing the instantaneous rate of the crossing occurrence at a certain time, conditional on its not occurring before that time.
For a generic Gaussian Diffusion process X(t) the drift can be written as a(t)*X(t)+b(t) and the infinitesimal variance as cc(t)^2. User should provide the functional form for a(t),b(t) and cc(t) in the main script. The threshold to be crossed has to be also provided through the function S(t) and its derivative Sp(t) in the same script. Examples of such a script are given for a Wiener process with or without drift through different thresholds (scripts Wiener, Wiener1, WienerDrift) for an Ornstein Uhlenbeck process also in presence of an additional current (scripts OrnUhl, OrnUhlCurrent) and for a more complex process with time-varying coefficients (Logistic).
We consider Gaussian Diffusion processes and smooth thresholds. After evaluating the mean of the process to check the subthreshold regimen hypothesis, the FPT density function is reconstructed; first passage times are also generated by an algorithm based on the hazard rate method and results are compared. The timestep of the simulations can iteratively be refined. User should provide the functional form for the drift and the infinitesimal variance of the considered diffusion process along with the functional form for the threshold. Example scripts for common drifts and thresholds are given.