Just to be clear: probability is not my super-power but:
Ain't that case of multivariate hypergeometric distribution?
https://en.wikipedia.org/wiki/Hypergeometric_distribution#Multivariate_hypergeometric_distribution
and the fact that:
P(3,4,5) is independent from P(3,5,4), etc,
P(3,4,5 or 3,5,4) = P(3,4,5) + P(3,5,4) - P(3,4,5 and 3,5,4) = P(3,4,5) + P(3,5,4)
so probability P("I have 3:4:5 sequence") would be just sum of P(3,4,5) + P(3,5,4) + ...+ P(5,4,3).
data have;
input grp $ r g b;
cards;
a 4 4 4
b 3 4 5
b 3 5 4
b 4 3 5
b 4 5 3
b 5 3 4
b 5 4 3
;
run;
/*
a = get all 4
b = get 3:4:5
*/
data want;
rn=8;
gn=8;
bn=8;
N=rn+gn+bn;
set have;
k=r+g+b;
p = /* https://en.wikipedia.org/wiki/Hypergeometric_distribution#Multivariate_hypergeometric_distribution */
(comb(rn, r)
*comb(gn, g)
*comb(bn, b)
)
/comb(n, k)
;
put (_ALL_) (=/);
if _N_=2 then sum=0;
sum+p;
run;
proc print;
run;
[EDIT:] proc print:
Bart
... View more