Skip to contents

generates a block diagonal error covariance matrix with exponential decay

Usage

forecastError.cov(
  layers,
  variableCovarianceFunction,
  forecastError.cov.sdBackground,
  forecastError.cor.length,
  neighbourhood.Bayes,
  compartmentsReported = 2
)

Arguments

layers

The SpatRaster object with SVEIRD compartment layers, and a layer classifying habitation. Created with the getSVEIRD.SpatRaster function.

variableCovarianceFunction

a covariance function used to determine the covariance between two variables.

forecastError.cov.sdBackground

The "background" standard deviation of the covariances of the forecast covariance error matrix.

forecastError.cor.length

"correlation length (i.e. the average size of the fluctuations)," as stated by J. Murray on the Physics StackExchange, https://physics.stackexchange.com/a/671317.

neighbourhood.Bayes

an exclusive lower limit of values allowed in the final matrix; values less than or equal to this limit within the forecast error covariance matrix are changed to values taken from the variable covariance function.

compartmentsReported

either 1 or 2. Previously identified as states_observable, this is the count of compartments that are reported on and which will have data assimilated; if it is 2, the matrix is a block diagonal matrix.

Value

a matrix with the covariances of the observations in each cell of the input layers object.

Author

Bryce Carson

Ashok Krishnmaurthy

Michael Myer

Thomas White

Examples

subregionsSpatVector <- terra::vect(
  system.file(
    "extdata",
    ## COD: Nord-Kivu and Ituri (Democratic Republic of Congo)
    "subregionsSpatVector",
    package = "spatialEpisim.foundation",
    mustWork = TRUE
  )
)
susceptibleSpatRaster <- terra::rast(
  system.file(
    "extdata",
    "susceptibleSpatRaster.tif", # Congo population
    package = "spatialEpisim.foundation",
    mustWork = TRUE
  )
)
layers <- getSVEIRD.SpatRaster(subregionsSpatVector,
                               susceptibleSpatRaster,
                               aggregationFactor = 10)
Ituri.forecastError.cov <- forecastError.cov(layers,
                                             variableCovarianceFunction = "DBD",
                                             forecastError.cov.sdBackground = 2,
                                             forecastError.cor.length = 0.8,
                                             neighbourhood = 1,
                                             compartmentsReported = 2)