Description Usage Arguments Author(s) References Examples
This function is a part of DP approach. This function calculate coefficients of each interval.
1 | PrintAlpha(x, y, sol)
|
x |
input data x |
y |
input data y |
sol |
list of change-points by DP approach |
Bingwen Zhang
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 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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.