Comments on: Given an average rate how do I calculate how often to do something?
http://ask.metafilter.com/267055/Given-an-average-rate-how-do-I-calculate-how-often-to-do-something/
Comments on Ask MetaFilter post Given an average rate how do I calculate how often to do something?Tue, 19 Aug 2014 11:10:06 -0800Tue, 19 Aug 2014 11:22:51 -0800en-ushttp://blogs.law.harvard.edu/tech/rss60Question: Given an average rate how do I calculate how often to do something?
http://ask.metafilter.com/267055/Given-an-average-rate-how-do-I-calculate-how-often-to-do-something
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? <br /><br /> 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.post:ask.metafilter.com,2014:site.267055Tue, 19 Aug 2014 11:10:06 -0800sevenlessprobabilitygardeningseedsgerminationresolvedBy: pipeski
http://ask.metafilter.com/267055/Given-an-average-rate-how-do-I-calculate-how-often-to-do-something#3877796
A germination rate of 0.8 is the same as 80%<br>
To get 25 seeds to germinate, you'd need to plant 31.25 on average, i.e. 25 / 0.8.<br>
I'm not sure you can infer much more from the numbers at hand.<br>
<br>
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.comment:ask.metafilter.com,2014:site.267055-3877796Tue, 19 Aug 2014 11:22:51 -0800pipeskiBy: caek
http://ask.metafilter.com/267055/Given-an-average-rate-how-do-I-calculate-how-often-to-do-something#3877801
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.<br>
<br>
You can read up on it e.g. <a href="http://stattrek.com/probability-distributions/binomial.aspx">here</a> if you want implement the (conceptually simple but rather intricate) calculation yourself.<br>
<br>
Or you can use, e.g. <a href="http://stattrek.com/online-calculator/binomial.aspx">this calculator</a> 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.<br>
<br>
That is to say, you need to plant 35 seeds to have at least a 90% chance of getting at least 25 to germinate.<br>
<br>
If you want to get <em>exactly</em> 25 to germinate, there is no way to make the probability of that greater than 90%. You can maximize the probability of <em>exactly</em> 25 germinating by using pipeski's calculation, but that's probably not what you want.comment:ask.metafilter.com,2014:site.267055-3877801Tue, 19 Aug 2014 11:27:20 -0800caekBy: caek
http://ask.metafilter.com/267055/Given-an-average-rate-how-do-I-calculate-how-often-to-do-something#3877808
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.comment:ask.metafilter.com,2014:site.267055-3877808Tue, 19 Aug 2014 11:37:51 -0800caekBy: zscore
http://ask.metafilter.com/267055/Given-an-average-rate-how-do-I-calculate-how-often-to-do-something#3877810
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.comment:ask.metafilter.com,2014:site.267055-3877810Tue, 19 Aug 2014 11:39:04 -0800zscoreBy: fshgrl
http://ask.metafilter.com/267055/Given-an-average-rate-how-do-I-calculate-how-often-to-do-something#3877816
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.comment:ask.metafilter.com,2014:site.267055-3877816Tue, 19 Aug 2014 11:49:22 -0800fshgrlBy: Philosopher Dirtbike
http://ask.metafilter.com/267055/Given-an-average-rate-how-do-I-calculate-how-often-to-do-something#3877837
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:<br>
<pre><br>
> y = 25 # At least this many to germinate<br>
> p = .8 # Probability of germinating<br>
> N = y:35 # Range of numbers to try<br>
> <br>
> # This returns the probability of getting at least y<br>
> # germinations for each N <br>
> prob = 1 - pbinom(y - 1, N, p)<br>
> <br>
> cbind(N, prob)<br>
N prob<br>
[1,] 25 0.003777893<br>
[2,] 26 0.022667359<br>
[3,] 27 0.071779971<br>
[4,] 28 0.160182671<br>
[5,] 29 0.283946452<br>
[6,] 30 0.427512438<br>
[7,] 31 0.571078423<br>
[8,] 32 0.698236868<br>
[9,] 33 0.799963623<br>
[10,] 34 0.874563244<br>
[11,] 35 0.925290986<br>
</pre>comment:ask.metafilter.com,2014:site.267055-3877837Tue, 19 Aug 2014 12:21:20 -0800Philosopher DirtbikeBy: RedOrGreen
http://ask.metafilter.com/267055/Given-an-average-rate-how-do-I-calculate-how-often-to-do-something#3877950
<i>How do I calculate how many seeds to plant to give me a 'y' probability of getting 'z' seeds to germinate?</i><br>
<br>
This problem is a lot more tractable if you want 'y' probability of <b>at least</b> '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.)</b>comment:ask.metafilter.com,2014:site.267055-3877950Tue, 19 Aug 2014 14:17:07 -0800RedOrGreenBy: sevenless
http://ask.metafilter.com/267055/Given-an-average-rate-how-do-I-calculate-how-often-to-do-something#3878179
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.comment:ask.metafilter.com,2014:site.267055-3878179Tue, 19 Aug 2014 20:19:33 -0800sevenless