Skip to contents

Fit a model for mean and variance

Usage

fit_meanvar(x, tau, ...)

Arguments

x

A time series

tau

a set of indices representing a changepoint set

...

currently ignored

Value

A mod_cpt object.

Details

In a mean-variance model, both the means and variances are allowed to vary across regions. Thus, this model fits a separate \(\mu_j\) and \(\sigma_j\) for each region \(j\).

Examples

# Fit a mean-variance model
fit_meanvar(CET, tau = c(42, 330))
#> 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 [1:2] 42 330
#>  $ region_params: tibble [3 × 3] (S3: tbl_df/tbl/data.frame)
#>   ..$ region           : chr [1:3] "[0,42)" "[42,330)" "[330,362]"
#>   ..$ param_mu         : num [1:3] 8.68 9.25 10.25
#>   ..$ param_sigma_hatsq: Named num [1:3] 0.389 0.335 0.238
#>   .. ..- attr(*, "names")= chr [1:3] "[0,42)" "[42,330)" "[330,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"