ObservationSchemes.jl
- ObservationSchemes.AllObservations
- ObservationSchemes.FirstPassageAbstract
- ObservationSchemes.FirstPassageTimeInfo
- ObservationSchemes.GeneralObs
- ObservationSchemes.GsnStartingPt
- ObservationSchemes.KnownStartingPt
- ObservationSchemes.LinearGsnObs
- ObservationSchemes.NoFirstPassageTimes
- ObservationSchemes.ObsScheme
- ObservationSchemes.Observation
- ObservationSchemes.ParametrizedObservation
- ObservationSchemes.StartingPtPrior
- Base.collect
- Base.eltype
- Base.eltype
- Base.length
- Base.length
- Base.rand
- Base.rand
- Base.rand
- Base.rand
- Base.rand
- Base.rand
- Base.rand
- Base.size
- Base.size
- Distributions.logpdf
- Distributions.logpdf
- Distributions.logpdf
- ObservationSchemes.L
- ObservationSchemes.L
- ObservationSchemes._prepare_xx
- ObservationSchemes.add_dependency!
- ObservationSchemes.add_dependency!
- ObservationSchemes.add_recording!
- ObservationSchemes.add_recording!
- ObservationSchemes.add_recordings!
- ObservationSchemes.add_recordings!
- ObservationSchemes.build_recording
- ObservationSchemes.build_recording
- ObservationSchemes.build_recording
- ObservationSchemes.check_recording_format
- ObservationSchemes.fill_dependency_for_unspec_params_and_obs
- ObservationSchemes.fpt_info
- ObservationSchemes.initialize
- ObservationSchemes.initialize
- ObservationSchemes.inv_start_pt
- ObservationSchemes.inv_start_pt
- ObservationSchemes.inv_start_pt
- ObservationSchemes.inv_start_pt
- ObservationSchemes.load_data
- ObservationSchemes.load_data
- ObservationSchemes.load_data
- ObservationSchemes.local_symbols
- ObservationSchemes.new_obs_dependence!
- ObservationSchemes.new_param_and_obs_dependence!
- ObservationSchemes.new_param_dependence!
- ObservationSchemes.num_obs
- ObservationSchemes.num_recordings
- ObservationSchemes.obs
- ObservationSchemes.package
- ObservationSchemes.parameter_names
- ObservationSchemes.print_parameters
- ObservationSchemes.print_parameters
- ObservationSchemes.setup_time_grids
- ObservationSchemes.setup_time_grids
- ObservationSchemes.setup_time_grids
- ObservationSchemes.split_recording!
- ObservationSchemes.start_pt
- ObservationSchemes.start_pt
- ObservationSchemes.start_pt
- ObservationSchemes.start_pt
- ObservationSchemes.start_pt
- ObservationSchemes.start_pt
- ObservationSchemes.start_pt
- ObservationSchemes.Λ
- ObservationSchemes.Σ
- ObservationSchemes.Σ
- ObservationSchemes.μ
- ObservationSchemes.μ
- ObservationSchemes.ν
- ObservationSchemes.ν
ObservationSchemes.FirstPassageAbstract — TypeFirstPassageAbstractTypes ihneriting from this struct define the type of information stored about first-passage times
ObservationSchemes.ParametrizedObservation — TypeParametrizedObservation{D,T} <: Observation{D,T}Same as observations but additionally, types inheriting from this struct depend on some parameters (that may in practice be unknown).
Base.eltype — Methodeltype(::Type{K}) where {K<:Observation{D,T}}Type of each entry of the collection holding an observation.
Base.length — Methodlength(::Type{K}) where {K<:Observation{D}}Length of the observation (equal to a number of entries in a vector holding the data)
Base.rand — FunctionBase.rand(G::StartingPtPrior, [z, ρ=0.0])Sample a new starting point according to its prior distribution. An implementation with arguments z, ρ implements a preconditioned Crank-Nicolson scheme with memory parameter ρ and a current non-centered variable z. z is also referred to as the driving noise.
Base.rand — Functionrand([rng::Random.AbstractRNG], G::GsnStartingPt, z, ρ=0.0)Sample new white noise using Crank-Nicolson scheme with memory parameter ρ and a previous value of the white noise stored inside object G
Base.rand — Methodrand([rng::Random.AbstractRNG], G::GsnStartingPt)Sample new starting point according to its prior distribution.
Base.rand — Methodrand([rng::Random.AbstractRNG], G::KnownStartingPt, args...)Starting point is known. Nothing can be sampled. Returning known starting point.
Base.rand — MethodBase.rand([rng::Random.AbstractRNG], o::LinearGsnObs, X)Sample an observation according to
with $L$, $μ$ and $Σ$ defined in o.
Base.size — Methodsize(::Type{K}) where {K<:Observation{D}}Size of the observation
Distributions.logpdf — Methodlogpdf(G::GsnStartingPt, y)log-probability density function evaluated at y of a prior distribution G
Distributions.logpdf — Methodlogpdf(::KnownStartingPt, y)Nothing to do so long as y is equal to the known starting point inside G
ObservationSchemes.L — MethodL(o::LinearGsnObs)Return matrix L from the observation scheme ν = Lx+ξ, where ξ∼N(μ,Σ)
ObservationSchemes._prepare_xx — Method_prepare_xx(::Val, os::ObsScheme, X)Cycle through a collection X and transform it according to the observation schemes specified in os.
ObservationSchemes.add_dependency! — Methodadd_dependency!(all_obs::AllObservations, dep::Dict)Add a dependency structure dep between parameters shared across various laws and observations used to generate various recordings stored in an observations container all_obs.
ObservationSchemes.add_recording! — Methodadd_recording!(all_obs::AllObservations, recording::NamedTuple)Add a new recording recording to an observations container all_obs.
ObservationSchemes.add_recordings! — Methodadd_recordings!(
    all_obs::AllObservations,
    recordings::AbstractArray{<:NamedTuple}
)Add multiple new recordings recordings to an observations container all_obs.
ObservationSchemes.build_recording — Methodbuild_recording(P, obs, t0, x0_prior)A utility function that creates an appropriate NamedTuple that represents a single recording.
ObservationSchemes.build_recording — Methodbuild_recording(
    ::Type{K}, tt, observs::Vector, P, t0, x0_prior; kwargs...
) where KA utility function for building a recording. Times of recordings are assumed to be stored in tt and their values in observs. K is the type of observation (for instance LinearGsnObs). kwargs are name arguments that are passed to every single initializer of K.
ObservationSchemes.check_recording_format — Methodcheck_recording_format(::T) where T<:NamedTupleCheck whether the namedtuple has fields P, obs, t0 and x0_prior that each recording must have.
ObservationSchemes.fill_dependency_for_unspec_params_and_obs — Methodfill_dependency_for_unspec_params(all_obs::AllObservations)Fill the all_obs.depen_param dictionary with all parameters that are not shared between recordings.
ObservationSchemes.fpt_info — Methodfpt_info(::LinearGsnObs{D,T,Tag,FPT}) where {D,T,Tag,FPT}Return information about first-passage times
ObservationSchemes.initialize — Methodinitialize(all_obs::AllObservations)Split the recordings at the times of full observations to make full use of the Markov property (and make the code readily parallelisable). Introduce all variable parameters that were not mentioned in the current dependency dictionary. Create internal dictionaries all_obs.param_depend_rev and all_obs.obs_depend_rev.
ObservationSchemes.inv_start_pt — Methodinv_start_pt(y, G::GsnStartingPt, P)Compute the driving noise that is needed to obtain starting point y under prior G and the likelihood in P
ObservationSchemes.inv_start_pt — Methodinv_start_pt(y, G::KnownStartingPt, P)Starting point known, no need for dealing with white noise, use convention of returning y
ObservationSchemes.load_data — Methodload_data(os::ObsScheme, tt, xx)Decorate the data in xx and times of recordings in tt according to an observation scheme template stored in os.
ObservationSchemes.load_data — Methodload_data(os::ObsScheme, tt_xx)Same as load_data(os::ObsScheme, tt, xx), but tt_xx is a vector of tuples that pair the observations with their recorded times.
load_data(os::ObsScheme, tt_xx_filename::String)Same as above, but tt_xx are stored in a .csv file named tt_xx_filename, with each row containing time t and its respective observation x stored back-to-back.
ObservationSchemes.local_symbols — Methodlocal_symbols(
    all_obs::AllObservations,
    objects::AbstractArray{<:AbstractArray},
    f::Function,
    θsym::Vector{Symbol}
) where Tobjects is usually an array of arrays that must in total have the same number of elements as there are observations in the recording. It may however have a different jagged structure. The output is of the same structure as objects and gives for each o in object a corresponding lists of parameters and observations it depends on.
ObservationSchemes.new_obs_dependence! — Methodnew_obs_dependence!(old_dep, old_to_new_idx)Create a new interdependency dictionary for the observations from the old one old_dep and the dictionary old_to_new_idx that kept track of the changes.
Example
old_dep = Dict(
    :A => [(1, 2, 1), (1, 3, 2), (2, 1, 1)],
    :B => [(2, 2, 2), (3, 2, 1)],
)
old_to_new_idx = Dict(
    (1,1) => (1, 1), # obs (1,1) becomes (1,1)
    (1,2) => (1, 2),
    (1,3) => (2, 1), # obs (1,3) becomes (2,1)
    (2,1) => (3, 1),
    (2,2) => (4, 1),
    (2,3) => (5, 1),
    (3,1) => (6, 1),
    (3,2) => (6, 2),
)
new_dep = new_obs_dependence!(old_dep, old_to_new_idx)
new_dep == Dict(
    :A => [(1, 2, 1), (2, 1, 2), (3, 1, 1)],
    :B => [(4, 1, 2), (6, 2, 1)]
)ObservationSchemes.new_param_and_obs_dependence! — Methodnew_param_and_obs_dependence!(
    out,
    old_p_dep,
    old_o_dep,
    old_to_new_idx,
    old_to_new_obs_idx
)TODO refresh Define a new parameter dependence structure by using an old parameter dependence saved in old_dep and deducing the changed indices of affected recording by following the old_to_new_idx dictionary. The new dependency is saved directly to out structure.
ObservationSchemes.new_param_dependence! — Methodnew_param_dependence!(old_dep, old_to_new_idx)Create a new interdependency dictionary for the parameters from the old one old_dep and the dictionary old_to_new_idx that kept track of the changes.
Examples
old_dep = Dict(
    :A => [(1, :a), (2, :a1)],
    :B => [(1, :b), (3, :bbb)],
)
old_to_new_idx = Dict(
    1 => [1, 2], # observation 1 was split into two
    2 => [3, 4, 5], # observation 2 was split into three
    3 => [6],
)
new_dep = new_param_dependence!(old_dep, old_to_new_idx)
new_dep == Dict(
    :A => [1=>:a, 2=>:a, 3=>:a1, 4=>:a1, 5=>:a1],
    :B => [1=>:b, 2=>:b, 6=>:bbb],
)ObservationSchemes.parameter_names — Functionparameter_namesReturn names of the parameters of a given object
ObservationSchemes.print_parameters — Methodprint_parameters(all_obs::AllObservations)Print information about the variable parameters about which the all_obs.param_depend object stores some interdependency information.
ObservationSchemes.split_recording! — Methodsplit_recording!(
        recording_idx,
        recording,
        counter,
        out::AllObservations,
        old_to_new_idx,
        old_to_new_obs_idx,
    )Split a single record recording at the times of full observations. Save new, splitted recordings in the struct out. Keep account of the changed indices of the recordings for the recording index <---> parameter dependence pairs by updating a suitable dictionary old_to_new_idx, starting the new recording's index at an offset counter.
ObservationSchemes.start_pt — Methodstart_pt(z, G::GsnStartingPt, P)Compute a new starting point from the white noise for a given posterior distribution obtained from combining prior G and the likelihood encoded by the object P.
ObservationSchemes.start_pt — Methodstart_pt(z, G::GsnStartingPt)Compute a new starting point from the white noise for a given prior distribution G
ObservationSchemes.start_pt — Methodstart_pt(z, G::KnownStartingPt, P)Return starting point
ObservationSchemes.start_pt — Methodstart_pt(G::KnownStartingPt, P)Return starting point
ObservationSchemes.Λ — MethodΛ(o::LinearGsnObs)Return matrix Λ:=Σ⁻¹ from the observation scheme ν = Lx+ξ, where ξ∼N(μ,Σ)
ObservationSchemes.Σ — MethodΣ(o::LinearGsnObs)Return matrix Σ from the observation scheme ν = Lx+ξ, where ξ∼N(μ,Σ)
ObservationSchemes.μ — Methodμ(o::LinearGsnObs)Return vector μ from the observation scheme ν = Lx+ξ, where ξ∼N(μ,Σ)
ObservationSchemes.ν — Methodν(o::Observation)Return the observation