mixARemFixedPoint {mixAR} | R Documentation |
EM estimation for mixture autoregressive models
Description
Fit a mixture autoregressive model to a univariate time series using the EM algorithm.
Usage
mixARemFixedPoint(y, model, est_shift = TRUE, crit = 1e-14,
maxniter = 200, minniter = 10, verbose = FALSE)
mixARgenemFixedPoint(y, model, crit = 1e-14, maxniter = 200,
minniter = 10, verbose = FALSE, ...)
Arguments
y |
a univariate time series. |
model |
an object of class MixAR, a mixture autoregressive model providing the model specifications and initial values for the parameters. |
est_shift |
if TRUE optimise also w.r.t. the shift (constant) terms of the AR components, if FALSE keep the shift terms fixed. |
crit |
stop iterations when the relative change in the log-likelihood becomes smaller than this value. |
maxniter |
maximum number of iterations. |
minniter |
minimum number of iterations, do at leat that many iterations. |
... |
further arguments to be passed on to the M-step optimiser. |
verbose |
print more details during optimisation. |
Details
mixARemFixedPoint
and mixARgenemFixedPoint
estimate
MixAR models with the EM algorithm. For mixARemFixedPoint
, the
distribution of the components are fixed to be Gaussian. For
mixARgenemFixedPoint
, the distributions can, in principle be
arbitrary (well, to a point).
Starting with model
, the expectation and maximisation steps of
the EM algorithm are repeated until convergence is detected or the
maximum number of iterations, maxniter
is exceeded.
Currently the convergence check is very basic—the iterations stop
when the relative change in the log-likelihood in the last two
iterations is smaller than the threshold value specified by
crit
and at least minniter
iterations have been done.
The EM algorithm may converge very slowly. To do additional iterations use the returned value in another call of this function.
Value
the fitted model as an object inheriting from "MixAR".
Note
This function was not intended to be called directly by the user (hence the inconvenient name).
Author(s)
Georgi N. Boshnakov
See Also
fit_mixAR
which uses these functions for estimation,
classes
"MixARGaussian"
,
"MixARgen"
Examples
## data(ibmclose, package = "fma") # ibm data from BJ
m0 <- exampleModels$WL_ibm
m1 <- mixARemFixedPoint(fma::ibmclose, m0)
m1a <- mixARemFixedPoint(fma::ibmclose, m1$model)
show_diff(m1$model, m1a$model)
mixARemFixedPoint(fma::ibmclose, m0, est_shift = FALSE)
## simulate a continuation of ibmclose, assuming m0
ts1 <- mixAR_sim(m0, n = 50, init = c(346, 352, 357), nskip = 0)
m2a <- mixARemFixedPoint(ts1, m0, est_shift = FALSE)$model
m2b <- mixARemFixedPoint(diff(ts1), m0, est_shift = FALSE)$model