finiteDLMauto {dLagM} | R Documentation |
Find the optimal lag length for finite DLMs
Description
Fits finite DLMs for a range of lag lengths and orders the fitted models according to a desired measure.
Usage
finiteDLMauto(formula , data, x, y, q.min = 1, q.max = 10, k.order = NULL,
model.type = c("dlm","poly"), error.type = c("MASE","AIC",
"BIC","GMRAE", "MBRAE", "radj"),
trace = FALSE , type)
Arguments
formula |
A |
data |
A |
x |
A vector including the observations of predictor time series. This is not restricted to |
y |
A vector including the observations of dependent time series. This is not restricted to |
q.min |
An integer representing the lower limit of the range of lag lengths to be considered. If missing, it will be set to 1. |
q.max |
An integer representing the upper limit of the range of lag lengths to be considered. If missing, it will be set to 10. |
k.order |
An integer representing order of polynomial distributed lags. |
model.type |
The type of model to be fitted. If set to |
error.type |
The type of goodness-of-fit measure to be used for the selection of optimal lag length. The optimal lag length is determined according to desired goodness-of-fit measure. |
trace |
If |
type |
An integer taking 1 if only x and y vectors are entered, 2 if a formula and data matrix is entered. It can be left |
Details
When there is only one predictor series, both of model
and formula
objects can be used. But when they are supplied, both x
and y
arguments should be NULL
.
The variable names in formula
must match with the names of variables in data
argument and it must be in the form of a generic formula for R functions.
The argument data
contains dependent series and independent series. Required lags of dependent series are generated by the dlm
function automatically.
If q.max
is entered greater than the length of the series, its value will be adjusted to have the length of the series for fitting the regression model.
Value
Returns a data.frame
including the values of goodness-of-fit measures and corresponding lag lengths.
Author(s)
Agung Andiojaya <agung.andiojaya@gmail.com>, Haydar Demirhan
Maintainer: Haydar Demirhan <haydar.demirhan@rmit.edu.au>
Examples
## Not run:
library(dLagM)
# Multiple independent series
data(M1Germany)
data = M1Germany[1:44,]
# Run the search over finite DLMs according to AIC values
finiteDLMauto(formula = logprice ~ interest + logm1,
data = data.frame(data), q.min = 2, q.max = 5,
model.type = "dlm", error.type = "AIC", trace = FALSE)
## End(Not run)