has_converged: Is the relative error between two numbers is less than the...

View source: R/utility_functions.R

has_convergedR Documentation

Is the relative error between two numbers is less than the given tolerance?

Description

Given two consecutive numbers in a sequence, return TRUE if the relative change is positive but less than the given tolerance.

Usage

has_converged(current, previous, tol = 0.01)

Arguments

current

A scalar; the most recent value of the sequence.

previous

A scalar; the second most recent value of the sequence, or a reference value.

tol

The tolerance, a positive scalar near zero.


scanstatistics documentation built on Feb. 16, 2023, 10:32 p.m.