Forecasting with AR(1) model and fixed parameters

조회 수: 2 (최근 30일)
Panty
Panty 2014년 9월 12일
편집: Panty 2014년 9월 12일
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개)

카테고리

Help CenterFile Exchange에서 Model Predictive Control Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by