Clear Filters
Clear Filters

Two step ahead autoregressive prediction

7 views (last 30 days)
Elias Pergantis
Elias Pergantis on 14 Nov 2023
Answered: Divyam on 21 Aug 2024 at 15:40
Is it possible to use the AR function in Matlab to train models such as:
y(t+2)=a(1)u(t-1)+a(2)u(t-2)+...+a(p)u(t-p)
rather than:
y(t+1)=a(1)u(t-1)+a(2)u(t-2)+...+a(p)u(t-p)
I want to avoid predicting y(t+2) using y(t+1).
Many thanks
  1 Comment
Ganesh
Ganesh on 29 Nov 2023
If you would like to predict y(t+2), you can use the Nonconsecutive Lags parameter and tweak the array indices to achieve the result. However, by skipping a term in the middle might stand as a blocker to predict the subsequent terms of the sequence. Kindly ensure that all terms of the sequence are sequentially computed to avoid miscalculations.
Thank you,
Ganesh Saravanan

Sign in to comment.

Answers (1)

Divyam
Divyam on 21 Aug 2024 at 15:40
Hi @Elias Pergantis, yes, you can utilize the AR functions to train models which have non-consecutive lags between terms using the 'ARLag' parameter of the 'regARIMA' function. Here is a sample code for the same.
% Sample Model Equation: y(t) = 0.25*u(t-3) + 0.1*u(t-4) + 0.05*u(t-5)
% The 'AR' parameter sets the coefficients of the u(t-k) terms
Mdl = regARIMA('AR', {0.25, 0.1, 0.05}, 'ARLags', [3,4,5])
Mdl =
regARIMA with properties: Description: "ARMA(5,0) Error Model (Gaussian Distribution)" SeriesName: "Y" Distribution: Name = "Gaussian" Intercept: NaN Beta: [1×0] P: 5 Q: 0 AR: {0.25 0.1 0.05} at lags [3 4 5] SAR: {} MA: {} SMA: {} Variance: NaN
% 'ARLag' parameter specifies that nonzero AR coefficients exist at lags t-3, t-4, and t-5
Mdl.AR
ans = 1x5 cell array
{[0]} {[0]} {[0.2500]} {[0.1000]} {[0.0500]}

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!