0
$\begingroup$

I have observed that I am generally in a better mood after exercising. If I record data on how much I exercise and my mood, how can I correlate these?

Input: discrete events recorded at irregular, unpredictable intervals. Example input data:

  • Monday 2pm - Exercise (Moderate, 4/10, or 0.4)
  • Monday 5pm - Mood (0.5)
  • Monday 9pm - Mood (0.4)
  • Tuesday 10am - Mood (0.6)
  • Tuesday 12pm - Exercise (Intense, 0.9)
  • Tuesday 1pm - Mood (0.7)
  • Tuesday 7pm - Mood (0.7)
  • Wednesday 1pm - Mood (0.6)
  • Thursday 10pm - Mood (0.6)
  • Assume observations like these continue for months

Output:

  • Correlation strength (how strongly correlated are these?)
  • Correlation error (margin of error - what are the odds this correlation is an anomaly of too little data?)
  • Correlation phase (are they correlated on a delay - ie does mood rise 30 hours after exercise?)

Note that you cannot assume any kind of line/curve between data points - they are discrete events (in my example - 0.5 exercise on Monday and 0.8 exercise on Tuesday does not mean a steady increase in exercise overnight). Also note that "mood" and "exercise" are arbitrary - they could be swapped out for "vegetables eaten" and "wifi speed".

Looking for the theory at this point, I am not ready to actually do the calculations.

$\endgroup$
  • 1
    $\begingroup$ You seem to imply causation when you say "I am generally in a better mood after exercising." But since you exercise at "irregular, unpredictable intervals" it may be that you are choosing to exercise when you are in or starting on a good mood period. In short, correlation does not prove causation. $\endgroup$ – Joel W. Oct 5 '14 at 13:06
1
$\begingroup$

The general question you are trying to answer is: Is mood independent of exercise? One way they could be dependent is linearly, e.g., for every unit of exercise mood increases by two units -- this linear dependence is what correlation does a great job of measuring.

In order to assess whether the two variables are (in)dependent outside of a particular model, one often begins with a contingency table. In your case, you could setup a contingency table as follows:

                       mood
                           good  bad 
      exercise  none     |  4    10
                moderate |  3    20
                intense  |  2    10

The null hypothesis is that the two variables are independent - one can test this using a \chi^2 test of independence. Essentially, what are the counts in cells you would expect if there was no relationship between these two measurements. You can use the \chi^2 statistic to assess the strength of the dependence.

One of the reasons these tests are often eschewed for a linear model is that things will start to get harder to do when you have low counts in any cell of the table. One can get around this by permutation testing approaches, but the more you partitions you make in your mood, the more cells you have (note, I changed your moods because I didn't want to type all those numbers, but instead of good and bad, you can put .1, .2, ...).

Finally, to assess the possibility of a lag in mood. You could do the same thing, but shift all of the mood measurements.

One thing to be careful with is that a \chi^2 test of independence is called that because you compare the statistic you compute to \chi^2 distribution with the appropriate degrees of freedom. In your case, if the measures aren't independent then this distribution will not reflect what you would see under the null hypothesis. Note here, I'm referring to the possible dependence of mood_i on mood_{i - 1}. You can look for this by looking at auto-correlation plots.

$\endgroup$

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.