Hi, I have an issue (mostly being clueless and trying to achieve more than I can), I am writing a page in Ruby on Rails for which I need to calculate the probability of two events being correlated (basically the likelihood of a trigger being the cause of a symptom, or since correlation doesn't imply causation, of them being correlated). I thought I could find a gem which what I needed but I am not that sure (I found statsample but it doesn't have the Phi coefficient which looked to me like a good choice), now I realise I didn't think it through (given that is a project for school and I am kind of out of time), and that I don't have enough statistical background to know what I am doing. I am not sure of what statistical tool I should use or how to implement it. I have decided that I need to set a time frame, since a symptom more than 2 days after won't have anything to do with the suspected cause. Should I be rearranging the data and taking every two days as an entry with the “cause” and symptom (as 0 and 1 depending on occurrence)? Any help would be welcomed.