fptsde1d | R Documentation |
Kernel density and random generation for first-passage-time (f.p.t) in 1-dim stochastic differential equations.
fptsde1d(object, ...)
dfptsde1d(object, ...)
## Default S3 method:
fptsde1d(object, boundary, ...)
## S3 method for class 'fptsde1d'
summary(object, digits=NULL, ...)
## S3 method for class 'fptsde1d'
mean(x, ...)
## S3 method for class 'fptsde1d'
Median(x, ...)
## S3 method for class 'fptsde1d'
Mode(x, ...)
## S3 method for class 'fptsde1d'
quantile(x, ...)
## S3 method for class 'fptsde1d'
kurtosis(x, ...)
## S3 method for class 'fptsde1d'
skewness(x, ...)
## S3 method for class 'fptsde1d'
min(x, ...)
## S3 method for class 'fptsde1d'
max(x, ...)
## S3 method for class 'fptsde1d'
moment(x, ...)
## S3 method for class 'fptsde1d'
cv(x, ...)
## Default S3 method:
dfptsde1d(object, ...)
## S3 method for class 'dfptsde1d'
plot(x, hist=FALSE, ...)
object |
an object inheriting from class |
boundary |
an |
x |
an object inheriting from class |
hist |
if |
digits |
integer, used for number formatting. |
... |
potentially further arguments for (non-default) methods, such as |
The function fptsde1d
returns a random variable \tau_{(X(t),S(t))}
"first passage time", is defined as :
\tau_{(X(t),S(t))} = \{ t \geq 0 ; X_{t} \geq S(t) \},\quad if \quad X(t_{0}) < S(t_{0})
\tau_{(X(t),S(t))} = \{ t \geq 0 ; X_{t} \leq S(t) \},\quad if \quad X(t_{0}) > S(t_{0})
And dfptsde1d
returns a kernel density approximation for \tau_{(X(t),S(t))}
"first passage time".
with S(t)
is through a continuous boundary (barrier).
An overview of this package, see browseVignettes('Sim.DiffProc')
for more informations.
dfptsde1d() |
gives the density estimate of fpt. |
fptsde1d() |
generates random of fpt. |
A.C. Guidoum, K. Boukhetala.
Argyrakisa, P. and G.H. Weiss (2006). A first-passage time problem for many random walkers. Physica A. 363, 343–347.
Aytug H., G. J. Koehler (2000). New stopping criterion for genetic algorithms. European Journal of Operational Research, 126, 662–674.
Boukhetala, K. (1996) Modelling and simulation of a dispersion pollutant with attractive centre. ed by Computational Mechanics Publications, Southampton ,U.K and Computational Mechanics Inc, Boston, USA, 245–252.
Boukhetala, K. (1998a). Estimation of the first passage time distribution for a simulated diffusion process. Maghreb Math.Rev, 7(1), 1–25.
Boukhetala, K. (1998b). Kernel density of the exit time in a simulated diffusion. les Annales Maghrebines De L ingenieur, 12, 587–589.
Ding, M. and G. Rangarajan. (2004). First Passage Time Problem: A Fokker-Planck Approach. New Directions in Statistical Physics. ed by L. T. Wille. Springer. 31–46.
Roman, R.P., Serrano, J. J., Torres, F. (2008). First-passage-time location function: Application to determine first-passage-time densities in diffusion processes. Computational Statistics and Data Analysis. 52, 4132–4146.
Roman, R.P., Serrano, J. J., Torres, F. (2012). An R package for an efficient approximation of first-passage-time densities for diffusion processes based on the FPTL function. Applied Mathematics and Computation, 218, 8408–8428.
Gardiner, C. W. (1997). Handbook of Stochastic Methods. Springer-Verlag, New York.
fptsde2d
and fptsde3d
simulation fpt for 2 and 3-dim SDE.
FPTL
for computes values of the first passage time location (FPTL) function, and Approx.fpt.density
for approximate first-passage-time (f.p.t.) density in package "fptdApprox".
GQD.TIpassage
for compute the First Passage Time Density of a GQD With Time Inhomogeneous Coefficients in package "DiffusionRgqd".
## Example 1: Ito SDE
## dX(t) = -4*X(t) *dt + 0.5*dW(t)
## S(t) = 0 (constant boundary)
set.seed(1234)
# SDE 1d
f <- expression( -4*x )
g <- expression( 0.5 )
mod <- snssde1d(drift=f,diffusion=g,x0=2,M=1000)
# boundary
St <- expression(0)
# random
out <- fptsde1d(mod, boundary=St)
out
summary(out)
# density approximate
den <- dfptsde1d(out)
den
plot(den)
## Example 2: Stratonovich SDE
## dX(t) = 0.5*X(t)*t *dt + sqrt(1+X(t)^2) o dW(t)
## S(t) = -0.5*sqrt(t) + exp(t^2) (time-dependent boundary)
set.seed(1234)
# SDE 1d
f <- expression( 0.5*x*t )
g <- expression( sqrt(1+x^2) )
mod2 <- snssde1d(drift=f,diffusion=g,x0=2,M=1000,type="srt")
# boundary
St <- expression(-0.5*sqrt(t)+exp(t^2))
# random
out2 <- fptsde1d(mod2,boundary=St)
out2
summary(out2)
# density approximate
plot(dfptsde1d(out2,bw='ucv'))
## Example 3: fptsde1d vs fptdApproximate
## Not run:
f <- expression( -0.5*x+0.5*5 )
g <- expression( 1 )
St <- expression(5+0.25*sin(2*pi*t))
mod <- snssde1d(drift=f,diffusion=g,boundary=St,x0=3,T=10,N=10^4,M =10000)
mod
# random
out3 <- fptsde1d(mod,boundary=St)
out3
summary(out3)
# density approximate:
library("fptdApprox")
# Under `fptdApprox':
# Define the diffusion process and give its transitional density:
OU <- diffproc(c("alpha*x + beta","sigma^2",
"dnorm((x-(y*exp(alpha*(t-s)) - beta*(1 - exp(alpha*(t-s)))/alpha))/
(sigma*sqrt((exp(2*alpha*(t-s)) - 1)/(2*alpha))),0,1)/
(sigma*sqrt((exp(2*alpha*(t-s)) - 1)/(2*alpha)))",
"pnorm(x, y*exp(alpha*(t-s)) - beta*(1 - exp(alpha*(t-s)))/alpha,
sigma*sqrt((exp(2*alpha*(t-s)) - 1)/(2*alpha)))"))
# Approximate the first passgage time density for OU, starting in X_0 = 3
# passing through 5+0.25*sin(2*pi*t) on the time interval [0,10]:
res <- Approx.fpt.density(OU, 0, 10, 3,"5+0.25*sin(2*pi*t)", list(alpha=-0.5,beta=0.5*5,sigma=1))
##
plot(dfptsde1d(out3,bw='ucv'),main = 'fptsde1d vs fptdApproximate')
lines(res$y~res$x, type = 'l',lwd=2)
legend('topright', lty = c('solid', 'dashed'), col = c(1, 2),
legend = c('fptdApproximate', 'fptsde1d'), lwd = 2, bty = 'n')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.