Forecasting using AR(p) model with real-time data. NEED HELP !!!!!

2 views (last 30 days)
Hi there !
I would like to share with you my problem. I want to forecast recursively the next 12 (unknown) observations. I have attached my real-time dataset which is in a triangular format. As you can see in my excel file, I want to forecast the next 12 (unknown) observations of each column. I am using an AR(8) model. Let me also give you the code I have developed.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[rows,columns]=size(NEW_ROUTPUTQvQ19652014FilledMissingValues);
for column=1:columns;
InSampleData=NEW_ROUTPUTQvQ19652014FilledMissingValues(1:end,column);
find(InSampleData==0);
data=InSampleData(1:(ans-1),1);
for periods_ahead = 1:12;
Mdl = arima(1,0,0);
EstMdl = estimate(Mdl,data);
[Yhat,YMSE] = forecast(EstMdl,1);
data(end+1,1)= Yhat;
zeros=find(NEW_ROUTPUTQvQ19652014FilledMissingValues==0);
pos=zeros(1,1);
NEW_ROUTPUTQvQ19652014FilledMissingValues(pos,column)=Yhat;
end;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
If something is not clear or you have questions I am happy to answer you asap.
Could you please help me with it..??? Think I am desperate.!!

Answers (0)

Categories

Find more on Biological and Health Sciences in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!