factory-covDiag: Diagnostics For Arbitrary Covariance Functions

factory-covDiagR Documentation

Diagnostics For Arbitrary Covariance Functions

Description

A suite of diagnostic tools. The functions described here provide the user with quick access to diagnostics for arbitrary target covariance functions and arbitrary reference covariance functions.

Usage

covDiagFactory(target_covariance,
  diagnostic_funs = c("accumulated_error", "point_diagnostics"),
  reference_covariance = cov.askey, reference_cov.args = list())

accumulated_error(target_covFun, target_cov.theta, reference_covFun,
  reference_cov.theta, ..., absolute = TRUE, lower = 0, upper = 1,
  subdivisions = 500L, abs.tol = .Machine$double.eps^0.5,
  rel.tol = .Machine$double.eps^0.25)

point_diagnostics(target_covFun, target_cov.theta, reference_covFun,
  reference_cov.theta, ..., grid_resolution = 100)

Arguments

diagnostic_funs

A character vector for specifying which diagnostics to compute and return. Currently, accumulated_error and point_diagnostics are implemented. Note that the functions themselves are not intended to be called directly by the user.

reference_covariance

Covariance function with formals function(h, theta, ..., cov.args)

reference_covFun

Same as reference_covariance, but implicitly assumes that the input was generated using covarianceFactory().

reference_cov.args

List with additional arguments to be passed to reference_covariance.

reference_cov.theta

Numeric vector containing parameters for reference_covariance.

target_covariance

Covariance function with formals function(h, theta, ..., cov.args)

target_cov.theta

Numeric vector containing parameters for target_covariance.

target_covFun

Same as target_covariance, but implicitly assumes that the input was generated using covarianceFactory().

...

Other arguments

grid_resolution

Number of points n to evaluate the covariance function at.

absolute

Logical value. Whether to return absolute value.

lower

Lower boundary for accumulated error. Defaults to 0. Passed to integrate().

upper

Upper boundary for accumulated error. Defaults to 1. Passed to integrate().

subdivisions

The maximum number of subintervals. Passed to integrate().

abs.tol

Absolute accuracy. Passed to integrate()

rel.tol

Relative accuracy. Passed to integrate()

Details

The function manufactured by covDiagFactory has the form function(target_theta_list, target_args_list = list(), reference_cov.theta = NULL, ...) and serves to iterate over a large variety of parameters.

target_theta_list

List of named numeric vectors, each providing at least one or more values for a parameter.

target_args_list (default = list())

List of named vectors, each providing at least one or more values for each argument to be provided to target_covariance.

reference_cov.theta (default = NULL)

A numeric vector with parameters for the reference covariance. This is primarily intended to use when comparing different covariance functions, in which case the target covariance is compared to the reference with constant parameters.If this argument is left at default and the target and reference are identical, the parameters in target_theta_list will be used by both. Otherwise this will raise an exception.

Value

covDiagFactory() is a function factory which generates a function for computing diagnostics across a large variety of parameter values and additional arguments. The manufactured function has the form function(target_theta_list, target_args_list = list(), reference_cov.theta = NULL, ... and returns a list of the same length as diagnostic_funs, each entry storing a data.frame with the results returned by the associated diagnostic function.

Available diagnostic functions

All diagnostic functions have in common that, apart from the required parameters kappa and mu, any remaining parameters are optional and captured using the ... operator. Any unspecified arguments are left at default. The provided arguments are then turned into a grid using expand.grid, which is then iterated over to compute the requested diagnostic metrics. Note that there are some built-in checks which ensure that invalid configurations are dropped from the grid. For example, rows with interpolator = 'none' and a non-zero number of supports are dropped to prevent redundant computations.

Accumulated Error

The accumulated error corresponds to the area between the approximated and exact covariance curve.

Point diagnostics

This option returns error metrics across a user-defined number of points on the interval [0,1]. The metrics returned are "error", "absolute error", "maximum error", "target covariance value", and "reference covariance value".

Author(s)

Thomas Caspar Fischer

See Also

cov.wendland

Examples


interpolators <- c("linear", "cspline", "polynomial")
diagnostics <- c("accumulated_error", "point_diagnostics")

diagnosticFun <- covDiagFactory(cov.wendland, diagnostic_funs = diagnostics,
  reference_covariance = cov.wendland)
target_theta_list <- list(range = 0.5, sill = 1, kappa = c(0, 0.5, 1), mu = 0,
  nugget = 0)
target_args_list <- list(interp.method = interpolators, interp.num_support = 25)
wendland_comparison <- diagnosticFun(target_theta_list = target_theta_list,
  target_args_list = target_args_list)

diagnosticFun <- covDiagFactory(cov.wendland, diagnostic_funs = diagnostics,
  reference_covariance = cov.askey)
target_theta_list <- list(range = 0.5, sill = 1, kappa = 0, mu = 0.5, nugget = 0)
target_args_list <- list(interp.method = interpolators, interp.num_support = 25)
askey_comparison <- diagnosticFun(target_theta_list = target_theta_list,
  target_args_list = target_args_list, reference_cov.theta = c(0.5, 1, 0.5, 0))

GeneralizedWendland documentation built on June 22, 2022, 9:06 a.m.