Learn R Programming

tidychangepoint (version 1.0.0)

new_mod_cpt: Base class for changepoint models

Description

Create changepoint detection model objects

Usage

new_mod_cpt(
  x = numeric(),
  tau = integer(),
  region_params = tibble::tibble(),
  model_params = double(),
  fitted_values = double(),
  model_name = character(),
  ...
)

validate_mod_cpt(x)

mod_cpt(x, ...)

Value

A mod_cpt object

Arguments

x

a numeric vector coercible into a ts object

tau

indices of the changepoint set

region_params

A tibble::tibble() with one row for each region defined by the changepoint set tau. Each variable represents a parameter estimated in that region.

model_params

A numeric vector of parameters estimated by the model across the entire data set (not just in each region).

fitted_values

Fitted values returned by the model on the original data set.

model_name

A character vector giving the model's name.

...

currently ignored

Details

Changepoint detection models know how they were created, on what data set, about the optimal changepoint set found, and the parameters that were fit to the model. Methods for various generic reporting functions are provided.

All changepoint detection models inherit from mod_cpt: the base class for changepoint detection models. These models are created by one of the fit_*() functions, or by as.model().

See Also

as.model()

Examples

Run this code
cpt <- mod_cpt(CET)
str(cpt)
as.ts(cpt)
changepoints(cpt)

Run the code above in your browser using DataLab