Learn R Programming

mixAR (version 0.22.8)

mixSARfit: Fit mixture autoregressive models with seasonal AR parameters

Description

Provides estimation via EM-Algorithm for mixture autoregressive models including seasonal AR parameters.

Usage

mixSARfit(y, model, est_shift = FALSE, tol = 10^-14)

Value

A list of 2:

model

an object of class "MixAR". The estimated model.

vallogf

the value of the loglikelihood function for the returned model.

Arguments

y

a time series (currently a numeric vector).

model

an object of class "MixAR" including seasonal components.

est_shift

if missing or FALSE, fix the intercepts to zero, otherwise estimate them.

tol

threshold for stopping criterion.

Author

Davide Ravagli and Georgi N. Boshnakov

Details

This function only works for "MixAR" objects in which slot arcoef is of class "raggedCoefS".

Examples

Run this code
ar1 <- list(c(0.5, -0.5), c(1.1, 0, -0.5))
ar12 <- list(0, c(-0.3, 0.1))
s = 12

rag <- new("raggedCoefS", a = ar1, as = ar12, s = s)

model <- new("MixARGaussian", prob = exampleModels$WL_A@prob, # c(0.5, 0.5)
             scale = exampleModels$WL_A@scale,                # c(5, 1)
             arcoef = rag)

set.seed(1234)
y <- mixAR_sim(model, n = 100, init = rep(0, 24))

mixSARfit(y, model)
## fix the intercepts to zero
mixSARfit(y, model, est_shift = FALSE, tol = 10e-4)

Run the code above in your browser using DataLab