Learn R Programming

StepSignalMargiLike (version 2.6.0)

est.mean.norm: est.mean.norm

Description

This function estimates the posterior mean for each segments under the normal assumption with conjugate prior. The variance \(\sigma^2\) is assumed to be drawn from an inverse Gamma distribution with shape parameter \(\nu0\) and scale parameter \(\sigma0^2\), while mean is assumed to be drawn from a normal distribution with mean \(\mu0\) and variance \(\sigma^2/\kappa0\).

Usage

est.mean.norm(data.x, index.ChPT, prior)

Arguments

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 est.changepoints.

prior

Vector contatining prior parameters in the order of (\(\mu0, \kappa0, \nu0, \sigma0^2\)).

Value

Vector containing estimated mean for each segments.

Details

See Manual.pdf in "data" folder.

References

Chao Du, Chu-Lan Michael Kao and S. C. Kou (2015), "Stepwise Signal Extraction via Marginal Likelihood". Forthcoming in Journal of American Statistical Association.

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab