Description Usage Arguments Details Value References Examples
View source: R/est_changepoints.R
This function estimates multiple change points using marginal likelihood method proposed by Du, Kao and Kou (2015), which we would denoted as DKK2015 afterward.
1 | est.changepoints(data.x, model, prior, max.segs, logH, logMD)
|
data.x |
Observed data in vector or matrix form. When the data is in matrix form, each column should represent a single observation. |
model |
The specified distributional assumption. Currently we have implemented two arguments: "normal" (data follows one dimensional Normal distribution with unknown mean and variance) and "poisson" (data follows Poisson distribution with unknown intensity). A third argument "user" is also accepted, given that the prior and the log marginal likelihood function are specified in the parameter prior and logMD. |
prior |
The prespecified prior parameters in
consistent with the form used in |
max.segs |
(Opt.) The maximum number of segments allowed, which is the value M in DKK2015. Must be a positive integer greater then 1. If missing, the function would process using the algorihtm by Jackson et al.(2005). |
logH |
(Opt.) A Boolean algebra determine whether to report the log H matrix in DKK2015. Default is FALSE. |
logMD |
(Opt.) The log marginal likelihood function (which
is the log of D function in DKK2015). The function must
be in the form of |
See Manual.pdf in "data" folder.
If logH
is FALSE, the function returns the set of
estimated change-points by the index of the data, where
each index is the end point of a segment. If the result
is no change-points, the function returns NULL
.
If logH
is TRUE, then the function
returns a list with three components:
changePTs
is the set of estimated change-points,
log.H
is the log value for the H matrix used in the algorithm,
where log.H(m,i) = log H(x1, x2, ..., xi | m), and max.j
records the j that maximizes the marginal likelihood in each step.
See the manual in data folder for more details.
Chao Du, Chu-Lan Michael Kao and S. C. Kou (2015), "Stepwise Signal Extraction via Marginal Likelihood". Forthcoming in Journal of American Statistical Association.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | library(StepSignalMargiLike)
n <- 5
data.x <- rnorm(n, 1, 1)
data.x <- c(data.x, rnorm(n, 10,1))
data.x <- c(data.x, rnorm(n, 2,1))
data.x <- c(data.x, rnorm(n, 10,1))
data.x <- c(data.x, rnorm(n, 1,1))
prior <- prior.norm.A(data.x)
max.segs <- 10
est.changepoints(data.x=data.x, model="normal", prior=prior)
est.changepoints(data.x=data.x, model="normal", prior=prior, max.segs=max.segs)
est.changepoints(data.x=data.x, model="normal", prior=prior, max.segs=max.segs,logH=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.