# How to test whether event A affects the frequency at which event B occurs

I conducted an experiment in which I measured the occurrence of some event A over time. I then intervened in the system, periodically introducing event B.

I hypothesise that event B affects the probability that event A will occur. I would also like to visualise the probability of event A occurring in the time period prior to and following event B.

I am unfamiliar with this type of analysis and would greatly appreciate answers to the above specific problems as well as any pointers to reading material. I would also appreciate suggestions from computationally inclined people for any python / R / matlab packages or routines useful for this type of analysis.

• You could hypothesise that the frequency of A occurring follows a Poisson distribution. You can calculate $lambda$ for $P(A)$, and $P(A|B)$ separately to demonstrate the inequality. – Zhubarb May 8 '19 at 12:45
• Are you looking at A as a continuous measure (1,2,3 etc) or a categorical measure (either A occurs vs does not occur, 1 or 0)? – Prometheus May 10 '19 at 12:22
• Thanks both. I am looking at A as a categorical measure. – Ruairi O'Sullivan May 14 '19 at 23:05