guardians_song: A crop from FE7's Arcadia CG showing Nergal and two villagers chatting over scrolls. (scholarly)
guardians_song ([personal profile] guardians_song) wrote2013-02-14 09:04 pm

Random Fact:

An "urn model" in probability is a certain kind of model for random walks using urns. (Please don't call me Captain Obvious.) Typically, you have r red balls and b blue balls [be mature about this, darn it!] in an urn which are evenly mixed together, and you pull one ball out at random and, depending upon the color of the ball, do something such as changing the color of the ball and putting it back in, adding a given number of balls of a certain color to the urn, or performing an operation on another urn. At the end of the process, you change the state of a certain system depending upon your results, and repeat the process.

A simple example would be having two balls in an urn, one red and one blue, picking one ball, and moving a token one space further or one space backward on an infinite line depending upon whether the ball chosen was red or blue, respectively. Then, you put the ball you chose back in the urn, and repeat the process.

Hypothetically, if not for the crazy two-RN hit chance, you could model a Fire Emblem attack sequence [without counterattack] as follows: 
(Hit chance is X%, crit rate is C%, attack strength is A, and enemy HP is E.)
Put X black balls and 100-X white balls in Urn 1 and C red balls and 100-C blue balls in Urn 2. Then, remove a ball from Urn 1. If it's white, end the process there and do nothing. If it's black, proceed to Urn 2; if the ball chosen is red, subtract 3A Hit Points from E and end the process - otherwise, subtract A Hit Points from E and end the process. Repeat until enemy keels over. :B

Modeling the average-of-the-two-RNs would require weighting the balls, methinks, and that kind of ruins the point. D|

Alternatively, you could model an NPC randomly moving about by having A red balls, B white balls, C blue balls, and D green balls in the urn, then moving up if the ball picked is red, left if the ball picked is white, down if the ball picked is blue, and right if the ball picked is green. You get the idea.

The usefulness of this is that it gives you some way to model weirder transition chances in a way you can grasp. Say, for instance, that you have r red balls, b blue balls, and g green balls in the urn, and you pick one ball and, before replacing it, pick another ball - moving the state up a notch if you pick the same color of ball twice, moving down if you pick red and then blue (or vice versa), and staying constant if you picked green and then a different color (or vice versa).

Then, your transition probabilities are as follows:
Moving up: (r(r-1)+b(b-1)+g(g-1))/[(r+b+g)(r+b+g-1)]
Not moving: (2rg+2bg)/[(r+b+g)(r+b+g-1)]
Moving down: (2br)/[(r+b+g)(r+b+g-1)]
...You wouldn't know quite what to make of those if you ran across them in another context, would you? :P But this way, you actually have some way of understanding what crazy stuff is going on. And it would get more complicated if you performed actions based upon your results (such as changing a ball to blue or green depending upon what the color of the first ball you picked was) before proceeding onto the next step, of course...