fit_mixARreg-methods | R Documentation |
Estimate a linear regression model for time series with residuals from a mixture autoregressive process.
fit_mixARreg(x, y, mixARmodel, EMinit, ...)
mixARreg(x, y, mixARmodel, tol = 1e-6, niter = 200)
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. |
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.
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. |
signature(x = "ANY", y = "data.frame", mixARmodel =
"MixAR", EMinit = "missing")
Covariates y
are supplied as data.frame
: each column
corresponds to one covariate. Initialization of MixAR
paramters is
done using input mixARmodel
signature(x = "ANY", y = "matrix",
mixARmodel = "MixAR", EMinit = "missing")
Covariates y
are supplied as matrix
: each column
corresponds to one covariate. Initialization of MixAR
paramters is
done using input mixARmodel
signature(x = "ANY", y = "numeric", mixARmodel = "MixAR", EMinit = "missing")
Covariates y
is supplied as numeric
: this method handles the
simple regression case with a single covairate.
Initialization of MixAR
paramters is done using input mixARmodel
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
and EMinit
are supplied, the second is ignored.
Estimation is done using the function mixARreg
within each
method.
Davide Ravagli and Georgi N. Boshnakov
fit_mixAR
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.