Forecasting with AR(1) model and fixed parameters

1 vue (au cours des 30 derniers jours)
Panty
Panty le 12 Sep 2014
Modifié(e) : Panty le 12 Sep 2014
Hi guys. Allow me to share my issue with you. I have a variable with 150 observations and I want to generate forecasts with an AR(1) model. Also what I want is to estimate the AR(1) model first, using the initial 57 observations and then keeping my estimated parameters fixed, I want a loop generating 4-periods ahead forecasts by adding an extra observation every time. So estimate the model just one time, keep the estimates, and by expanding my sample by 1 obs each time I want to generate my forecasts.
Here I give you the script I wrote for estimating the AR(1) model. What I miss is the forecasting part.
------------------------------------------------
% load data
data=MatlabDataRealtimeandRevisedS1;
% construct complete Variables ,x1 is the lagged(-1).
y1=data(2:end,1);
x1=data(1:(end-1),1);
[Traw,col]=size(y1);
T_full=T_raw;
% data for initial estimation
T_estimation=57;
x2=x1(1:T_estimation,1);
Y=y1(1:T_estimation,1);
% Build regressors matrix and ones for the constant
X=[ones(length(x2),1),x2];
% Doing OLS
[Coef,CoefConfidInter,e]=regress(Y,X);
------------------------------------------------
Any help please??
Please let me know if you got question. Much appreciated

Réponses (0)

Catégories

En savoir plus sur Model Predictive Control Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by