PlotChangePoints {StepSignalMargiLike}R Documentation

PlotChangePoints

Description

This function plots the data and the estimated stepwise signal given the estimated change points and means. The function only applies to one dimensional data.

Usage

PlotChangePoints(data.x, data.t, index.ChPT, est.mean, type.data, col.data,
  col.est, main.plot, sub.plot, xlab.plot, ylab.plot)

Arguments

data.x

Observed data in vector form where each element represents a single observation.

data.t

The one-dimensional time or seqeuential labeling for the data.

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.

est.mean

The estimated mean in each segments in a vector. The length must be one plus the length of index.ChPT.
For normal and Poisson cases as in DKK2013, apply est.mean.norm and est.mean.pois respectively.

type.data

(Opt.) The line type for the data. Options are the same as in plot() argument. Default is "l".

col.data

(Opt.) The line color for the data. Options are the same as in plot() argument. Default is "red".

col.est

(Opt.) The line color for the estimated stepwise signal. Options are the same as in plot() arguent. Default is "blue".

main.plot

(Opt.) The overall title used in the plot, which is like the main in plot(). Default is NULL.

sub.plot

(Opt.) The sub title used in the plot, which is like the main in plot(). Default is NULL.

xlab.plot

(Opt.) The title for the x axis used in the plot, which is like the main in plot(). Default is "data.t".

ylab.plot

(Opt.) The title for the y axis used in the plot, which is like the main in plot(). Default is "data.x".

Details

See Manual.pdf in "data" folder.

Value

Plot for the data and the estimated change-points. Note that this function only apply to one-dimensional observation.

Examples

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))
data.x <- matrix(data.x, 1)
data.t <- 1:(5*n)

index.ChPT <- c(n,2*n,3*n,4*n)
est.mean <- c(1,10,2,10,2)
PlotChangePoints(data.x, data.t, index.ChPT, est.mean)

PlotChangePoints(data.x, data.t, index.ChPT, est.mean, type.data="p",
  col.data="green", col.est="black", main="Stepwise Signal Estimation",
  sub="Using Marginal Likelihood", xlab="time", ylab="value")

[Package StepSignalMargiLike version 2.6.0 Index]