joint_probability
joint_probability(
p,
dependency='independent',
indicators=None,
correlation=None,
)Joint probability of multiple events.
Mirrors the C# Probability.JointProbability. The plain form dispatches on a dependency assumption alone ("independent" multiplies, "positive" takes the minimum, "negative" clamps the excess of the sum over 1). Passing indicators (a 0/1 flag per component, selecting which components participate) switches to the indicator-aware form; passing correlation too routes dependency="correlation" through Haden Smith’s modification of Pandey’s Product-of-Conditional-Marginals method (HPCM).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| p | array_like | Marginal probabilities. | required |
| dependency | ('independent', 'positive', 'negative', 'correlation') | "correlation" requires both indicators and correlation – the underlying C# method itself returns nan for that combination rather than raising an error, but this wrapper rejects it up front and names the missing argument(s), rather than handing back a silent nan. |
"independent" |
| indicators | array_like | 0/1 vector, the same length as p. |
None |
| correlation | array_like | len(p) by len(p) correlation matrix; requires indicators. |
None |
Returns
| Name | Type | Description |
|---|---|---|
| float |
Examples
>>> from corehydropy import joint_probability
>>> joint_probability([0.5, 0.5])
0.25
>>> joint_probability([0.5, 0.5], dependency="positive")
0.5