fit_mixARreg-methods {mixAR} | R Documentation |
Fit time series regression models with mixture autoregressive residuals
Description
Estimate a linear regression model for time series with residuals from a mixture autoregressive process.
Usage
fit_mixARreg(x, y, mixARmodel, EMinit, ...)
mixARreg(x, y, mixARmodel, tol = 1e-6, niter = 200)
Arguments
x |
the response time series (currently a numeric vector). |
y |
|
mixARmodel |
An object inheriting from class |
EMinit |
starting values for EM estimation of MixAR parameters. If present,
must be a named list, containing at least |
tol |
threshold for convergence criterion. |
... |
passed on to |
niter |
maximal number of iterations. |
Details
fit_mixARreg
is a generic function.
Currently there is no default method for fit_mixARreg
.
Arguments y
, mixARmodel
, EMinit
can be given in a
number of ways, see individual methods for details.
Argument mixARmodel
gives the details of the the MixAR part of
the model and initial values for the parameters. For
fit_mixARreg
this can alternatively be done with a list using
argument EMinit
. Currently, at least one of the two must be
supplied, and if both are present EMinit
is ignored.
mixARreg
performs a two-step estimation of a linear regression
model with mixture autoregressive residuals. It is the workhorse for
fit_mixARreg
which calls it to do the computations.
Value
reg |
The summary output of the regression part of the model. |
mixARmodel |
Estimates of the mixture autoregressive part of the model. |
niter |
The number of iterations until convergence. |
Methods
signature(x = "ANY", y = "data.frame", mixARmodel = "MixAR", EMinit = "missing")
Covariates
y
are supplied asdata.frame
: each column corresponds to one covariate. Initialization ofMixAR
paramters is done using inputmixARmodel
signature(x = "ANY", y = "matrix", mixARmodel = "MixAR", EMinit = "missing")
Covariates
y
are supplied asmatrix
: each column corresponds to one covariate. Initialization ofMixAR
paramters is done using inputmixARmodel
signature(x = "ANY", y = "numeric", mixARmodel = "MixAR", EMinit = "missing")
Covariates
y
is supplied asnumeric
: this method handles the simple regression case with a single covairate. Initialization ofMixAR
paramters is done using inputmixARmodel
signature(x = "ANY", y = "ANY", mixARmodel = "missing", EMinit = "list")
-
EMinit
must be a named list (see 'Arguments'). signature(x = "ANY", y = "ANY", mixARmodel = "MixAR", EMinit = "list")
-
When both
mixARmodel
andEMinit
are supplied, the second is ignored.
Note
Estimation is done using the function mixARreg
within each
method.
Author(s)
Davide Ravagli and Georgi N. Boshnakov
See Also
Examples
## Simulate covariates
set.seed(1234)
n <- 50 # for CRAN
y <- data.frame(rnorm(n, 7, 1), rt(n, 3), rnorm(n, 3, 2))
## Build mixAR part
model <- new("MixARGaussian",
prob = exampleModels$WL_At@prob, # c(0.5, 0.5)
scale = exampleModels$WL_At@scale, # c(1, 2)
arcoef = exampleModels$WL_At@arcoef@a ) # list(-0.5, 1.1)
## Simulate from MixAR part
u <- mixAR_sim(model, n, 0)
x <- 10 + y[, 1] + 3 * y[, 2] + 2 * y[, 3] + u
## Fit model
## Using MixARGaussian
fit_mixARreg(x = x, y = y, mixARmodel = model, niter = 3)
## Using EMinit
EMinit <- list(prob = exampleModels$WL_At@prob, scale = exampleModels$WL_At@scale,
arcoef = exampleModels$WL_At@arcoef@a)
fit_mixARreg(x = x, y = y, EMinit = EMinit, niter = 3)