Brownian#
- class FDApy.simulation.Brownian(name, random_state=None)[source]#
Simulate Brownian motions.
- Parameters:
- Attributes:
data (DenseFunctionalData) – An object that represents the simulated data.
noisy_data (DenseFunctionalData) – An object that represents a noisy version of the simulated data.
sparse_data (IrregularFunctionalData) – An object that represents a sparse version of the simulated data.
- Raises:
ValueError – The sampling points have to be regularly spaced. Otherwise, the covariance is not correct.
Notes
The implementation is adapted from [1].
References
Methods
add_noise([noise_variance])Add noise to functional data objects.
add_noise_and_sparsify([noise_variance, ...])Generate a noisy and sparse version of functional data objects.
new(n_obs[, n_clusters, argvals])Simulate realizations of a Brownian motion.
sparsify([percentage, epsilon])Generate a sparse version of functional data objects.
- add_noise(noise_variance=1.0)[source]#
Add noise to functional data objects.
This function generates an artificial noisy version of a functional data object of class
DenseFunctionalDataby adding realizations of Gaussian random variables \(\epsilon \sim \mathcal{N}(0, \sigma^2)\) to the observations. The variance \(\sigma^2\) can be supplied by the user. The generated data are given by\[Y(t) = X(t) + \epsilon.\]- Parameters:
noise_variance (float) – The variance \(\sigma^2\) of the Gaussian noise that is added to the data.
- Returns:
Create the class attribute noisy_data.
- Return type:
None
- add_noise_and_sparsify(noise_variance=1.0, percentage=0.9, epsilon=0.05)[source]#
Generate a noisy and sparse version of functional data objects.
This function generates an artificially noisy and sparse version of a functional datasets. From a functional dataset, it first generates the noisy version and then the sparse version based on the noisy one.
- Parameters:
- Returns:
Create the class attributes noisy_data and sparse_data.
- Return type:
None
- new(n_obs, n_clusters=1, argvals=None, **kwargs)[source]#
Simulate realizations of a Brownian motion.
This function generates
n_obsrealizations of a Brownian motion on a common gridargvals.- Parameters:
n_obs (int) – Number of observations to simulate.
n_clusters (int) – Not used.
argvals (ndarray[Any, dtype[float64]] | None) – Values at which Brownian motions are evaluated. If
None, the functions are evaluated on the interval \([0, 1]\) with \(21\) regularly spaced sampled points.kwargs – See below
- Keyword Arguments:
init_point (float) – Start value of the Brownian motion. For geometric Brownian motion,
init_pointshould be stricly positive. Default value is 0 for standard Brownian motion and 1 for geometric Brownian motion.mu (float, default=0) – Interest rate (or percentage drift).
sigma (float, default=1) – Diffusion coefficient (or percentage volatility).
hurst (float, default=0.5) – Hurst parameter. If
hurst = 0.5. the fractional Brownian motion is equivalent to the standard Brownian motion.
- Returns:
Create the class attributes data.
- Return type:
None
- sparsify(percentage=0.9, epsilon=0.05)[source]#
Generate a sparse version of functional data objects.
This function generates an artificially sparsified version of a functional data object of class
DenseFunctionalData. The percentage (and the uncertainty around it) of the number of observation points retained can be supplied by the user. Let \(p\) be the defined percentage and \(\epsilon\) be the uncertainty value. The retained number of observations will be different for each curve and be between \(p - \epsilon\) and \(p + \epsilon\).