# Research design for overlap probability

#### travelmail26

##### New Member
I'd like some feedback on both the method and code I'm using to analyze a case study of a person who uses an herbal supplement to help with depression. I will happily take feedback on either the general approach or specifics on the code itself. I really like this forum and am eager for feedback. The purpose of this approach (and code below) is to find the probability that events overlap with one another during a 3 month time period.

It's based on a case study of a person who says that they experience depressive episodes every 3 months and these last for 2-5 days in length. The person also uses an herbal supplement to stop these depressive events from occurring, which she takes for 10-20 days at a time every 2 months. The person claims this supplement routine has worked for two years and there's been no overlap between occasionally taking the supplement and their episodic depression.
To calculate the probability that the lack of overlap between the supplement and depression is not chance, I wrote this code which randomly selects dates with a 2 and 3-month window and then calculates how over an overlap would occur 8 consecutive 3 month periods.

It randomly selects dates over a 3-month period of 2-5 days for the illness, and random dates of 10-20 days every 2 months. It then simulates this 15,000 and counts the number of times there is no consecutive overlap for 8 periods of no overlap (8, 3 month periods equals two years).

Thanks and let me know if I can make this question any more clear (note: I may cross-post this question on other forums).

For the code, I'm having trouble getting the formatting right in this forum, so I made a Pastebin