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)
NumericVector, x-coords of values to group.
NumericVector, values to group in order.
NumericVector, weights.
positive integer, minimum segment size (>=1).
integer, first index (inclusive).
integer, j>=i last index (inclusive);
scalar, linear cost of [i,...,j] interval (inclusive).