powered by
Calculate out of sample total square error cost of using mean of points to estimate other points in interval. Zero indexed.
const_cost(y, w, min_seg, i, j)
scalar, const cost of [i,...,j] interval (inclusive).
NumericVector, values to group in order.
NumericVector, weights.
positive integer, minimum segment size (>=1).
integer, first index (inclusive).
integer, j>=i last index (inclusive);
const_cost(c(1, 1, 2, 2), c(1, 1, 1, 1), 1, 0, 3)
Run the code above in your browser using DataLab