GMRFs

GMRFs.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
GMRFs.precision_mapFunction
precision_map(::AbstractGMRF)

Return the precision (inverse covariance) map of the GMRF.

source

Arithmetic

GMRFs.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
GMRFs.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
GMRFs.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

GMRFs.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

GMRFs.N_tFunction
N_t(::AbstractSpatiotemporalGMRF)

Return the number of time points in the spatiotemporal GMRF.

source
GMRFs.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
GMRFs.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
GMRFs.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
GMRFs.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

GMRFs.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
GMRFs.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