# Find whether there is a trend over time or the data is completely random

6 views (last 30 days)
Ray_Li on 10 Aug 2020
Commented: Image Analyst on 11 Aug 2020
Hello! I am working with ECG signals and I have extracted several features of the QRS complexes. My wish now is to find whether those features change in a certain way over time or the change is totally random. Which would a good approch to do this ?

Vasishta Bhargava on 10 Aug 2020
Edited: Vasishta Bhargava on 10 Aug 2020
Plot the extracted data of signals from plot function
plot(Z)
Where Z is matrix in which your signal data is stored.

#### 1 Comment

Ray_Li on 10 Aug 2020
well... I need check this for 100 records, so a manual approach of plotting is very very inefficient in my case. Thanks anyway!

Image Analyst on 10 Aug 2020
Star Strider will know, but until he answers the only thing I can suggest is looking into the chi-squared test.

#### 1 Comment

Ray_Li on 10 Aug 2020
Without a doubt ;) I will look it up, thank you!

John D'Errico on 10 Aug 2020
This really is not a MATLAB question, as you have no idea how to compute what you want, and your question is too vague to have a true answer.
There are many ways to see if data has a trend over time. For example, you might do a simple linear regression fit, thus y as a function of time. Test to see if the slope is significantly different from zero. If the slope is bound away from zero, then you have an answer.
Or you might simply choose to do a split the data into two segments or blocks, as a function of time. Now do a test, comparing the mean of block1 to the mean of block2. Are they statistically different? You might use tests like an anova, or a non-parametric test. Lots of them in the stats toolbox, and I am not a statistician to say whch is best, even if I did play at it in a past lifetime.

Ray_Li on 10 Aug 2020
Yes,it's a question in statistics, field in which unfortunately I have a very limited knowledge in and I am asking it here because I need to compute it in MATLAB.
Linear regression fit is the obvious answer, which doesn't work in my case. I will try the second one. Thank you
John D'Errico on 11 Aug 2020
Yes. You need to compute it in MATLAB, which has many statistical tests. Sp spend some time researching which statistical test might be appropriate for your problem. Again, there will be multiple tests someone could think of. If linear regression is not apprpriate, then you need to show some examples. Explain why an obvious test is NOT appropriate. But better still is to ask this on a forum where you will find a larger statistical community. Decide how to solve the problem, and only then need you worry about MATLAB code.
Only when you know what to do should you worry about the code to compute it.
Image Analyst on 11 Aug 2020
Ray, please show a screen shot of your data plotted so we can see the trendline. Maybe you just want to do "baseline correction" like they do in spectroscopy. Attach your data if you want people to try things with it.