I want to check if a time series is independent or not. The time series are nonlinear, generated from a nonlinear dynamical system.
For this I am using the autocorrelation (AC). Autocorrelation referstrying to plot the correlation of a time series with its own pastauto and future values.
A time series is a collectioncross correlation of ordered random variables. I have two different time seriesthe bitstream that areis obtained from a non-linearnonlinear dynamical system denoted by variable phi
and phit
respectively.
The sample length of each time series is 5000.
Statistical test for independence :
Question 1:
In general, for checking if the samples of a time series are independent and identically distributed do we check for auto correlation (ACF) or cross-correlation (CCF)?
What is the value that tells us whether the sequence is independent?
Question 2: An example
The first plot is
CST = xcorr(xphit,xphi);
AST = xcorr(xphi,xphi);
The secondThe graph is the Auto and cross-correlation for the bit streambitstream obtained from the same nonlinear dyanamical system.
I am not sure how to interpret the two graphs, the spike at lag zero and whethergraph. Whether the samples are correlatedprogram is incorrect or independentnot. Please help
UPDATE: Here is the codeI wanted to generateobtain the plot usingof lags vs ACF but what I got is different than the actual plot given in a nonlinear dynamical systembook. Please help.
A = .5; B = 1.99; phin = .5; xphi(1) = A - (B*phin);
for it = 2:1:5000
xphi(it) = A - (B*abs(xphi(it-1)));
end
phi = 2*(xphi>=0.5)-1;
A = .51; B = 1.90; phin = .5; xphit(1) = A - (B*phin);
for it = 2:1:5000
xphit(it) = A - (B*abs(xphit(it-1)));
end
phit = 2*(xphit>=0.5)-1;
CST = xcorr(phit,phi);
AST = xcorr(phi,phi);
Time = 0;
for nn = 2:1:length(CST)
Time(nn) = Time(nn-1) + 1;
end
plot(Time,AST,'r',Time,CST,'g'); title('\bf AUTO & CROSS correlation');
xlabel('\bf Time'); ylabel('\bf Auto & Cross correlation'); legend('red-AC','green-CC');
The plot should resemble
where the figure on top is the cross-correlation and the bottom is the auto-correlation