# omxCheckCloseEnough: Approximate Equality Testing Function In OpenMx: Extended Structural Equation Modelling

## Description

This function tests whether two numeric vectors or matrixes are approximately equal to one another, within a specified threshold.

## Usage

 `1` ```omxCheckCloseEnough(a, b, epsilon = 10^(-15), na.action = na.fail) ```

## Arguments

 `a` a numeric vector or matrix `b` a numeric vector or matrix `epsilon` a non-negative tolerance threshold `na.action` either na.fail (default) or na.pass. Use of na.omit or na.exclude is not recommended.

## Details

Arguments ‘a’ and ‘b’ must be of the same type, ie. they must be either vectors of equal dimension or matrices of equal dimension. The two arguments are compared element-wise for approximate equality. If the absolute value of the difference of any two values is greater than the threshold, then an error will be thrown. If ‘a’ and ‘b’ are approximately equal to each other, by default the function will print a statement informing the user the test has passed. To turn off these print statements use `options("mxPrintUnitTests" = FALSE)`.

When na.action is set to na.pass, a and b are expected to have identical missingness patterns.

## References

The OpenMx User's guide can be found at http://openmx.ssri.psu.edu/documentation.

`omxCheckWithinPercentError`, `omxCheckIdentical`, `omxCheckSetEquals`, `omxCheckTrue`, `omxCheckEquals`

## Examples

 ```1 2 3 4``` ```omxCheckCloseEnough(c(1, 2, 3), c(1.1, 1.9 ,3.0), epsilon = 0.5) omxCheckCloseEnough(matrix(3, 3, 3), matrix(4, 3, 3), epsilon = 2) # Throws an error try(omxCheckCloseEnough(c(1, 2, 3), c(1.1, 1.9 ,3.0), epsilon = 0.01)) ```

OpenMx documentation built on May 12, 2018, 1:04 a.m.