getOptimalCost: Get optimal cost for new segment

Description Usage Arguments Value Examples

View source: R/dynprog.R

Description

Get optimal cost for new segment

Usage

1
getOptimalCost(qVec, sVec, start, end)

Arguments

qVec

Sum of squares up to the end of the data

sVec

Sum of the data

start

Beginning index

end

Ending index

Value

A vector of optimal costs

Examples

1
2
3
4
testVec <- 1:30
qVec <- cumsum(testVec^2)
sVec <- cumsum(testVec)
cost <- getOptimalCost(qVec, sVec, 1, 4)

alyssajs/segmentationPackage documentation built on Dec. 31, 2020, 7:44 p.m.