Description Usage Arguments Details Value References Examples
View source: R/est_mean_norm.R
This function estimates the posterior mean for each segments under the normal assumption with conjugate prior. The variance σ^2 is assumed to be drawn from an inverse Gamma distribution with shape parameter ν0 and scale parameter σ0^2, while mean is assumed to be drawn from a normal distribution with mean μ0 and variance σ^2/κ0.
1 | est.mean.norm(data.x, index.ChPT, prior)
|
data.x |
Observed data in vector form where each element represents a single observation. |
index.ChPT |
The set of the index of change points
in a vector. Must be in accending order. This could be
obtained by |
prior |
Vector contatining prior parameters in the order of (μ0, κ0, ν0, σ0^2). |
See Manual.pdf in "data" folder.
Vector containing estimated mean for each segments.
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 | 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)
index.ChPT <- c(n,2*n,3*n,4*n)
est.mean.norm(data.x, index.ChPT, prior)
|
[1] 1.123217 9.406438 2.612413 9.549323 1.581905
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.