aleatory.processes.GBM#
- class aleatory.processes.GBM(drift=1.0, volatility=0.5, initial=1.0, T=1.0, rng=None)[source]#
Geometric Brownian Motion#
A Geometric Brownian Motion object.
Notes#
A Geometric Brownian Motion \(\{X(t) : t \geq 0\}\) is characterised by the following SDE.
\[dX_t = \mu X_t dt + \sigma X_t dW_t \ \ \ \ t\in (0,T]\]with initial condition \(X_0 = x_0\geq0\), where
\(\mu\) is the drift
\(\sigma>0\) is the volatility
\(W_t\) is a standard Brownian Motion.
The solution to this equation can be written as
\[X_t = x_0\exp\left((\mu + \frac{\sigma^2}{2} )t +\sigma W_t\right)\]and each \(X_t\) follows a log-normal distribution.
Examples#
from aleatory.processes import GBM process = GBM() fig = process.draw(n=100, N=5, figsize=(12, 7)) fig.show()
Constructor, Methods, and Attributes#
- __init__(drift=1.0, volatility=0.5, initial=1.0, T=1.0, rng=None)[source]#
- Parameters:
drift (float) – the parameter \(\mu\) in the above SDE
volatility (float) – the parameter \(\sigma>0\) in the above SDE
initial (float) – the initial condition \(x_0\) in the above SDE
T (float) – the right hand endpoint of the time interval \([0,T]\) for the process
rng (numpy.random.Generator) – a custom random number generator
Methods
__init__([drift, volatility, initial, T, rng])- param float drift:
the parameter \(\mu\) in the above SDE
draw(n, N[, T, marginal, envelope, title, ...])Simulates and plots paths/trajectories from the instanced stochastic process.
estimate_covariances([times])estimate_expectations()estimate_quantiles(q)estimate_stds()estimate_variances()get_marginal(t)marginal_expectation([times])marginal_stds([times])marginal_variance([times])plot(n, N[, T, title, suptitle])Simulates and plots paths/trajectories from the instanced stochastic process.
plot_covariance([times, title])plot_kernel([times, colormap, matrix_shape, ...])plot_kernel3d([times, title])plot_mean_variance([times, title])plot_paths_and_kernel(n, N[, T, title, ...])Plots the paths of the process and the covariance kernel.
process_covariance([times])process_expectation()process_stds()process_variance()sample(n)Generate a realization.
sample_at(times)Generate a realization using specified times.
simulate(n, N[, T])Simulate paths/trajectories from the instanced stochastic process.
Attributes
TEnd time of the process.
driftGeometric Brownian motion drift parameter.
initialGeometric Brownian motion initial point.
rngvolatilityGeometric Brownian motion volatility parameter.