Description Usage Arguments Details Value References See Also Examples
Recursive fitting of time-adaptive lasso vector auto regressive models with an online cyclic coordinate descent algorithm.
1 2 3 4 5 | onlineVAR(y, nu = 1, lags = NULL, ahead = NULL, lambda.ratio = NULL,
burnin = NULL, control = onlineVAR.control(lambda.ratio, ...), ...)
onlineVAR.fit(x, y, nu, lags, ahead, lambda.ratio, fit, burnin,
control = onlineVAR.control())
|
y |
Vector time series with columns for each variable and rows for each time step. |
x |
Lagged time series data. Columns 1 to |
nu |
Forgetting factor for exponential forgetting. |
lags |
Number of considered lags. Order of VAR model. |
ahead |
Look ahead time for predictions. Most recent data that are
available. The fitted model only considers lags larger than |
lambda.ratio |
Vector of penalization parameters as fractions of the
minimum lambda for which all coefficients are zero. If not specified
a sequence of lambda values is used. See |
burnin |
Burn-in period, i.e., the number of time steps that are used to
stabilize the model fit. This is particularly important for selecting the
optimum lambda. Default is the effective training data length |
control |
A list of control parameters. Default is
|
fit |
List of various starting values that are used for the online updating algorithm. |
... |
Arguments to be used to form the default |
onlineVAR
recursively fits time-adaptive lasso vector auto regressive
models with an online coordinate descent algorithm that updates the model fit
at each time step. By default these models are fitted for a sequence of lasso
penalization parameters and predictions are generated for each time step with
the parameter with the smallest weighted mean squared error.
onlineVAR.fit
is the lower level function where the actual
fitting takes place.
An object of class "onlineVAR"
, i.e., a list with the
following elements.
coef |
List of intercept vector and coefficient matrices for the different lags. |
fit |
List of various values that are used for the online updating algorithm. This is mainly used as starting values for further updates. |
nu |
Forgetting factor for exponential forgetting. |
pred |
Predictions. Matrix of the same size as the input data but with
predictions from adaptive lasso VAR. The first |
predall |
If |
residuals |
Prediction errors. |
lags |
Number of considered lags. Order of VAR model. |
ahead |
Look ahead time for predictions. |
lambda.ratio |
Sequence of lasso penalization parameters |
trace |
If |
burnin |
Burn-in period, i.e., the number of data that are used to stabilize the model fit. |
call |
Function call. |
Messner JW, Pinson P (2016). Online Adaptive LASSO Estimation in Vector Auto Regressive Models for Wind Power Forecasting in High Dimension. International Journal of Forecasting, in press. http://pierrepinson.com/docs/MessnerPinson18.pdf.
predict.onlineVAR
, plot.onlineVAR
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | data(aemo)
## use only subset of first 8000 time steps
y <- aemo[1:8000,]
## fit online lasso VAR
onlinefit <- onlineVAR(y, nu = 0.99, lags = 1, ahead = 1)
## plot coefficient matrix from last update
plot(onlinefit)
## compare mean root mean squared error to persistence
c(onlinefit = mean(sqrt(apply((predict(onlinefit)-y)^2, 2,
mean, na.rm = TRUE))),
persistence = mean(sqrt(apply((aemo[1000:7999,]-y[1001:8000,])^2, 2,
mean))))
|
onlinefit persistence
0.03913592 0.04035489
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.