A few days ago, I was doing some statistical research for Betafreak Minecraft to find a good way to allow items to have only one byte for a health bar, yet still allow for more than 256 uses. Using my statistics skills, I came up with the solution below: the Multi-Geometric Distribution.
Basically, the multi-geometric distribution (as I call it) applies to a random variable whose value is the number of attempts requried to attain m successes, when the probability of success is p. In other words, you perform a chance event with odds of success p (e.g. flipping a coin has p at .5) and increment x every time, and you stop once you have m successes. If you keep doing that many times and graphed all your x's in a histogram (bar graph) or stem-and-leaf plot, that would be the multi-geometric distribution for x.
Using my trusty TI 84 PSE and a few test scenarios (such as flipping a coin until you get 3 heads and rolling a die until you get 2 6's), I was able to determine the following formulas (given a particular m and p):
► Probability of x being a: P(x=a) = (x-1 nCr x-m)*(1-p)^(x-m)*p^m
► Expected (mean) value: μ=m/p
► Standard deviation from the mean : σ = sqrt(m(1-p)/p^2)
Rearranging the formulas, we can determine m and p from a given μ and σ (if you were too lazy to click the link, x lies within 2σ of the mean about 95% of the time):
m = μp
p = μ / (σ^2 + μ)
How is this useful? In the calculator programming world, it is actually quite useful. As I detailed above, you might want to save memory on a health bar, but want more than the possible range of values offered by said health bar. You could also use this for an intermittent speed - randomly determine whether to move or not every time you try.
Edit by Merth: Fixed the list.
Basically, the multi-geometric distribution (as I call it) applies to a random variable whose value is the number of attempts requried to attain m successes, when the probability of success is p. In other words, you perform a chance event with odds of success p (e.g. flipping a coin has p at .5) and increment x every time, and you stop once you have m successes. If you keep doing that many times and graphed all your x's in a histogram (bar graph) or stem-and-leaf plot, that would be the multi-geometric distribution for x.
Using my trusty TI 84 PSE and a few test scenarios (such as flipping a coin until you get 3 heads and rolling a die until you get 2 6's), I was able to determine the following formulas (given a particular m and p):
► Probability of x being a: P(x=a) = (x-1 nCr x-m)*(1-p)^(x-m)*p^m
► Expected (mean) value: μ=m/p
► Standard deviation from the mean : σ = sqrt(m(1-p)/p^2)
Rearranging the formulas, we can determine m and p from a given μ and σ (if you were too lazy to click the link, x lies within 2σ of the mean about 95% of the time):
m = μp
p = μ / (σ^2 + μ)
How is this useful? In the calculator programming world, it is actually quite useful. As I detailed above, you might want to save memory on a health bar, but want more than the possible range of values offered by said health bar. You could also use this for an intermittent speed - randomly determine whether to move or not every time you try.
Edit by Merth: Fixed the list.