The optimal span is calculated based upon the bayesian information criterion (BIC).
optimal_span(
y,
x = NULL,
weights = NULL,
step = 0.01,
label = NULL,
plot = FALSE
)
a vector with measurement values to smooth
a vector with dates / time steps
optional values to weigh the loess fit with
span increment size
title to be used when plotting function output
plot visual output of the optimization routine
Returns an optimal span to smooth a provided vector using the `loess()` smoother.