Built matrix of total out of sample interval square error costs for held-out means. One indexed.
const_costs(y, w, min_seg, indices)
y | NumericVector, values to group in order. |
---|---|
w | NumericVector, weights. |
min_seg | positive integer, minimum segment size (>=1). |
indices | IntegerVector, order list of indices to pair. |
xcosts NumericMatix, for j>=i xcosts(i,j) is the cost of partition element [i,...,j] (inclusive).
#> [,1] [,2] [,3] [,4] #> [1,] 1.797693e+308 0.000000e+00 1.500000e+00 1.777778e+00 #> [2,] 0.000000e+00 1.797693e+308 2.000000e+00 1.500000e+00 #> [3,] 1.500000e+00 2.000000e+00 1.797693e+308 0.000000e+00 #> [4,] 1.777778e+00 1.500000e+00 0.000000e+00 1.797693e+308