is_in_tolerance: Is value within tolerance?

View source: R/NAME_is_in_tolerance.R

is_in_toleranceR Documentation

Is value within tolerance?

Description

Computes if a value is within a tolerance region. Both an absolute tolerance and a relative tolerance are considered. If at least one of both criteria are met, the fuction returns TRUE, otherwise FALSE.

Usage

is_in_tolerance(asis, tobe, tol_rel, tol_abs)

Arguments

asis

as-is value (num), the observed value

tobe

to-be value (num), the target value

tol_rel

relative tolerance (as a proportion, num)

tol_abs

absolute tolerance (num)

Details

In regression models, it can be useful to set the absolute tolerance to 5 In addition, when the solution value tends to zero, the relative tolerance becomes very small, so an abolute tolerance value is needed.

The size of the relative tolerance may depend on a number of factors. Notably, in STAN regression models, it is difficult to devise a cutoff value. Some tests showed that 5-10

However, when the solution is a proportion (such as for R squared), absolute tolerance must not be set to a fraction of the SD of the outcome variable. Instead, a cutoff value of .05 appears safe.

Value

in_tolerenace, lgl

Examples

is_in_tolerance(asis = 39.5, tobe = 42, tol_rel = .05, tol_abs = 2.5)

sebastiansauer/prada documentation built on Jan. 18, 2025, 2:48 p.m.