constrained_adjacency_covariance_function: Construct a constrained covariance matrix from the adjacency...

Description Usage Arguments Value See Also Examples

View source: R/constrained_covariance_functions.R

Description

This function constructs a covariance function from the graph's adjacency matrix. The covariance function may be squared exponential, rational quadratic, Matern or the matrix exponential. It includes a constraint, where a linear combination of the parameters can be fixed.

Usage

1
2
3
4
5
6
7
constrained_adjacency_covariance_function(
  adj.matrix,
  type,
  hyperparameters,
  linear.combination,
  linear.constraint = 0
)

Arguments

adj.matrix

The graph adjacency matrix

type

The type of covariance function used. One of "sqexp", "ratquad", "matern" or "matrix". 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

1
2
3
4
5
#Construct covariance matrix of Dar es Salaam, Tanzania, using network metric
data(dar.adj.matrix, package = "BSBT") #load dar es salaam adjacency matrix
k <- constrained_adjacency_covariance_function(dar.adj.matrix, type = "sqexp",
       hyperparameters = c(1, 1), rep(1, dim(dar.adj.matrix)[1]), 0)
       #Covariance registetred by sum of subwards is 0 using rational quadratic function

BSBT documentation built on March 15, 2021, 1:07 a.m.