ENnies - let's launch the voting booth!


log in or register to remove this ad

Well I've certainly been having fun with all the stats for the voting booth, although so far it hasn't made any difference to the actual winners and losers over a simple average so which system Russ will use I'm not sure.

One thing, Mr Olgar Shiverstone, I couldn't find an easy way of getting that nice percentage that you managed to produce. The function is in Excel but I wondered if there was a simple way to calculate it as I'm trying to keep the whole thing in PHP.

Ta.

(p.s. who let this get down to page 4, terrible!)
 

Blacksway said:
One thing, Mr Olgar Shiverstone, I couldn't find an easy way of getting that nice percentage that you managed to produce. The function is in Excel but I wondered if there was a simple way to calculate it as I'm trying to keep the whole thing in PHP.

Does PHP have a function that calculates percentages of a standard normal?

Unfortunately, if PHP doesn't have a function that computes percentages as a function of a standard normal distribution, there really isn't an easy way to do it (which is why even in the computer age we still use Z-tables).

The function that returns the percentage is:

[Integrated from -infinity to X] (1 / SQRT(2 * pi)) * EXP (-1 * (x^2)/2)

So of course the integration is the problem. You could create a numerical integration function that stepped through the entire integration at very small intervals summing rectangles as an approximation, ie (translate this into PHP or whatever):

percent = 0
for i = -5 to x step 0.01
percent = percent + ((1 / SQRT(2* pi)) * exp (-1 * (i^2)/2)) * 0.01
next
percent=percent*100


Which should give a rough approximation (x is the normed value of the individual score ranging from -3 to +3). Smaller steps (change all 0.01 to 0.0001, for example) will yield a more precise value. I'm not sure exactly what method Excel uses to do this integration.

Edit: Forgot the square root of 2*pi
 
Last edited:



Pets & Sidekicks

Remove ads

Top