Skip to main content
1 of 3
Sumner18
  • 245
  • 1
  • 6

Sampling into categories with conditions

Similar to this question, Frequency of Item in Combination.

I am sampling 99 objects labeled by a single character, "A-I". Hence, each letter appears 4 times. I want to get probabilities of sampling any given letter 2 or more times, dependent on how many objects I sample. Currently I am only able to do so by simulation (see , which is RNG dependent, but accurate. Question: Is there a distribution I can follow here? I'm bouncing between binomial and hypergeometric, but I am uncertain how to implement it.

mycountL <- double(9)
names(mycountL) <- LETTERS[1:9]

# Change this for sample drawing size
xTimes = 18

set.seed(12)
for(i in 1:10000){
  nL <- names(which(table(sample(rep(LETTERS[1:9],11), xTimes ))>=2))
  lL <- length(nL)
  mycountL[lL] <- mycountL[lL]+1
}

mycountL/10000 #For probabilities. Drawing 18 times is the lowest sample possible to draw exactly 2 in each LETTER, except that it is highly unlikely.
Sumner18
  • 245
  • 1
  • 6