Forecasting with AR(1) model and fixed parameters
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Model Predictive Control Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!