# Given an average rate how do I calculate how often to do something?

August 19, 2014 11:10 AM Subscribe

I get seed packets that (usually) give a germination rate. How do I calculate how many seeds to plant to give me a 'y' probability of getting 'z' seeds to germinate?

For example, my Bloomsdale spinach has a germination rate of 0.8. How many seeds should I plant to have a 90% chance of getting 25 seeds to germinate? I'd also like to know the confidence interval formula for this problem. I'm mainly interested in this as a programming exercise for myself. I know something about probability and statistics, but I'm not sure where to start on this.

For example, my Bloomsdale spinach has a germination rate of 0.8. How many seeds should I plant to have a 90% chance of getting 25 seeds to germinate? I'd also like to know the confidence interval formula for this problem. I'm mainly interested in this as a programming exercise for myself. I know something about probability and statistics, but I'm not sure where to start on this.

Assuming each seed's germination is independent from every other (which is a dubious assumption if they're all planted in the same conditions), this is a binomial probability calculation.

You can read up on it e.g. here if you want implement the (conceptually simple but rather intricate) calculation yourself.

Or you can use, e.g. this calculator with P = 0.8, number of successful trials, X = 25, and vary the number of trials. For your numbers, you need n = 35 to get P(X ≥ 25) ≥ 0.9.

That is to say, you need to plant 35 seeds to have at least a 90% chance of getting at least 25 to germinate.

If you want to get

posted by caek at 11:27 AM on August 19, 2014 [5 favorites]

You can read up on it e.g. here if you want implement the (conceptually simple but rather intricate) calculation yourself.

Or you can use, e.g. this calculator with P = 0.8, number of successful trials, X = 25, and vary the number of trials. For your numbers, you need n = 35 to get P(X ≥ 25) ≥ 0.9.

That is to say, you need to plant 35 seeds to have at least a 90% chance of getting at least 25 to germinate.

If you want to get

*exactly*25 to germinate, there is no way to make the probability of that greater than 90%. You can maximize the probability of*exactly*25 germinating by using pipeski's calculation, but that's probably not what you want.posted by caek at 11:27 AM on August 19, 2014 [5 favorites]

By the way, if you plant 31 seeds as recommended by pipeski, 25 germinations is indeed the most likely outcome, but that isn't the same as saying it will occur 90% of the time. In fact, 25 germinations from 31 seeds is rather unlikely in an absolute sense: if you do the binomial calculation, you can show it will only happen about 10% of the time.

posted by caek at 11:37 AM on August 19, 2014

posted by caek at 11:37 AM on August 19, 2014

You can avoid a tricky calculation by simulating a lot of trials when planting a certain number of seeds. That is, do a million trials where you plant 30 virtual seeds and see what proportion of them have at least 25 germinate. If it's less than 90%, increment seeds by 1 and try again.

posted by zscore at 11:39 AM on August 19, 2014

posted by zscore at 11:39 AM on August 19, 2014

You can't calculate the confidence interval from that data. It's just a summary of results, you'd need the raw data they pulled the 80% figure from.

posted by fshgrl at 11:49 AM on August 19, 2014 [2 favorites]

posted by fshgrl at 11:49 AM on August 19, 2014 [2 favorites]

You want to use the probability of at least y germinations from N seeds, where y is distributed as a binomial with probability p. In R, this can be computed with the pbinom function. Here's some code:

posted by Philosopher Dirtbike at 12:21 PM on August 19, 2014 [1 favorite]

> y = 25 # At least this many to germinate > p = .8 # Probability of germinating > N = y:35 # Range of numbers to try > > # This returns the probability of getting at least y > # germinations for each N > prob = 1 - pbinom(y - 1, N, p) > > cbind(N, prob) N prob [1,] 25 0.003777893 [2,] 26 0.022667359 [3,] 27 0.071779971 [4,] 28 0.160182671 [5,] 29 0.283946452 [6,] 30 0.427512438 [7,] 31 0.571078423 [8,] 32 0.698236868 [9,] 33 0.799963623 [10,] 34 0.874563244 [11,] 35 0.925290986

posted by Philosopher Dirtbike at 12:21 PM on August 19, 2014 [1 favorite]

*How do I calculate how many seeds to plant to give me a 'y' probability of getting 'z' seeds to germinate?*

This problem is a lot more tractable if you want 'y' probability of

**at least**'z' events, each of which has a probability 'p'. How many seeds do you plant so that you have at least 25 germinate with 90% probability? (And in practice that's usually what you want anyway.)

posted by RedOrGreen at 2:17 PM on August 19, 2014

Thanks everyone for the answers and help. For some reason I think of the 80% germination as a rate and think of poisson distributions which doesn't work out. This isn't the first time I've made this sort of mistake. And, redorgreen is right: at least 'z' events is what I want.

posted by sevenless at 8:19 PM on August 19, 2014

posted by sevenless at 8:19 PM on August 19, 2014

This thread is closed to new comments.

To get 25 seeds to germinate, you'd need to plant 31.25 on average, i.e. 25 / 0.8.

I'm not sure you can infer much more from the numbers at hand.

And of course, germination rates will vary according to the conditions (humidity, temperature, light, pathogens, age and storage conditions of the seeds, etc.), so the 0.8 figure may not apply in your particular situation.

posted by pipeski at 11:22 AM on August 19, 2014 [2 favorites]