MATLAB: Using timedelaynet neural network to predict values of time series

MATLABneural networkstime series predictiontimedelaynet

Hi,
I am having trouble figuring out how to use timedelaynet for prediction of unknown time series values.
From the Matlab documentation example with laser data and other questions I found on Matlab central:
y = laser_dataset;
y = y(1:600);
d = 8; % input delay 8
s = 1; % predict next single value in series
Pi = y(1:d);
p = y(d+1:end-s); % inputs
t = y(d+1+s:end); % targets
ftdnn_net = timedelaynet([1:d],10);
ftdnn_net.trainParam.epochs = 1000;
ftdnn_net.divideFcn = '';
ftdnn_net = train(ftdnn_net,p,t,Pi);
yp = ftdnn_net(p,Pi);
rmse = sqrt(mse(gsubtract(yp,t)));
so let's say I am happy with rmse and now would like to predict for example 601st or 650th unknown value of series, how would I do that?
To predict 601st value of the series, do I need to know values indexed 10:600 of the series (in other words all series values up to that point) that I can put back into yp_601 = ftdnn_net(p_10_to_600, Pi) and if that's the case if I wanted to predict a series value far out like 650th, and only had 600 known values available, would I calculate 601st, then 602nd, then 603rd, …, 650th using the network above? Or is there a better approach?
Thank you for your help.

Best Answer

You only have one time series.
Therefore you should be using narnet; not timedelaynet.
help/doc narnet
help/doc preparets
Find the significant autocorrelation lags. You can use
N = length(y)
zy = zscore(y,1);
autocorry = nncorr(zy,zy,N-1,'unbiased');
or
autocorry = ifft( abs(fft(zy)).^2 )/N
Determine the threshold for significant lags by finding the autocorrelation of randn(1,N). Then sort the positive lag values and find the value at floor(0.95*N).
To try to predict S timesteps beyond N, use
netc = closeloop(net).
help/doc closeloop
However, this will not work well if S is too large.
Hope this helps.
Thank you for formally accepting my answer!
Greg