Probability of a union with probability function of vector

I want to calculate the probability of a discrete random variable.

p1st = EmpiricalDistribution[{0.3, 0.2, 0.5} -> {1, 2, 3}];
p2nd = EmpiricalDistribution[{0.1, 0.3, 0.6} -> {1, 2, 3}];


Required: Calculate the probability of the two vectors combining

A={1,3};
B={2,1};


It is required to calculate the probability of two vectors based on Probability of a union:

Note that

P(A)=Probability[x >= 1, x \[Distributed] p1st] Probability[x >= 3,
x \[Distributed] p2nd];
P(B)=Probability[x >= 2, x \[Distributed] p1st] Probability[x >= 1,
x \[Distributed] p2nd];


We define the process of intersection by choosing the largest element between the two vectors

A-int-B=Max /@ Transpose[{A, B}]={2,3}


So,

P(A-int-B)=Probability[x >= 2, x \[Distributed] p1st] Probability[x >= 3,
x \[Distributed] p2nd];


Therfore, the Probability of a union is:

P(A-un-B)=P(A)+P(B)-P(A-int-B)=0.88


How can this code be written coherently or made into an algorithm that depends only on the inputs only?

Can the law be generalized? Suppose we have three vectors

Do you make it code as in the previous example?

Edit for a more general example

    dista1 = EmpiricalDistribution[{0.05, 0.10, 0.25, 0.60} -> {0, 1, 2,
3}];
dista2 = EmpiricalDistribution[{0.10, 0.30, 0.60} -> {0, 1, 2}];
dista3 = EmpiricalDistribution[{0.10, 0.90} -> {0, 1}];
dista4 = EmpiricalDistribution[{0.10, 0.90} -> {0, 1}];
dista5 = EmpiricalDistribution[{0.10, 0.90} -> {0, 1}];
dista6 = EmpiricalDistribution[{0.05, 0.25, 0.70} -> {0, 1, 2}];
v1 = {2, 2, 0, 0, 1, 1};
v2 = {3, 2, 1, 0, 0, 1};
v3 = {2, 1, 1, 0, 1, 2};
Probability[(x1 >= v1[[1]] && x2 >= v1[[2]] && x3 >= v1[[3]] &&
x4 >= v1[[4]] && x5 >= v1[[5]] &&
x6 >= v1[[6]]) || (x1 >= v2[[1]] && x2 >= v2[[2]] &&
x3 >= v2[[3]] && x4 >= v2[[4]] && x5 >= v2[[5]] &&
x6 >= v2[[6]]) || (x1 >= v3[[1]] && x2 >= v3[[2]] &&
x3 >= v3[[3]] && x4 >= v3[[4]] && x5 >= v3[[5]] &&
x6 >= v3[[6]]), {x1 \[Distributed] dista1,
x2 \[Distributed] dista2, x3 \[Distributed] dista3,
x4 \[Distributed] dista4, x5 \[Distributed] dista5,
x6 \[Distributed] dista6}]


I should get this result:0.611415.

• I've read your question several times, but I don't understand what is going on ... What does px-inA mean? The probability that $x$ belongs to the set $A$? Then why are $A$ and $B$ now two vectors? What does it mean to "combine" two vectors? Note that you can use predicates in Probability (example). Commented Jul 23 at 12:49
• @Domen I will explain the mathematical aspect by modifying the question. Commented Jul 23 at 12:57
• Alright, it's a bit more clear now. However, I think you are calculating it wrong. Why do you write $P(x\geq 1)$ instead of $P(x=1)$? I believe the correct calculation is $$P(A) = P(x_1 = 1 \text { and } x_2=3) = P(x_1=1)P(x_2=3) = 0.3 \times 0.6 = 0.18.$$. Commented Jul 23 at 13:24
• @Domen The theoretical aspect relied on imposes this hypothesis P(x>=i). Commented Jul 23 at 13:32
• Had a few more minutes to look at it and it works. Will post an answer on your other thread. Commented Jul 23 at 23:14

Let $$(X,Y)$$ be a random vector where the probability distribution of the two components are: $$P_X(1) = 0.3, \; P_X(2) = 0.2, \; P_X(3) = 0.5,$$ $$P_Y(1) = 0.1, \; P_Y(2) = 0.3, \; P_Y(3) = 0.6.$$

Given two vectors $$v_1 = (x_1, y_1) = (1, 3)$$ and $$v_2 = (x_2, y_2) = (2, 1)$$, what is the probability of vector $$(x, y)$$ such that $$(x \geq x_1 \wedge y \geq y_1) \vee (x \geq x_2 \wedge y \geq y_2)?$$

distX = EmpiricalDistribution[{0.3, 0.2, 0.5} -> {1, 2, 3}];
distY = EmpiricalDistribution[{0.1, 0.3, 0.6} -> {1, 2, 3}];

v1 = {1, 3};
v2 = {2, 1};
Probability[
(x >= v1[[1]] && y >= v1[[2]]) || (x >= v2[[1]] && y >= v2[[2]]),
{x \[Distributed] distX, y \[Distributed] distY}
]
(* 0.88 *)


You can easily add another vector:

v3 = {1, 2};
Probability[
(x >= v1[[1]] && y >= v1[[2]]) ||
(x >= v2[[1]] && y >= v2[[2]]) ||
(x >= v3[[1]] && y >= v3[[2]]),
{x \[Distributed] distX, y \[Distributed] distY}
]
(* 0.97 *)

• If I apply this code to more general data, I do not get the desired result. Commented Jul 23 at 15:20
• What is "more general data"? Please edit your initial question and add more relevant cases. Commented Jul 23 at 15:21
• I've modified the question. Commented Jul 23 at 15:32
• Thanks for the help... I used your answer and it is generally very accurate Commented Jul 23 at 20:08

You can use Multinomial Distribution and TransformedDistribution and Probability,e.g.

m = MultinomialDistribution[1, {0.3, 0.2, 0.5}];
n = MultinomialDistribution[1, {0.1, 0.3, 0.6}];
t1 = TransformedDistribution[{x, y, z} . {1, 2, 3}, {x, y,
z} \[Distributed] m];
t2 = TransformedDistribution[{x, y, z} . {1, 2, 3}, {x, y,
z} \[Distributed] n];
Probability[(x >= 1 && y >= 3) || (x >= 2 &&
y >= 1), {x \[Distributed] t1, y \[Distributed] t2}]


-> 0.88