LNA Reference
GpABC
functions for Linear Noise Approximation.
Index
Types and Functions
GpABC.LNA
— TypeLNA
This is a structure which will hold the LNA: the mean of the trajectories and the covariance between the species.
Arguments
traj_means
: A (number of species) x (number of time points) array which holds the mean trajectory for each species on each row of the array.traj_covars
: An array which holds the covariance matrix of the species at each time point.time_points
: The timepoints the system was solved for.
GpABC.LNAInput
— TypeLNAInput
This is a structure which holds the inputs needed for computing the Linear Noise Approximation (LNA). This structure will hold the stochastic system as provided by the user; uniquely defined through kinetic parameters, the rates of the system and the stoichiometry matrix.
Arguments
params::AbstractArray{Float64,1}
: The rate parameters of the stochastic model.S::AbstractArray{Float64,2}
: the stoichiometry matrix of the system. Size: number of reactions x number of species.reaction_rate_function::Function,
: This is a function f(x, parameters) which should return an array of the reaction rates of the system, i.e. S*f would describe the ODE representation of the system.volume::Float64
: The volume of the reactants of the system.
GpABC.compute_LNA
— Functioncompute_LNA(input::LNAInput,
x0::Tuple{AbstractArray{Float64,1},AbstractArray{Float64,2}},
Tspan::Tuple{Float64,Float64},
saveat::Float64,
solver::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm=RK4();
kwargs...)
The function computes the linear noise approximation to system through construction of two ODEs: one describing the trajectories of the mean of the LNA and the other describing the change the covariance between the variables. These outputs are held in a LNA structure.
Arguments
x0::Tuple{AbstractArray{Float64,2},AbstractArray{Float64,2}}
: The initial conditions of the system. In the form of (the initial conditions of the species, the initial covariance matrix of the system).Tspan::Tuple{Float64,Float64}
: The start and end times of the simulation.saveat::Float64
: The number of time points the use wishes to solve the system for.solver::DEAlgorithm
: The ODE solver the user wishes to use, for exampleOrdinaryDiffEq.RK4()
.
#Returns
- LNA
GpABC.get_LNA_trajectories
— Functionget_LNA_trajectories(input::LNAInput, n_samples::Int64,
x0::Tuple{AbstractArray{Float64,1},AbstractArray{Float64,2}},
Tspan::Tuple{Float64,Float64},
saveat::Float64,
solver::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm=RK4();
kwargs...)
A function which computes the LNA and then samples from the it to output sampled trajectories. The user can also sample more than one trajectory; which are then averaged.
Arguments
input::LNAInput
: LNAInput structure.n_samples::Int64
: The number of sampled trajectories to be sampled and then averaged.x0::Tuple{AbstractArray{Float64,2},AbstractArray{Float64,2}}
: The initial conditions of the system. In the form of (the initial conditions of the species, the initial covariance matrix of the system).Tspan::Tuple{Float64,Float64}
: The start and end times of the simulation.saveat::Float64
: The number of time points the use wishes to solve the system for.solver::DEAlgorithm
: The ODE solver the user wishes to use, for example OrdinaryDiffEq.RK4() .
#Returns
- A (number of species) x (number of time points) array which holds the averaged trajectory for each species on each row of the array.
GpABC.sample_LNA_trajectories
— Methodsample_LNA_trajectories(lna::LNA, n_samples::Int64)
A function which samples from the LNA to output sampled trajectories. The LNA gives the mean of the trajectories and the covariance between them; hence a single trajectory can be sampled from a Multivariate Normal distribution. The user can also sample more than one trajectory; which are then averaged.
Arguments
lna::LNA
: LNA structure.n_samples::Int64
: The number of sampled trajectories to be sampled and then averaged.
#Returns
- A (number of species) x (number of time points) array which holds the averaged trajectory for each species on each row of the array.