SciPy

prob140.JointDistribution.marginal

JointDistribution.marginal(label)[source]

Returns the marginal distribution of label.

Parameters:
label : String

The label of the variable of which we want to find the marginal distribution.

Returns:
JointDistribution Table

Examples

>>> dist2 = Table().values('Coin1', ['H', 'T'], 'Coin2', ['H', 'T']).probability(np.array([0.24, 0.36, 0.16, 0.24])).to_joint()
>>> dist2.marginal('Coin1')
                        Coin1=H  Coin1=T
Coin2=T                    0.36     0.24
Coin2=H                    0.24     0.16
Sum: Marginal of Coin1     0.60     0.40
>>> dist2.marginal('Coin2')
         Coin1=H  Coin1=T  Sum: Marginal of Coin2
Coin2=T     0.36     0.24                     0.6
Coin2=H     0.24     0.16                     0.4