optimal_span: Calculates the optimal span for a loess spline

View source: R/optimal_span.r

optimal_spanR Documentation

Calculates the optimal span for a loess spline

Description

The optimal span is calculated based upon the bayesian information criterion (BIC).

Usage

optimal_span(
  y,
  x = NULL,
  weights = NULL,
  step = 0.01,
  label = NULL,
  plot = FALSE
)

Arguments

y

a vector with measurement values to smooth

x

a vector with dates / time steps

weights

optional values to weigh the loess fit with

step

span increment size

label

title to be used when plotting function output

plot

plot visual output of the optimization routine

Value

Returns an optimal span to smooth a provided vector using the 'loess()' smoother.

Examples


## Not run: 
# Internal function only, should not be used stand-alone.
l <- sin(seq(1,10,0.01))
l <- l + runif(length(l))
optimal_span(l, plot = TRUE)

## End(Not run)

bluegreen-labs/phenocamr documentation built on Feb. 6, 2024, 10:42 p.m.