MATLAB: Auto correlation and cross correlation with NARXnet to find ID and FD

Deep Learning Toolboxneural networkstutorial

Hello,
I have recently started working on neural networks and time series with Matlab. So far, I have been using NARX networks and have been training them and then looking at the inerrcorr and errcorr plots to know if I needed to use bigger delays but it has come to my attention that there is a more "rigorous" way of doing it using the nncorr function.
I have looked at many questions and answers but there are still a few steps along the process that I don't understand. I am going to use a code derived from the one found in the topic NARXnet non-integer delays problem to show which parts I don't get:
X = inputs; % 1x2323 mat

T = targets; % 1x2323 mat
N = lenght(T)
crosscorrXT = nncorr(X,T,N-1);
autocorrT = nncorr(T,T,N-1);
crosscorrXT(1:N-1) = []; % Delete negative delays
autocorrT(1:N-1) = [];
sigthresh95 = 0.21 % Significance threshold
sigcrossind = crosscorrXT( crosscorrXT >= sigthresh95 )
sigautoind = autocorrT( autocorrT >= sigthresh95 )
inputdelays = sigcrossind(sigcrossind <= 35)
feedbackdelays = sigautoind(sigautoind <= 35)
feedbackdelays(1)=[] % Delete zero delay
Though I understand from the answer given there that the value used isn't correct, I still don't understand how to get the 95% confidence limit. I also don't understand what the last three lines of her/his code do.
I found on another topic another way of getting sigthresh95:
sigthresh95 = crosscorrXT(floor(0.95*(2*N-1)))
but this line returns the error " Attempted to access crosscorrXT(4412); index out of bounds because numel(crosscorrXT)=2323" so clearly I am not using it correctly and I don't understand how it is supposed to work.
I think I'm not not clear on what the 95% is of.

Best Answer

Look for my recent NEWSGROUP posts (2015)
greg nncorr 2015
Especially
8 Jul 2015 OPENLOOP NARNET TUTORIAL EXAMPLE
2 Jun 2015 SIGNIFICANT AUTOCORRELATION DELAYS OF THE SIMPLENAR_DATASET
13 Apr 2015 NARNET TUTORIAL ON MULTISTEP AHEAD PREDICTIONS: MESSAGES 1, 7, 11
Hope this helps.
Thank you for formally accepting my answer
Greg