Skip to contents

Class for model-fitting functions

Usage

new_fun_cpt(x, ...)

validate_fun_cpt(x)

fun_cpt(x, ...)

Arguments

x

a character giving the name of a model-fitting function

...

currently ignored

Value

A fun_cpt object.

Details

All model-fitting functions must be registered through a call to fun_cpt().

All model-fitting functions must take at least three arguments:

  • x: a time series,

  • tau: a set of changepoint indices

  • ...: other arguments passed to methods

See fit_meanshift_norm(),

See also

Examples

# Register a model-fitting function
f <- fun_cpt("fit_meanvar")

# Verify that it now has class `fun_cpt`
str(f)
#> function (x, tau, ...)  
#>  - attr(*, "model_name")= chr "meanvar"
#>  - attr(*, "class")= chr "fun_cpt"

# Use it
f(CET, 42)
#>  Model: A meanvar  model with 2 region(s).
#> → Each region has 2 parameter(s).
#> → The model has 0 global parameter(s).