Wraps segmented::segmented() (Muggeo, 2003, 2008): maximum
likelihood estimation of continuous piecewise-linear
("broken-line") regressions, with standard errors and confidence
intervals for the breakpoint locations. Where the step-change engines
model jumps in the level, segmented models kinks in the trend, so
change_in is "slope" and the fitted broken line is stored in
the fitted column for autoplot(show_fit = TRUE).
Arguments
- x
A numeric vector; a linear model of
xon time1:length(x)is segmented.- npsi
Number of breakpoints to estimate. Defaults to
1.- conf_level
Confidence level for breakpoint intervals. Defaults to
0.95.- seed
Optional seed (the estimator uses bootstrap restarting).
- ...
Additional arguments passed to
segmented::segmented().
Value
A ggcpt object with ci_lower/ci_upper columns
and the fitted broken line in $data$fitted. Breakpoints are
rounded to the nearest index; for a continuous fit the reported location
is the kink itself.

