constrained_covariance_function {BSBT}R Documentation

Construct a constrained covariance matrix from the Euclidean coordinates of the objects

Description

This function constructs a covariance function from the Euclidean coordinates of the objects. The covariance function may be squared exponential, rational quadratic or Matern. It includes a constraint, where a linear combination of the parameters can be fixed.

Usage

constrained_covariance_function(
  coordinates,
  type,
  hyperparameters,
  linear.combination,
  linear.constraint = 0
)

Arguments

coordinates

An Nx2 matrix containing the Euclidean coordinates of the nodes.

type

The type of covariance function used. One of "sqexp", "ratquad" or "matern". Note: only matern with nu = 5/2 is supported.

hyperparameters

A vector containing the covariance function hyperparameters. For the squared exponential and matern, the vector should contain the variance and length scale, for the rational quadratic, the vector should contain the variance, length scale and scaling parameters

linear.combination

A matrix which defines the linear combination of the parameter vector lambda = (lambda_1, ..., lambda_N)^T. The linear combination is a vector of coefficients such that linear.combination %*% lambda = linear.constraint.

linear.constraint

The value the linear constraint takes. Defaults to 0.

Value

The mean vector and covariance matrix

See Also

For more information about covariance functions see https://www.cs.toronto.edu/~duvenaud/cookbook/ or http://www.gaussianprocess.org/gpml/chapters/RW4.pdf

Examples

#Generate 10 points and create covariance matrix using Euclidean distance metric
coords <- data.frame("x" = c(0, 1, 2), "y" = c(0, 1, 2)) #generate coordinates
#create covariance matrix using Squared Exponential function and subject to the constraint
#the sum of the deprivation levels is 0.
k <- constrained_covariance_function(coords, "sqexp",
c(1, 5), rep(1, 3), linear.constraint = 0)

[Package BSBT version 1.1.0 Index]