Monte Carlo Simulations
In this section we document data structures and methods for Monte Carlo simulation.
Simulation Types
DiffFusion.Simulation
— Typestruct Simulation
model::Model
times::AbstractVector
X::AbstractArray
dZ::Union{AbstractArray, Nothing}
end
A Simulation
object represents the result of a Monte Carlo simulation.
Elements are:
model
- the model used for simulation.times
- vector of simulation times starting with 0.X
- tensor of size (N_1
,N_2
,N_3
) and typeModelValue
whereN_1
islength(m.state_alias)
,N_2
is number of Monte Carlo paths,N_3
islength(times)
.
dZ
- Brownian motion increments.
DiffFusion.pseudo_brownian_increments
— Functionpseudo_brownian_increments(
n_states::Int,
n_paths::Int,
n_times::Int, # without zero
seed::Int = 271828182846,
)
A simple method to generate Brownian motion increments.
DiffFusion.sobol_brownian_increments
— Functionsobol_brownian_increments(
n_states::Int,
n_paths::Int,
n_times::Int, # without zero
)
Generate Brownian motion increments via Sobol sequence.
DiffFusion.simple_simulation
— Functionsimple_simulation(
model::Model,
ch::CorrelationHolder,
times::AbstractVector,
n_paths::Int;
with_progress_bar::Bool = true,
brownian_increments::Function = pseudo_brownian_increments,
store_brownian_increments::Bool = false,
)
A simple Monte Carlo simulation method assuming all model components are state-independent.
DiffFusion.diagonal_simulation
— Functiondiagonal_simulation(
model::Model,
ch::CorrelationHolder,
times::AbstractVector,
n_paths::Int;
with_progress_bar::Bool = true,
brownian_increments::Function = pseudo_brownian_increments,
store_brownian_increments::Bool = false,
)
A Monte Carlo simulation method assuming all model components are diagonal models.