Class for model-fitting functions
new_fun_cpt.Rd
Class for model-fitting functions
Arguments
- x
A
character
giving the name of a model. Typically the result ofmodel_name()
.- ...
currently ignored
Details
All model-fitting functions must take at least three arguments:
x
(a time series),
tau
(a set of changepoint indices), and the dots ...
.
See fit_meanshift_norm()
,
See also
Other model-fitting:
fit_lmshift()
,
fit_meanshift()
,
fit_meanvar()
,
fit_nhpp()
Other modeling:
model_args.seg_cpt()
,
model_name.mod_cpt()
Examples
f <- fun_cpt("fit_meanvar")
str(f)
#> function (x, tau, ...)
#> - attr(*, "model_name")= chr "meanvar"
#> - attr(*, "class")= chr "fun_cpt"
f(CET, 42)
#> List of 6
#> $ data : Time-Series [1:362] from 1 to 362: 8.87 9.1 9.78 9.52 8.63 9.34 8.29 9.86 8.52 9.51 ...
#> $ tau : num 42
#> $ region_params: tibble [2 × 3] (S3: tbl_df/tbl/data.frame)
#> ..$ region : chr [1:2] "[0,42)" "[42,362]"
#> ..$ param_mu : num [1:2] 8.68 9.35
#> ..$ param_sigma_hatsq: Named num [1:2] 0.389 0.418
#> .. ..- attr(*, "names")= chr [1:2] "[0,42)" "[42,362]"
#> $ model_params : NULL
#> $ fitted_values: num [1:362] 8.68 8.68 8.68 8.68 8.68 ...
#> $ model_name : chr "meanvar"
#> - attr(*, "class")= chr "mod_cpt"
f <- whomademe(fit_meanshift_norm(CET, tau = 42))
str(f)
#> function (x, tau, ...)
#> - attr(*, "model_name")= chr "meanshift_norm"
#> - attr(*, "class")= chr "fun_cpt"