Email firstname.lastname@example.org to sign up to receive news and updates
Mega Millions Lottery Numbers
Mega Millions is one of the most popular lotteries in existence. I thought I'd take a stab at using probability and statistics to look at methods of generating numbers for playing Mega Millions.
As I see it, there are two main ways to create numbers. The first way is completely random. The second way is random, but basing the draws on actual past data.
The dataset I'm using in my R program is of past draws. The b1-b5 are the balls 1 through 5, and the mb is, you guessed it, the Mega Ball. Here
is what the dataset looks like for a few rows:
b1 b2 b3 b4 b5 mb
10 12 21 29 65 10
3 14 15 25 48 8
1 39 52 69 72 1
20 27 38 49 66 2
When I run my program, I get two graphs. The first one is a boxplot for each ball
The second graph is a distribution for each ball
Here is my R script with comments:
#program to predict Mega Millions numbers
#read in dataset of historical picks
#get summary statistics of dataset
#boxplots of winning numbers
#histograms of individual balls
#picks based on actual historic data
for (i in 1:k)
#sample from winners to predict winners
#b1 < b2 < b3 < b4 < b5, mb is independent (ie. it can duplicate b1-b5 numbers)
if (b1pred < b2pred && b2pred< b3pred && b3pred < b4pred && b4pred < b5pred) print(c(b1pred,b2pred,b3pred,b4pred,b5pred,mbpred))
#rules changed to these ~ 10/2013
#picks based on simulated data, not actual data
#b1-b5 from 1-75 without replacement
#mb from 1-15
for (i in 1:k)
Will this program make one a millionaire? Probably not. However, it is a great use of probability and statistics to at least try and understand the Mega Millions lottery data.
Note, on 10/2017, the rules changed. The 5 white balls are now from 1 to 70, and the Mega Ball is from 1 to 25. In my "live" code I have made the appropriate changes.
Thanks for reading.
Please anonymously VOTE on the content you have just read:Like:
If you enjoyed any of my content, please consider supporting it in a variety of ways:
- PLEASE take a moment to check out two GoFundMe fundraisers I set up. The idea is to make it possible for me to pursue my passions. My goal is to be able to create free randomized educational worksheets and create poetry on a full-time basis. THANK YOU for your support!
- Email email@example.com to sign up to receive news and updates
- Donate any amount via PayPal
- Take my Five Poem Challenge
- Subscribe to my YouTube channel
- Visit my Amazon author page
- Buy what you need on Amazon using my affiliate link
- Follow me on Twitter here
- Buy ad space on Statisticool.com
AFFILIATE LINK DISCLOSURE: Some links included on this page may be affiliate links. If you purchase a product or service with the affiliate link provided I may receive a small commission (at no additional charge to you). Thank you for the support!