zero_crossings {modelbased}R Documentation

Find zero-crossings and inversion points

Description

Find zero crossings of a vector, i.e., indices when the numeric variable crosses 0. It is useful for finding the points where a function changes by looking at the zero crossings of its derivative.

Usage

zero_crossings(x)

find_inversions(x)

Arguments

x

A numeric vector.

Value

Vector of zero crossings or points of inversion.

See Also

Based on the uniroot.all function from the rootSolve package.

Examples

x <- sin(seq(0, 4 * pi, length.out = 100))
# plot(x, type = "b")

modelbased::zero_crossings(x)
modelbased::find_inversions(x)

[Package modelbased version 0.12.0 Index]