% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nl_derivatives.R
\name{nl_turning_points}
\alias{nl_turning_points}
\title{Identify turning points and inflection regions}
\usage{
nl_turning_points(deriv_df, x, time = NULL, tol = 1e-06)
}
\arguments{
\item{deriv_df}{A data frame returned by \code{\link{nl_derivatives}}.}

\item{x}{Character; name of the focal predictor column.}

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

\item{tol}{Numeric tolerance for near-zero detection of d1. Default
\code{1e-6}.}
}
\value{
A named list with three elements.
\code{turning_points} is a data frame with columns \code{x},
\code{time} (if applicable), \code{fit}, and \code{type}
(one of \code{"maximum"}, \code{"minimum"}, or \code{"saddle"}).
\code{inflection_regions} is a data frame with columns
\code{x_start}, \code{x_end}, \code{time}, and \code{direction}
(\code{"concave_to_convex"} or \code{"convex_to_concave"}).
\code{slope_regions} is a data frame with columns \code{x_start},
\code{x_end}, \code{direction}, and \code{time}.
}
\description{
From the derivative table returned by \code{\link{nl_derivatives}}, finds
turning points (values of \code{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).
}
\seealso{
\code{\link{nl_derivatives}}, \code{\link{nl_plot}}
}
