nl_turning_points: Identify turning points and inflection regions

View source: R/nl_derivatives.R

nl_turning_pointsR Documentation

Identify turning points and inflection regions

Description

From the derivative table returned by nl_derivatives, finds turning points (values of x where the first derivative crosses zero), inflection regions (intervals where the second derivative changes sign), and slope regions (contiguous stretches where the curve is increasing, decreasing, or flat).

Usage

nl_turning_points(deriv_df, x, time = NULL, tol = 1e-06)

Arguments

deriv_df

A data frame returned by nl_derivatives.

x

Character; name of the focal predictor column.

time

Optional character; name of the time column. Turning points are identified separately within each time level when supplied.

tol

Numeric tolerance for near-zero detection of d1. Default 1e-6.

Value

A named list with three elements. turning_points is a data frame with columns x, time (if applicable), fit, and type (one of "maximum", "minimum", or "saddle"). inflection_regions is a data frame with columns x_start, x_end, time, and direction ("concave_to_convex" or "convex_to_concave"). slope_regions is a data frame with columns x_start, x_end, direction, and time.

See Also

nl_derivatives, nl_plot


MultiSpline documentation built on April 16, 2026, 9:06 a.m.