Skip to main content
added 64 characters in body; edited title
Source Link
Sumner18
  • 245
  • 1
  • 6

Sampling into categories to get Probability of filling M boxes with 2 or more: probabilities elements when sampling S elements from N total elements

Similar to this question, Frequency of Item in Combination.

I am randomly sampling 99S objects out of N=99 objects into 9 boxes 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.Question 1: I want to find the probability of M boxes having 2 or more objects, dependent on how many objects I sample, S out of N. Currently I am only able to do so by simulation (see code below), which is RNG dependent, but accurate. Question 2: 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.

Edits: Clarification

Sampling into categories to get 2 or more: probabilities

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.

Probability of filling M boxes with 2 or more elements when sampling S elements from N total elements

Similar to this question, Frequency of Item in Combination.

I am randomly sampling S objects out of N=99 objects into 9 boxes labeled by a single character, "A-I". Question 1: I want to find the probability of M boxes having 2 or more objects, dependent on how many objects I sample, S out of N. Currently I am only able to do so by simulation (see code below), which is RNG dependent, but accurate. Question 2: 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.

Edits: Clarification

edited title
Link
Sumner18
  • 245
  • 1
  • 6

Sampling into categories with conditionsto get 2 or more: probabilities

Source Link
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.