const_cost: const_cost

View source: R/RcppExports.R

const_costR Documentation

const_cost

Description

Calculate out of sample total square error cost of using mean of points to estimate other points in interval. Zero indexed.

Usage

const_cost(y, w, min_seg, i, j)

Arguments

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);

Value

scalar, const cost of [i,...,j] interval (inclusive).

Examples


const_cost(c(1, 1, 2, 2), c(1, 1, 1, 1), 1, 0, 3)


RcppDynProg documentation built on Aug. 20, 2023, 9:07 a.m.