# Combining many probabilities, modifying, seeking general formula

CONTEXT

I need to combine the probability of occurrence of many thousands of events for millions of individuals (trees) in an agent-based/individual-based simulation model developed in NetLogo (agent-based simulation) and Go (to parallelize probability calculations). For those interested, the probabilities are for infection events that result from multiple other events, e.g., exposure, transmission, each with their own probabilities, for individual trees in a forested landscape.

Each individual can potentially be infected by thousands of other individuals in its surroundings. The full model includes millions of individuals, and so I am designing the model to calculate, modify, and update probabilities as quickly and efficiently as possible as conditions in the simulation change.

Based on the probability math that, if $C_1$ and $C_2$ are events that are independent and not mutually exclusive and occur with different probabilities $p_1$ and $p_2$, with the overall probability $P$ calculated as:

$P(C_1&space;\cup&space;C_2)&space;=&space;P(C_1)&space;+&space;P(C_2)&space;-&space;P(C_1)*(C_2)&space;=&space;p_1&space;+&space;p_2&space;-&space;p_1*p_2$

or

$P(C_1&space;\cup&space;C_2)&space;=&space;1&space;-&space;P(\overline{C_1})*P(\overline{C_2})&space;=&space;1&space;-&space;(1-p_1)*(1-p_2)$

In addition, each event probability $p_n$ is the product of two other probabilities $p_a$ and $p_{b,n}$, where $p_a$ is constant across events but $p_{b,n}$ differs between events).

Therefore, the overall equation used in my model to calculate each individual tree's probability of infection $P_\text{inf,i}$ by any other individual (i.e., combining probability of many such infection events) is as follows:

$P(C_1&space;\cup&space;C_2&space;\&space;\cup&space;...&space;\cup&space;\&space;C_N)&space;=&space;1&space;-&space;P(\overline{C_1})*P(\overline{C_2})*&space;...&space;*P(\overline{C_N})$

or

$P(C_1&space;\cup&space;C_2&space;\&space;\cup&space;...&space;\cup&space;\&space;C_N)&space;=&space;1&space;-&space;(1-p_ap_{b1})*(1-p_ap_{b2})*&space;...&space;*(1-p_ap_{bN})$

or

$P_\text{inf,i}&space;=&space;1&space;-&space;\prod_{n=1}^{N}{(1-p_{a}p_{bn})}=&space;1-((1-p_{a}p_{b1})*(1-p_{a}p_{b2})*...*(1-p_{a}p_{bn}))$

Over time in the simulation, the value of $p_a$ for a given individual tree will change (depending on changing state variables of the individual trees) while the values of $p_{b,n}$ remain constant. Therefore, as the value of $p_a$ changes between time steps, the value of $P_\text{inf,i}$ will need to be modified to reflect this change.

However, given the amount of values involved in the calculation (thousands of calculations for each of millions of individual trees), it is not practical to store each value of $p_{b,n}$ for each individual (tree) once the (maybe not possible given the constraints of the software and computing resources I am using). In addition, I want to limit the amount of infomation that passes back and forth between NetLogo (which stores the states and probabilities for each individual) and Go (where probabilities are calculated but not stored) to avoid exceeding memory constraints?

Rather than recalculate the overall probability from scratch, which requires lots of time and computing resources, I want to be able to modify the overall probability $P_\text{inf,&space;i}$ for a given individual tree based on the change in the value of $p_{a}$.

QUESTION

What is a generalized form for calculating the probability that at least one event occurs given N independent events with different probabilities given the criteria above?

How can I efficiently implement the modification of each individual's probability of infection without having to re-calculate from scratch?