Add test for multidim combinations
@@ -570,3 +570,22 @@ class DiscreteDistributionLabeledTests(unittest.TestCase):
self.assertTrue(
np.all(xa.expected() == np.concatenate([x.expected(), a.expected()]))
)
+
+ # Combine multidimensional labeled
+ d = DiscreteDistributionLabeled(
+ pmv=np.array([0.3, 0.7]), data=np.array([-0.5, -1.0]), var_names="d"
+ )
+ e = DiscreteDistributionLabeled(
+ pmv=np.array([0.3, 0.7]), data=np.array([0.0, -1.0]), var_names="e"
+ )
+ de = combine_indep_dstns(d, e)
+
+ abcde = combine_indep_dstns(abc, de)
+ self.assertTrue(
+ np.allclose(
+ abcde.expected(
+ lambda x: np.array([x["d"], x["e"], x["a"], x["b"], x["c"]])
+ ),
+ np.concatenate([de.expected(), abc.expected()]),
+ )
+ )
