Plotting onlineCPD results

Description

plot.oCPD() produces a summary plot of the results of onlineCPD(). Results are somewhat hard to interpret, see Details

Usage

1
2
## S3 method for class 'oCPD'
plot(x, lines = TRUE, title = "", leg.name = "Variable", cleanCP = TRUE, buffer = 10, ...)

Arguments

x

the result of a call to onlineCPD or offlineCPD

lines

if true, plot red vertical lines in the top plot to denote detected changepoints

title

the title of the plot

leg.name

the title of the legend. Note that the names in the legend are taken from the column names in x$data.

cleanCP

if true, the function will call findCP to remove some changepoints

buffer

The minimum number of points that need to separate two changepoints before they are both replaced

...

(optional) additional arguments, ignored.

Details

The plotted results can be difficult to interpret.

The top plot is the data plotted as a scatterplot, with each data column in a different colour. If lines == TRUE then red vertical lines will be plotted to delineate the different runs.

The bottom plot shows the algorithms results. The black smears show the probability that run length is a particular value on the y-axis at the time on the x-axis. That is, for each pair (x,y), the darkness is the probability that at time x the run length is y. If run continues, the smear continues to move diagonally up. If the run stops, the smear returns to zero on the y-axis. The red diagonal line plots the largest probability at each time. Note the log scale on Probability.

If time was not NULL in the call to offlineCPD, then time will be along the x-axis of both plots.

See findCP for information on which changepoints will be removed if cleanCP is true.

Note

Depends on ggplot2, reshape2, gridExtra and scales

Author(s)

Zachary Zanussi

See Also

print.oCPD, summary.oCPD, str.oCPD for summary results, and findCP for information on how changepoints are reduced

Examples

1
2
3
set.seed(6)
x <- c(rnorm(50,mean=0.3,sd=0.15),rnorm(40,mean=0.7,sd=0.1),rnorm(60,mean=0.5,sd=0.15))
plot(offlineCPD(x))