Description Usage Arguments Author(s) References Examples
This function is a part of DP approach. This fucntion computes change-points using DP approach.
1 |
x |
input data x |
y |
input data y |
n |
total number of data |
p |
dimension of data |
Kstar |
given number of change-points |
c |
cost matrix c |
Bingwen
Bingwen Zhang, Jun Geng and Lifeng Lai, Detecting changes in regression models via sparse group lasso, http://users.wpi.edu/~bzhang/icassp_v1.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, y, n, p, Kstar, c)
{
result <- DPCalc(x, y, n, p, Kstar, c)
r <- result$r
s <- result$s
K <- Kstar + 1
sol <- vector()
sol <- append(sol, n)
while (K > 0) {
sol <- append(sol, s[K, n])
n <- s[K, n]
K <- K - 1
}
sol2 <- vector()
len <- length(sol)
for (i in len:1) {
sol2 <- append(sol2, sol[i])
}
return(sol2)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.