rvasicek: Simulation and Density of Vasicek Process

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/rvasicek.R

Description

The definition of the process used here is:

dX_t = -a(X_t - mu) + sd*dW_t,

where (mu, a, sd) are the three real parameters.

Usage

1
2
3
4
rvasicek(n, m, x0 = 0, mu = 0, a = 1, sd = 1, T = 1, drop = TRUE)
dvasicek(x, mu=0, a=1, sd=1, T=1, log = FALSE)
lvasicek(x, mu=0, a=1, sd=1, T=1)
evasicek(x, a0=1, T=1)

Arguments

n

integer, number of paths.

m

integer, number of steps, the step size will be T/m.

x

double, the vector of the observed values of a Vasicek process.

x0

double, the initial value.

mu

double, the value on which the process is centered and has an attraction when it is away.

a

double, the coefficient of how strong is the mean reversion when the process is away from mu.

sd

double, the volatility.

T

double, the final date on which the brownian motion is simulated.

drop

logical, if n = 1 and drop = TRUE then the function returns the single path of the brownian motion as a vector instead of a matrix.

log

logical, if TRUE, returns the log-density, if FALSE, returns the density.

a0

double, starting value of a in the estimation algorithm.

Value

rvasicek returns a (n, m+1) matrix of n path of the Vasicek process. dvasicek returns a vector of size length(x)-1. Note that the first value has no density. lvasicek returns the log-liklihood associated to dvasicek and evasicek returns the Maximum Likelihood Estimator of the parameters (mu, a, sd).

Note

If mu = 0, the process coincides with the Ornstein-Uhlenbeck process.

Author(s)

Nicolas Baradel - PGM Solutions

References

https://en.wikipedia.org/wiki/Vasicek_model

See Also

https://pgm-solutions.com/packages

Examples

1
2
x <- rvasicek(5, 10)
dvasicek(x[1L, ])

Example output

 [1] 0.6621352 1.0899338 1.2677005 1.1900134 0.7833885 0.4952588 1.3187989
 [8] 1.0308698 1.3115995 0.7758035

rpgm documentation built on March 18, 2018, 2:24 p.m.