# How to determine if a given signal is time-correlated?

I am trying to determine if a given noise from a compass sensor is time-correlated (it is supposed to be!) and for that I tried to compute the cross correlation between the noise signal and the time of sampling using Matlab xcorr() function. However, I am getting a random value indicating that it is not time-correlated, whereas in reality it has to be that way.

Am I doing something wrong? I am not able to find references to determine if a signal is time-correlated, so any ideas would be greatly appreciated!

Thanks!

Imelza

• @Dmitrij Please put your comment as an answer, this might help the OP to refine his question or engage into a more constructive dialogue. (As you said this has become a long-lasting series of questions now). @Imelza You already asked 5 questions, and got some comments on them (see e.g., here and here) but you didn't address any of them. Any reason why?
– chl
Mar 22 '11 at 9:17

## 3 Answers

Despite the fact that there were a lot of discussion on the relative topics (though no any answer provided), I would like to add some ideas from my own teaching and model-building experience. It would be also very useful for you to study/read any (good) textbook in econometrics or time-series analysis first (just to speak the same language).

Sidenote: it would be also great to switch from master-of-all-trades matlab to either $R$ or gretl, both open-source products that are just great to do time-series (regarding $R$ then not only) things.

As it follows from your description of the problem, you have a time-series process, denote it by $y(t)$, that could be very noisy (low signal/noise ratio, with high noisy part) for a researcher to see any good time-dependence by simply screening the data (though a plot of a typical sensor's output would be very appreciated to improve this answer). Note, that time is already present in the definition of the object. From here on you have a number of options of what to do next:

1. You may go solo , first of all, trying to decompose the time-series object into trend + cycle + seasonal part (for magnetic fields both cycle and seasonal parts are very likely to present) + noise. At this stage it could happen that you do have something there close to white noise sequence. Note also that your trend could be either deterministic (fully predictable) or stochastic. The form of the trend could be tested by a number of unit-root tests. Plotting the data again could be useful to detect the deterministic behaviour.
2. Alternatively you may be interested in Box-Jenkins approach and try to build best parsimonious (S)ARIMA model for $y(t)$. As a side-step in this approach is the analysis of correlogram (acf and pacf plots), anyway it is a good thing to begin from plotting this one as a first thing you do with your time series object.
3. You may also find useful to move from time to frequency domain: produce periodogram, search for deterministic sinusoidal behaviour or trends (again if the latter is flat you are probably indeed dealing with white noise process)
4. You may search for meaningful covariates like average temperature, solar activity, earthquakes, etc. In this case you could build the theory based regression model as opposed to a-theoretical decomposition and (S)ARIMA models.

Concluding remark: as you may see from the response time-dependence could be far more complicated than just a linear time trend. There is no short answer to your question (well the shortest could be: produce a correlogram, apply Ljung-Box test, if it is close to white noise characteristics, conclude that there is no time-dependence, else some kind of it IS present, but are you happy with that one?). Good luck.

When thinking about time correlation, a spectrum is a natural complement. Thus, statistical tests for white noise based on spectral analysis and/or autocorrelation function are on the list. We have recently published a paper and an R package hwwntest with wavelet-based spectral tests that do not require any lags or other tuning parameters.

Following DC's excellent summary of available approaches let me add:

The question "if a given noise from a compass sensor is time-correlated " raises suggestions as how to analyse it in order to make a conclusion. In the absence of user-specified possible support/explanatory series one is left with approaches that entertain Deterministic Structure , ARIMA Structure and hybrids. When faced with an unknown underlying frequency we often scan for hidden stochastic seasonalities by a search process. In the absence of user-specified suggestions like these readings are taken every 24 hours. One must reach out and via trial and error to deduce the strong (if any) hidden periodicity. Outliers , Pulses, Level Shifts m Local Time Trends can also play havoc with system identification. We use very aggressive model identification strategies ( no neural nets here ) to extract the signal be it stocahastic or deterministic or both.

• @Irish This form of response steps over the line between being helpful and using this site for overt marketing. Please don't take my deletion to reflect any opinion about you or your software. Your expertise and experience are apparent and quite welcome on this site, but please share them in ways that clearly show your objectivity.
– whuber
Mar 22 '11 at 22:53
• @whuber I have edited the "overt marketing" . I am not sure how to refer to tools that are in the marketplace that can help a poster with a problem/question. I see other references by responders pointing to Minitab , SPSS , R , SAS. Mar 31 '11 at 21:59
• @Irish Thank you. The "marketing" refers to services, not software. One purpose of SE is to create a lasting record of great solutions to questions. Offering consulting services--whether professional or amateur, for free or not--explicitly circumvents this. If you need to elicit additional information from the OP in order to answer the question effectively, do so in comments, until you have enough to be able to formulate a clear and helpful reply, and then please share that reply with us!
– whuber
Mar 31 '11 at 22:06
• @Irish re: mentioning software. Software, both commercial and free, is an essential part of statistics. It is understood that software recommendations are necessary but might not be completely objective, because they depend partly on the respondent's experience and access to the SW. However, when a respondent has a connection with software--as a developer, marketer, official proponent, or whatever--then recommending it can sometimes appear like a conflict of interest. Such recommendations always need to be accompanied with disclosures of interest and handled as circumspectly as possible.
– whuber
Mar 31 '11 at 22:09
• @whuber I see people referring to their textbook that they have written. Software is no different from textbooks , both deliver revenue to their authors. I guess if I mention a piece of software that I have been involved with , I should say so. Mar 31 '11 at 22:21