homechevron_rightProfessionalchevron_rightStatistics

Number to Probability

This online calculator takes a list of events along with number of times the particular event occurred and calculates the probability (and log probability) of each event by dividing event count to the total number of events.

Let's suppose you analyze some random data by nature, and you count the number of times a particular value appeared in your data. Or, in terms of probability theory, a number of times a particular event has happened.

A good example of such a task is the analysis of letter frequencies in the text. You have the text, and then you count how much each letter of the alphabet appeared in your text. After that, you probably want to compare your results with theoretical letter (or bigrams, or whatever you count) frequencies, which are often given by probabilities. So, you need to convert from counts to probabilities. It is actually easy - you need to sum all counts and then divide each letter's value to the total number of letters in the text. But, to do it by hand can be boring and tedious - say, you need to import your data to a spreadsheet program, sum the column, fill another column with results of division, etc.

That's why I've created the calculator below. It takes a list of events and the number of times the particular event occurred and calculates the probability of each event by dividing the event count by the total number of events. Also, if there are many events, sometimes you need logarithms of probabilities instead of probabilities - and I've included this option as well. However, note that you can't take the log of zero, so if any event has a count of zero, a log is computed for some small value, in this case, 0.01 divided by total count.

Paste your data, tweak regular expressions used for parsing if needed, then choose the result columns' separator and what values you want to see in the results.
As for regular expression, the only requirement is to produce two capture groups - first for event name and second for event count; by default, it assumes that you have the event name and count separated by a semicolon.

I hope it can save some time for somebody. Enjoy.

PLANETCALC, Count to Probability

Count to Probability

Result
 

URL copied to clipboard
Creative Commons Attribution/Share-Alike License 3.0 (Unported) PLANETCALC, Number to Probability

Comments