validate_transformation {aghq}R Documentation

Validate a transformation object

Description

Routine for checking whether a given transformation is valid.

Usage

validate_transformation(...)

## S3 method for class 'aghqtrans'
validate_transformation(trans, checkinverse = FALSE, ...)

## S3 method for class 'list'
validate_transformation(translist, checkinverse = FALSE, ...)

## Default S3 method:
validate_transformation(...)

Arguments

...

Used to pass arguments to methods.

trans

A transformation object of class aghqtrans returned by make_transformation.

checkinverse

Default FALSE, do not check that totheta(fromtheta(theta)) = theta. Otherwise, a vector of values for which to perform that check. No default values are provided, since validate_transformation has no way of determining the domain and range of totheta and fromtheta. This argument is used internally in aghq package functions, with cleverly chosen check values.

translist

A list. Will be checked, passed to aghqtrans, and then checked again.

Details

This function checks that:

In addition, if a list is provided, the function first checks that it contains the right elements, then passes it to make_transformation, then checks that.

This function throws an informative error messages when checks don't pass or themselves throw errors.

Value

TRUE if the function runs to completion without throwing an error.

See Also

Other transformations: default_transformation(), make_transformation()

Examples


t <- make_transformation(log,exp)
validate_transformation(t)
t2 <- list(totheta = log,fromtheta = exp)
validate_transformation(t2)
## Not run: 
t3 <- make_transformation(log,log)
checkvals <- exp(exp(rnorm(10)))
# Should throw an informative error because log isn't the inverse of log.
validate_transformation(t3,checkinverse = checkvals)

## End(Not run)

[Package aghq version 0.4.1 Index]