View source: R/NAME_is_in_tolerance.R
is_in_tolerance | R Documentation |
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.
is_in_tolerance(asis, tobe, tol_rel, tol_abs)
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) |
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.
in_tolerenace, lgl
is_in_tolerance(asis = 39.5, tobe = 42, tol_rel = .05, tol_abs = 2.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.