Some mathematical topics can be useful in various real life cases… Expected value is one of these that can inform mathematical thinking in many practical ways. The basic formula:
Expected value = sum( Xi * Pi )
Basics of Expected Value calculation
Suppose one wagers $1 on a game where we will lose the dollar if a flipped coin is heads. If it’s tails, you win 3 more dollars. The Expected earning is the sum of (x*p) where x = expected value, p=probability.
| X | P | x*p |
| -$1 | 0.5 | -.5 |
| $3 | 0.5 | 1.5 |
Taking a sum of x*p, in this simple case, one would expect over time to have an average of +1 dollar playing a round of this game. Not likely one that a casino would be offering here. Let’s look at a real lottery dollar amount:
| x | p | x*p |
| 1.60E+06 | 1.62979101515771E-07 | 0.260766562425233 |
| 800 | 4.10703086721189E-05 | 0.0328562469376951 |
| 40 | 0.00210375731055665 | 0.0841502924222662 |
Summing to about 38 cents expected value of the ticket. If a lotto ticket costs more than 38 cents, this isn’t a good deal, calculating expected-value of the lotto ticket. Not surprising. But what about some actual investments like CDs and stocks?
A CD can give a constant rate of, say 4% over a year. Stocks might go +10% or -10%. And maybe more times than not it is increased. Let’s calculate with hypothetical gains on $1000 investment:
| x | p | x*p |
| 100 | 0.7 | 70 |
| -100 | 0.3 | -30 |
In this theoretical case if you knew the probability above, the expected return on your investment would be about $40. Now that would be same as a 4% CD’s expected value – but not including the risk of losing much of it, or the chance of large growth. So “expected value” doesn’t tell the whole picture. Also this doesn’t consider potential world events and inflation. Of course this is not investment advice on any particular strategy.
Example 2: Should I start a business?
The Bureau of labor statistics had noted that 24% of USA businesses fail within the first year. Well, this depends on the type of of business, and in fact depends on what region the business is started in, so this is not something easy to predict. But suppose you know there is 10% chance your idea will make a million within a year. There is a chance it will fizzle, break even (if you’re lucky) and you will invest 200,000 and lots of work in this business venture:
| x | p | x*p |
| 800000 | 0.1 | 80000 |
| 0 | 0.66 | 0 |
| -200000 | 0.24 | -48000 |
The actual expected value would not be a million, but rather $32K dollars.
Again, not business advice – you would have to crunch your own numbers.
Example 3: New vaccines
Many had a lot of questions on the new mRNA vaccines back in 2021, and there wasn’t that much data to go on… but after a year or multiple years, we now have some data we can process…
I started a process to read the whole VAERS list – the list of unconfirmed adverse reactions. You can download and run it from here:
I used a Python phrase detection – a “natural language processing” library feature, to extract the phrases from each of these and then let you see which are the most common.
This is a bit different from the above, but it is a way to see what the expected value is – is it really a likely sever effect or is it literally one in a million vs hundreds out of a million?
Preparing the reader script
As noted on the Pypi page, run:
python3 -m venv VAERSReader
cd VAERSReader
source bin/activate
python3 -m pip install textblob
python -m textblob.download_corpora
I downloaded 2025 .csv file of VAERS and check the disclaimer – “VAERS data should be used with caution as numbers and conditions do not reflect data collected during follow-up.” If you’re interested in most recent data change the line to:
for csvfile in ['2025VAERSData.csv','2026VAERSData.csv']:
and run it after downloading those to the folder. It will ask you what to search for:
$ python3 read.py
words to search: (enter vaccine)
If you are searching for flu vaccine expected outcomes, just as an example, run the above and it will crunch the data for a long while, then give you numbered list of the most common phrases.
