PrintAlpha: calculate coefficients of each interval

Description Usage Arguments Author(s) References Examples

Description

This function is a part of DP approach. This function calculate coefficients of each interval.

Usage

1
PrintAlpha(x, y, sol)

Arguments

x

input data x

y

input data y

sol

list of change-points by DP approach

Author(s)

Bingwen Zhang

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
26
27
28
##---- 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, sol) 
{
    n <- dim(x)[1]
    p <- dim(x)[2]
    K <- length(sol)
    Alpha <- matrix(NA, K - 1, p)
    if (K == 2) {
        Alpha[i, ] <- CalcAlpha(x, y, n, p, sol[1], sol[2])
    }
    else {
        for (i in 1:(K - 1)) {
            if (i == (K - 1)) {
                Alpha[i, ] <- CalcAlpha(x, y, n, p, sol[i], sol[i + 
                  1])
            }
            else {
                Alpha[i, ] <- CalcAlpha(x, y, n, p, sol[i], sol[i + 
                  1] - 1)
            }
        }
    }
    return(Alpha)
  }

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