R: Class "cpt"

cpt-class {changepoint} | R Documentation

## Class "cpt"

### Description

A class for changepoint objects.

### Objects from the Class

Objects can be created by calls of the form `new("cpt", ...)`.

`new("cpt", ...)`:

  creates a new object with class cpt

### Slots

`data.set`:

  Object of class `"ts"`, a coerced time series of the original data.

`cpttype`:

  Object of class `"character"`, the type of changepoint that was identified.

`method`:

  Object of class `"character"`, the method that was used to search for changepoints.

`test.stat`:

  Object of class `"character"`, the test statistic for the analysis of the data.

`pen.type`:

  Object of class `"character"`, the penalty type specified in the analysis.

`pen.value`:

  Object of class `"numeric"`, the value of the penalty used in the analysis.

`minseglen`:

  Object of class `"numeric"`, the minimum segment length (no. of observations between changepoints) used in the analysis.

`cpts`:

  Object of class `"numeric"`, vector of changepoints identified.

`ncpts.max`:

  Object of class `"numeric"`, maximum number of changepoint that can be identified.

`param.est`:

  Object of class `"list"`, list where each element is a vector of parameter estimates, if requested.

`date`:

  Object of class `"character"`, date and time the changepoint analysis was run.

`version`:

  Object of class `"character"`, version number of the package used when the analysis was run.

### Methods

cpts

  `signature(object = "cpt")`: retrieves cpts slot

cpttype

  `signature(object = "cpt")`: retrieves cpttype slot

data.set

  `signature(object = "cpt")`: retrieves vector version of data.set slot

data.set.ts

  `signature(object = "cpt")`: retrieves time series version of data.set slot

test.stat

  `signature(object = "cpt")`: retrieves test.stat slot

ncpts.max

  `signature(object = "cpt")`: retrieves ncpts.max slot

method

  `signature(object = "cpt")`: retrieves method slot

minseglen

  `signature(object = "cpt")`: retrieves minseglen slot

param.est

  `signature(object = "cpt")`: retrieves param.est slot

pen.type

  `signature(object = "cpt")`: retrieves pen.type slot

pen.value

  `signature(object = "cpt")`: retrieves pen.value slot

cpts<-

  `signature(object = "cpt")`: replaces cpts slot

cpttype<-

  `signature(object = "cpt")`: replaces cpttype slot

data.set<-

  `signature(object = "cpt")`: replaces data.set slot

test.stat<-

  `signature(object = "cpt")`: replaces test.stat slot

ncpts.max<-

  `signature(object = "cpt")`: replaces ncpts.max slot

method<-

  `signature(object = "cpt")`: replaces method slot

minseglen<-

  `signature(object = "cpt")`: replaces minseglen slot

param.est<-

  `signature(object = "cpt")`: replaces param.est slot

pen.type<-

  `signature(object = "cpt")`: replaces pen.type slot

pen.value<-

  `signature(object = "cpt")`: replaces pen.value slot

print

  `signature(object = "cpt")`: prints details of the cpt object including summary

summary

  `signature(object = "cpt")`: prints a summary of the cpt object

plot

  `signature(object = "cpt")`: plots the cpt object with changepoints highlighted

param

  `signature(object = "cpt")`: calculates the parameter estimates for the cpt object

logLik

  `signature(object = "cpt")`: returns the overall log-likelihood of the cpt object

### Author(s)

Rebecca Killick

### See Also

`data.set-methods`,`cpts-methods`,`cpt.reg`,`cpt.mean`,`cpt.var`,`cpt.meanvar`

### Examples

    showClass("cpt") # shows the structure of the cpt class

    x=new("cpt") # creates a new object with the cpt class defaults
    cpts(x) # retrieves the cpts slot from x
    cpts(x)<-c(10,50,100) # replaces the cpts slot from x with c(10,50,100)

    # Example of a change in variance at 100 in simulated normal data
    set.seed(1)
    x=c(rnorm(100,0,1),rnorm(100,0,10))
    ans=cpt.var(x)
    print(ans) # prints details of the analysis including a summary
    summary(ans)
    plot(ans) # plots the data with change (vertical line) at 100
    logLik(ans) # raw likelihood of the data with changepoints, second value is likelihood + penalty

[Package changepoint version 2.2.2 Index]