GMRFs

GaussianMarkovRandomFields.GMRFType
GMRF{T}(mean, precision, solver_ref)

A Gaussian Markov Random Field with mean mean and precision matrix precision. Carries a reference to a solver for the GMRF quantities.

source

Arithmetic

GaussianMarkovRandomFields.condition_on_observationsFunction

" conditiononobservations( x::AbstractGMRF, A::Union{AbstractMatrix,LinearMap}, Qϵ::Union{AbstractMatrix,LinearMap,Real}, y::AbstractVector=spzeros(size(A)[1]), b::AbstractVector=spzeros(size(A)[1]); solverblueprint::AbstractSolverBlueprint=CholeskySolverBlueprint() )

Condition a GMRF x on observations y = A * x + b + ϵ where ϵ ~ N(0, Q_ϵ⁻¹).

Arguments

  • x::AbstractGMRF: The GMRF to condition on.
  • A::Union{AbstractMatrix,LinearMap}: The matrix A.
  • Q_ϵ::Union{AbstractMatrix,LinearMap, Real}: The precision matrix of the noise term ϵ. In case a real number is provided, it is interpreted as a scalar multiple of the identity matrix.
  • y::AbstractVector=spzeros(size(A)[1]): The observations y; optional.
  • b::AbstractVector=spzeros(size(A)[1]): Offset vector b; optional.

Keyword arguments

  • solver_blueprint::AbstractSolverBlueprint=CholeskySolverBlueprint(): The solver blueprint; optional.

Returns

A LinearConditionalGMRF object representing the conditional GMRF x | (y = A * x + b + ϵ).

source
GaussianMarkovRandomFields.LinearConditionalGMRFType
LinearConditionalGMRF{G}(
    prior::G,
    A::Union{AbstractMatrix,LinearMap},
    Q_ϵ::Union{AbstractMatrix,LinearMap},
    y::AbstractVector,
    b::AbstractVector=spzeros(size(A, 1)),
    solver_blueprint::AbstractSolverBlueprint=DefaultSolverBlueprint(),
) where {G<:AbstractGMRF}

A GMRF conditioned on observations y = A * x + b + ϵ where ϵ ~ N(0, Q_ϵ).

Arguments

  • prior::G: The prior GMRF.
  • A::Union{AbstractMatrix,LinearMap}: The matrix A.
  • Q_ϵ::Union{AbstractMatrix,LinearMap}: The precision matrix of the noise term ϵ.
  • y::AbstractVector=spzeros(size(A, 1)): The observations y.
  • b::AbstractVector=spzeros(size(A, 1)): The offset vector b.
  • solver_blueprint::AbstractSolverBlueprint=DefaultSolverBlueprint(): The solver blueprint.
source
GaussianMarkovRandomFields.joint_gmrfFunction

" jointgmrf( x1::AbstractGMRF, A::AbstractMatrix, Qϵ::AbstractMatrix, b::AbstractVector=spzeros(size(A)[1]) )

Return the joint GMRF of x1 and x2 = A * x1 + b + ϵ where ϵ ~ N(0, Q_ϵ⁻¹).

Arguments

  • x1::AbstractGMRF: The first GMRF.
  • A::AbstractMatrix: The matrix A.
  • Q_ϵ::AbstractMatrix: The precision matrix of the noise term ϵ.
  • b::AbstractVector=spzeros(size(A)[1]): Offset vector b; optional.

Returns

A GMRF object representing the joint GMRF of x1 and x2 = A * x1 + b + ϵ.

source

Spatiotemporal setting

Types

GaussianMarkovRandomFields.AbstractSpatiotemporalGMRFType
AbstractSpatiotemporalGMRF

A spatiotemporal GMRF is a GMRF that explicitly encodes the spatial and temporal structure of the underlying random field. All time points are modelled in one joint GMRF. It provides utilities to get statistics, draw samples and get the spatial discretization at a given time.

source

Quantities

GaussianMarkovRandomFields.time_meansFunction
time_means(::AbstractSpatiotemporalGMRF)

Return the means of the spatiotemporal GMRF at each time point.

Returns

  • A vector of means of length Nₜ, one for each time point.
source
GaussianMarkovRandomFields.time_varsFunction
time_vars(::AbstractSpatiotemporalGMRF)

Return the marginal variances of the spatiotemporal GMRF at each time point.

Returns

  • A vector of marginal variances of length Nₜ, one for each time point.
source
GaussianMarkovRandomFields.time_stdsFunction
time_stds(::AbstractSpatiotemporalGMRF)

Return the marginal standard deviations of the spatiotemporal GMRF at each time point.

Returns

  • A vector of marginal standard deviations of length Nₜ, one for each time point.
source
GaussianMarkovRandomFields.time_randsFunction
time_rands(::AbstractSpatiotemporalGMRF, rng::AbstractRNG)

Draw samples from the spatiotemporal GMRF at each time point.

Returns

  • A vector of sample values of length Nₜ, one sample value vector for each time point.
source

Utilities

GaussianMarkovRandomFields.spatial_to_spatiotemporalFunction
spatial_to_spatiotemporal(
    spatial_matrix::AbstractMatrix,
    t_idx::Int,
    N_t::Int,
)

Make a spatial matrix applicable to a spatiotemporal system at time index t_idx. Results in a matrix that selects the spatial information exactly at time t_idx.

Arguments

  • spatial_matrix::AbstractMatrix: The spatial matrix.
  • t_idx::Integer: The time index.
  • N_t::Integer: The number of time points.
source
GaussianMarkovRandomFields.kronecker_product_spatiotemporal_modelFunction
kronecker_product_spatiotemporal_model(
    Q_t::AbstractMatrix,
    Q_s::AbstractMatrix,
    spatial_disc::FEMDiscretization;
    solver_blueprint = DefaultSolverBlueprint(),
)

Create a spatiotemporal GMRF through a Kronecker product of the temporal and spatial precision matrices.

Arguments

  • Q_t::AbstractMatrix: The temporal precision matrix.
  • Q_s::AbstractMatrix: The spatial precision matrix.
  • spatial_disc::FEMDiscretization: The spatial discretization.

Keyword arguments

  • solver_blueprint::AbstractSolverBlueprint=DefaultSolverBlueprint(): The solver blueprint.
source