Calculate cost of using linear model fit on points to estimate other points in the interval. Zero indexed.
lin_cost(x, y, w, min_seg, i, j)
| x | NumericVector, x-coords of values to group. |
|---|---|
| y | NumericVector, values to group in order. |
| w | NumericVector, weights. |
| min_seg | positive integer, minimum segment size (>=1). |
| i | integer, first index (inclusive). |
| j | integer, j>=i last index (inclusive); |
scalar, linear cost of [i,...,j] interval (inclusive).
#> [1] 6.576132