0
$\begingroup$


I'm wondering if it make sense, or simply your opinion about this: I have a dataset with a value, and a time variable. let's suppose that the time variable is month, like time = c(1,2,3,4,5), and the value = c(2,3,5,2,4).

In this case:

time = c(1,2,3,4,5)
value = c(2,3,5,2,4)

In your opinion (if months increase more than 12 in the next years), is it correct and does it make sense to calculate the Pearson Correlation

cor(time,value)
[1] 0.3638034

between time and value to see if there is positive, negative or not correlation (in this case positive)?
I think that as a formula could works, but I do not know it's an error to force the month a qualitative ordinal variable, to months in number, a quantitative interval variable and use them to Correlation.
EDIT

I've thought this because:
I have a big quantity of"moving" small time series (add one incoming month, remove first month) long 6 months. I need to see,for each of these time series, if the trend is growing or decreasing without an inferential point of view (think about the small time series as is, not a sample of a stocastic process, I suppose).
I've thoght that the Correlation could help to see if there is a linear relationship between time and values, but reading all those answer, it does not seems the best way.

$\endgroup$
  • $\begingroup$ If your value vector itself is function of t, then simple method of moments estimator diverges as partial sums as function of t grow. $\endgroup$ – Analyst Jun 23 '18 at 21:46
  • $\begingroup$ Hi, I'm missing the point, sorry: could you be more explicit? Thanks. $\endgroup$ – s_t Jun 23 '18 at 22:31
  • $\begingroup$ Think of model y(t)=a+b*t+e $\endgroup$ – Analyst Jun 24 '18 at 19:02
0
$\begingroup$

You seem have several questions here, so I'll make sure to separate them and consider them separately.

"I do not know it's an error to force the month a qualitative ordinal variable, to months in number, a quantitative interval variable and use them to Correlation."

It's not an error to treat months as a "quantitative interval variable" as you say because the time difference between adjacent measured months is the same and known (it's one month). Labeling them as "1,2,3,..." doesn't change that fact.

"is it correct and does it make sense to calculate the Pearson Correlation"

Correct depends on what you're trying to do with your data (the context).

The correlation between the time vector and the time series doesn't really make sense, in terms of quantifying relationships between variables. This is because with time-series data we expect statistical dependencies that make it hard to interpret the sample correlation as an estimator of a population correlation. Another issue is that correlation is a possible indicator of causal mechanisms, which doesn't make sense in your example (not that correlation proves a causal relationship, it may suggest it depending on the context).

That doesn't mean that interpretation is impossible. The correlation coefficient indicates the strength of a linear fit between two variables, both statistically and geometrically. Ignoring the statistical distributions aspect, a large value of the correlation suggests that a line could be drawn through the scatterplot of the bivariate data.

If you have a large correlation value between time and a time series, it could indicate a linear (mean) trend in the data. Investigating the mean trend supersedes interest in the correlation coefficient here.

$\endgroup$
  • $\begingroup$ My context: I've several small time series (more or less like the one in the example) made as "moving" small time series (add one incoming month, remove first month). I've not got any inferential issue, but want to read each small time series as is. So I was wondering if a Correlation is proper to see the bond between time and series. However do you think that looking a the angular coefficient of a trend could be the best way to see the relationship between time and values? Thanks. $\endgroup$ – s_t Jun 23 '18 at 22:28
0
$\begingroup$

First of all, why? Correlation with time means that is a trend. For checking if there is a trend you can use this topic: How to test for presence of trend in time series?

Correlation does not have sense in non stationary data. Obviously, time is not stationary. If distribution is changing in time, there is no point to measure anything across whole period.

$\endgroup$
  • $\begingroup$ You're saying it could be better to calculate the angular coefficient of the trend line calculate with for example OLS? Thanks. $\endgroup$ – s_t Jun 23 '18 at 22:34
  • $\begingroup$ OLS is another technique that should be used only on stationary data. Check autocorrelation, if there is any with lag 1, there is a trend. $\endgroup$ – mbt Jun 24 '18 at 6:17
  • $\begingroup$ My main problem is that I have "moving" small time series (add one incoming month, remove first month), and I have only to have a number to define if the trend is positive and negative. This is why I've approached with correlation. I can test the autocorrelation, but is it useful for very small time series and my task? (I'm going to update my question). $\endgroup$ – s_t Jun 24 '18 at 8:35
  • $\begingroup$ How small is the time series? You can try Mann Kendall test. I've never used it, but it seems reasonable and should be helpful in your case. vsp.pnnl.gov/help/vsample/Design_Trend_Mann_Kendall.htm $\endgroup$ – mbt Jun 24 '18 at 8:49
  • $\begingroup$ They are some thousands of time series of 6 months (moving, i.e. adding one month is going to remove the first one).The tests seems fitting, but I did not know it, I need to test it a bit. $\endgroup$ – s_t Jun 24 '18 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.