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 |
checkinverse |
Default |
translist |
A list. Will be checked, passed to |
Details
This function checks that:
The supplied object contains elements
totheta
,fromtheta
, andjacobian
, and that they are all functions,If
checkinverse
is a vector of numbers, then it checks thattotheta(fromtheta(checkinverse)) == checkinverse
.
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)