how to treat the last observation? Forecasting??
    6 次查看(过去 30 天)
  
       显示 更早的评论
    
Dear all,
I have the following cell matrix
A={
 '24/09/2000'                  [4.1583]
    '22/10/2000'              [3.9389]
   '19/11/2000'               [4.3944]
    '17/12/2000'              [3.9313]
   '14/01/2001'               [3.9313]
    '11/02/2001'               [3.9313]
    '11/03/2001'              [4.0339]}
I can easily convert the above data points to monthly averages; through the calculation of the weighted average between successive observations.
For instance for the first observation I have
24*4.1583+ 6*3.9389
where 24 is the 24 days from month Octomber and 6=(last date of the month-24=30-24) The only problem is how to treat the last observation:
11*4.0339+?
One way is to extrapolate but I do not consider this method reliable. The above values are prices. So could I apply some other way? Maybe forecasting taking into account seasonality?
Any help/code provided will greatly appreciated
thanks
4 个评论
  Walter Roberson
      
      
 2012-8-18
				You do not have enough data to forecast with, not with any meaningful accuracy.
采纳的回答
  Oleg Komarov
      
      
 2012-8-18
        A ={'24/09/2000'    4.1583
    '22/10/2000'    3.9389
    '19/11/2000'    4.3944
    '17/12/2000'    3.9313
    '14/01/2001'    3.9313
    '11/02/2001'    3.9313
    '11/03/2001'    4.0339};
% Convert to tractable double matrix, i.e. use serial dates
A = [datenum(A(:,1),'dd/mm/yyyy') cat(1,A{:,2})];
A =
                    730753                    4.1583
                    730781                    3.9389
                    730809                    4.3944
                    730837                    3.9313
                    730865                    3.9313
                    730893                    3.9313
                    730921                    4.0339
% Create a list of end-of-month dates (using two tricks):
- create first-day-of-next-month dates and subtract one
- datenum() automatically adjusts the date in case one of the units exceeds the max accepted value
xi = datenum(2000,10:16,1)-1;
% Interpolate
B  = interp1(A(:,1),A(:,2), xi,'linear','extrap');
% Plot
plot(A(:,1),A(:,2),'-dr',xi,B,'-ob')
set(gca,'Xtick',sort([A(:,1); xi']),'xgrid','on')
datetick('x','dd/mm','keepticks')
0 个评论
更多回答(0 个)
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Time Series 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


