ocpt.plot: Plotting changes in Mean and variance. Update function.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ocpt.plot.R

Description

Plots the optimal positioning of changepoints for data using the user specified method.

Usage

1
2
3
ocpt.plot(data,type = "mean", penalty="Manual", pen.value=length(data),
Q=5, test.stat="Normal", class=TRUE, param.estimates=TRUE, shape=1,
tol = 1e-07, know.mean = FALSE, mu = NA, minseglen=2)

Arguments

data

The data that the user wants to plot.

type

The type of change the user wants the function to search for. This can be "mean", "var" or "meanvar".

penalty

Choice of "None", "SIC", "BIC", "MBIC", AIC", "Hannan-Quinn", "Asymptotic", "Manual" and "CROPS" penalties. If Manual is specified, the manual penalty is contained in the pen.value parameter. If Asymptotic is specified, the theoretical type I error is contained in the pen.value parameter. If CROPS is specified, the penalty range is contained in the pen.value parameter; note this is a vector of length 2 which contains the minimum and maximum penalty value. Note CROPS can only be used if the method is "PELT". The predefined penalties listed DO count the changepoint as a parameter, postfix a 0 e.g."SIC0" to NOT count the changepoint as a parameter.

pen.value

The theoretical type I error e.g.0.05 when using the Asymptotic penalty. A vector of length 2 (min,max) if using the CROPS penalty. The value of the penalty when using the Manual penalty option - this can be a numeric value or text giving the formula to use. Available variables are, n=length of original data, null=null likelihood, alt=alternative likelihood, tau=proposed changepoint, diffparam=difference in number of alternatve and null parameters.

Q

The maximum number of changepoints to search for using the "BinSeg" method. The maximum number of segments (number of changepoints + 1) to search for using the "SegNeigh" method.

test.stat

The assumed test statistic / distribution of the data. Currently only "Normal" and "CUSUM" supported.

class

Logical. If TRUE then an object of class cpt is returned.

param.estimates

Logical. If TRUE and class=TRUE then parameter estimates are returned. If FALSE or class=FALSE no parameter estimates are returned.

shape

Only used when cost function is the gamma likelihood.

tol

The tolerance at which model decisions are made. Only used within type="reg".

know.mean

Only required for test.stat="Normal". Logical, if TRUE then the mean is assumed known and mu is taken as its value. If FALSE, and mu=NA (default value) then the mean is estimated via maximum likelihood. If FALSE and the value of mu is supplied, mu is not estimated but is counted as an estimated parameter for decisions. Only used within type="var".

mu

Only required for test.stat="Normal". Numerical value of the true mean of the data. Either single value or vector of length nrow(data). If data is a matrix and mu is a single value, the same mean is used for each row. Only used within type="var".

minseglen

Positive integer giving the minimum segment length (no. of observations between changes), default is the minimum allowed by theory.

Details

This function is used to plot the changes in mean and variance.

Value

Plots data.

Author(s)

Andrew Connell, Rebecca Killick

References

Change in Normal mean: Hinkley, D. V. (1970) Inference About the Change-Point in a Sequence of Random Variables, Biometrika 57, 1–17

PELT Algorithm: Killick R, Fearnhead P, Eckley IA (2012) Optimal detection of changepoints with a linear computational cost, JASA 107(500), 1590–1598

MBIC: Zhang, N. R. and Siegmund, D. O. (2007) A Modified Bayes Information Criterion with Applications to the Analysis of Comparative Genomic Hybridization Data. Biometrics 63, 22-32.

See Also

ocpt.var.initialise,ocpt.mean.initialise,ocpt

Examples

1
2
3
set.seed(1)
x=c(rnorm(50,0,1),rnorm(50,15,1),rnorm(50,30,1),rnorm(50,50,1))
ocpt.plot(x, Q=5)

rkillick/changepoint.online documentation built on Sept. 26, 2020, 11:01 p.m.