DPSol: Compute change-points using DP approach.

Description Usage Arguments Author(s) References Examples

Description

This function is a part of DP approach. This fucntion computes change-points using DP approach.

Usage

1
DPSol(x, y, n, p, Kstar, c)

Arguments

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

Author(s)

Bingwen

References

Bingwen Zhang, Jun Geng and Lifeng Lai, Detecting changes in regression models via sparse group lasso, http://users.wpi.edu/~bzhang/icassp_v1.pdf

Examples

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

boris109able/ChangePointCalc documentation built on May 13, 2019, 12:34 a.m.