# chicken egg problem

I should run a test to determine whether variable A affect variable B or viceversa.

What type of test should I use?

Imagine that we measure the time slept per night (A) and the activity performed during a day (B) in several subjects. In particular we have a median of 4 nights and 4 days measured for each subject.

How would you approach the problem?

1) estimate how much the night (A) is correlated with the following day (B)
2) estimate how much the day (B) is correlated with the following night (A+1)
3) take the highest correlated condition


Is there a test that takes into account this situation? Thanks

• Pure correlation won't help you with this. Have a look at Granger causality. – A. Donda Sep 6 '15 at 23:51
• @A.Donda would it work even if my timeseries are not so extended? I have data for 4 days and 4 nights... – gabboshow Sep 7 '15 at 7:17
• @A.Donda please have a look at the edited question. In particular, I have a median of 4 assessed nights and days for each subject studied. Should I assess the Granger causality for each subject? Should I use a "bag of words approach", i.e. I put all the timeseries of all the subjects together? – gabboshow Sep 7 '15 at 7:34
• I'm not sure I understand... are you saying you do not have values for 4 different nights and days, but just the median? In that case you don't have a timeseries, and neither your approach or my suggestion work. Or what is the median across? – Assuming you do have a timeseries, yes, it is possible that you do not have enough data to properly fit a Granger causality model (AR model) to the data. But in that case, as far as I can see, you simple cannot answer your question using your data. How much data you need also depends on the order of the AR model that you fit; maybe order 1 is enough... – A. Donda Sep 7 '15 at 17:59
• Putting the timeseries of all subjects together is an option, but it has consequences for inference. What you are doing then is effectively a "fixed effects model", which means you can test for a statistically significant effect only for your sample, but you cannot generalize to the population of samples. In principle it would be better to analyze each subject's data separately and then apply a "second-level" to the estimated indices of directionality of causality, but if you don't have enough data you simply can't do that. – A. Donda Sep 7 '15 at 17:59