
314 Statistics and Data Analysis for Microarrays Using R and Bioconductor
pick from, m = 10 numbers on a ticket, and the lottery extracts k = 22
winning numbers. The winning “core” o f a ticket can be any combination of
l = 8 out of the k = 22 winning numbers, or
22
8
. For each such combination,
one can obtain a winning ticket by adding m − l = 2 “losing’ numbers fro m
the remaining n − k = 58 numbers which were not picked during the draw.
The probability will be:
p =
22
8
·
58
2
80
10
(10.7)
The following R function will calculate the probabilities of winning in each
case:
> keno_prob <- function(n,m,k,l){
+ # n numbers available, m numbers on a ticket, ...