Probability and statistics bloghttp://www.statisticsblog.com
In Monte Carlo We TrustTue, 24 May 2016 17:58:45 +0000en-UShourly1https://wordpress.org/?v=4.3.17Visualising random variables, Terence Tao stylehttp://www.statisticsblog.com/2016/05/visualising-random-variables-terence-tao-style/
http://www.statisticsblog.com/2016/05/visualising-random-variables-terence-tao-style/#commentsTue, 24 May 2016 17:58:45 +0000http://www.statisticsblog.com/?p=1866Recently mathematician Terence Tao posted some ruminations on how to visualize the different values a random variable could take. He created some basic animated loops that cycled through some samples from the distribution, and proposed a way to represent conditionality as well.

I liked the idea so much I’ve added it to my probability distributions JS library. The numbers can be shown directly, or interpreted as waiting times where each arrival is shown with a flashing symbol.

I happened to be travelling through Brussels, so I stopped by Ghent, the world hotspot for research into imprecise probabilities, and setup an interview with Gert de Cooman. Gert has been working in imprecise probabilities for more than twenty years, is a founding member and former President of SIPTA, the Society for Imprecise Probability: Theories and Applications, and has helped organize many of the ISIPTA conferences and SIPTA Schools.

Topics include fair betting rates, Dutch books, Monte Carlo methods, Markov chains, utility, and the foundations of probability theory. We had a rich, wide-ranging discussion. You may need to listen two (or more!) times to process everything.

]]>http://www.statisticsblog.com/2016/03/probability-podcast-ep2-imprecise-probabilities-with-gert-de-cooman/feed/0Random samples in JS using R functionshttp://www.statisticsblog.com/2015/10/random-samples-in-js-using-r-functions/
http://www.statisticsblog.com/2015/10/random-samples-in-js-using-r-functions/#commentsThu, 15 Oct 2015 21:35:54 +0000http://www.statisticsblog.com/?p=1834For a JavaScript-based project I’m working on, I need to be able to sample from a variety of probability distributions. There are ways to call R from JavaScript, but they depend on the server running R. I can’t depend on that. I need a pure JS solution.

I found a handful of JS libraries that support sampling from distributions, but nothing that lets me use the R syntax I know and (mostly) love. Even more importantly, I would have to trust the quality of the sampling functions, or carefully read through each one and tweak as needed. So I decided to create my own JS library that:

Conforms to R function names and parameters – e.g. rnorm(50, 0, 1)

Uses the best entropy available to simulate randomness

Includes some non-standard distributions that I’ve been using (more on this below)

Not a JS developer? Just want to play with the library? I’ve setup a test page here.

Please keep in mind that this library is still in its infancy. I’d highly recommend you do your own testing on the output of any distribution you use. And of course let me know if you notice any issues.

In terms of additional distributions, these are marked “experimental” in the source code. They include the unreliable friend and its discrete cousin the FML, a frighteningly thick-tailed distribution I’ve been using to model processes that may never terminate.

]]>http://www.statisticsblog.com/2015/10/random-samples-in-js-using-r-functions/feed/0Arbitrage anyone?http://www.statisticsblog.com/2015/09/arbitrage-anyone/
http://www.statisticsblog.com/2015/09/arbitrage-anyone/#commentsMon, 28 Sep 2015 18:14:40 +0000http://www.statisticsblog.com/?p=1825I’m looking to put together a small crew to take on a large arbitrage project. The (rough) model for this would be “Hong Kong Syndicate” which took on the horse betting market. To be involved you have to be willing to make a large commitment in terms of time or money (I plan to contribute both). I have a set of proposed guidelines for identifying potential arbitrage targets, send me an email for more info.

UPDATE (Oct 5): Lots of interest in this, hope to finalize a core team this week. Let me know right away if you’re interested. Also, this would not necessarily be targeted at horse racing.

]]>http://www.statisticsblog.com/2015/09/arbitrage-anyone/feed/3Guide for new users postedhttp://www.statisticsblog.com/2015/02/guide-for-new-users-posted/
http://www.statisticsblog.com/2015/02/guide-for-new-users-posted/#commentsThu, 19 Feb 2015 21:13:03 +0000http://www.statisticsblog.com/?p=1751If you are a first-timer here at StatisticsBlog.com, or if you’re looking for a list of Greatest Hits, check out the shiny new Start Here page.
]]>http://www.statisticsblog.com/2015/02/guide-for-new-users-posted/feed/0Can pregnant women intuit the sex of their children?http://www.statisticsblog.com/2014/12/can-pregnant-women-intuit-the-sex-of-their-children/
http://www.statisticsblog.com/2014/12/can-pregnant-women-intuit-the-sex-of-their-children/#commentsFri, 12 Dec 2014 00:50:01 +0000http://www.statisticsblog.com/?p=1729

“So let’s start with the fact that the study had only 100 people, which isn’t nearly enough to be able to make any determinations like this. That’s very small power. Secondly, it was already split into two groups, and the two groups by the way have absolutely zero scientific basis. There is no theory that says that if I want a girl or if I want a boy I’m going to be better able at determining whether my baby is in fact a girl or a boy.”

Shown at top, above the quote by Konnikova, is a simulation of the study in question, under the assumption that the results were completely random (the null hypothesis). As usual, you’ll find my code in R at the bottom. The actual group of interest had just 48 women. Of those, 34 correctly guessed the sex of their gestating babies. The probability that you’d get such an extreme result by chance alone is represented by the light green tails. To be conservative, I’m making this a two-tailed test, and considering the areas of interest to be either that the women were very right, or very wrong.

The “power” Konnikova is referring to is the “power of the test.” Detecting small effects requires a large sample, detecting larger effects can be done with a much smaller sample. In general, the larger your sample size, the more power you have. If you want to understand the relationship between power and effect size, I’d recommend this lovely video on the power of the test.

As it turns out, Konnikova’s claims notwithstanding, study authors Victor Shamas and Amanda Dawson had plenty of power to detect what turns out to be a very large effect. Adding together the two green areas in the tails, their study has a p-value of about 0.005. This a full order of magnitude beyond the generally used threshold for statistical significance. Their study found strong evidence that women can guess the sex of their babies-to-be.

Is this finding really as strong as it seems? Perhaps the authors made some mistake in how they setup the experiment, or in how they analyzed the results.

Since apparently Konnikova failed not only to do statistical analysis, but also basic journalism, I decided to clean up on that front as well. I emailed Dr. Victor Shamas to ask how the study was performed. Taking his description at face value, it appears that the particular split of women into categories was based into the study design; this wasn’t a case of “p-value hacking”, as Konnikova claimed later on in the podcast.

Konnikova misses the entire point of this spit, which she says has “absolutely zero scientific basis.” The lack of an existing scientific framework to assimilate the results of the study is meaningless, since the point of the study was to provide evidence (or not) that that our scientific understanding lags behind what woman seem to intuitively know.

More broadly, the existence of causal relationships does not depend in any way on our ability to understand or describe (model) them, or on whether we happen to have an existing scientific framework to fit them in. I used to see this kind of insistence on having a known mechanism as a dumb argument made by smart people, but I’m coming to see it in a much darker light. The more I learn about the history of science, the more clear it becomes that the primary impediment to the advancement of science isn’t the existence of rubes, it’s the supposedly smart, putatively scientific people who are unwilling to consider evidence that contradicts their worldview, their authority, or their self-image. We see this pattern over and over, perhaps most tragically in the unwillingness of doctors to wash their hands until germ theory was developed, despite evidence that hand washing led to a massive reduction in patient mortality when assisting with births or performing operations.

Despite the strength of Shamas and Dawson’s findings, I wouldn’t view their study as conclusive evidence of the ability to “intuit” the sex of your baby. Perhaps their findings were a fluke, perhaps some hidden factor corrupted the results (did the women get secret ultrasounds on the sly?). Like any reasonable scientist, Shamas wants to do another study to replicate the findings, and told me that has a specific follow-up in mind.

A sequence of 9 courses on Data Science will start on Coursera on 2 June and 7 July 2014, to be lectured by Professors of Johns Hopkins University. The courses are designed for students to learn to become Data Scientists and apply their skills in a capstone project. The courses are free, but if you want a Verified Certificate in the course, the Specialization Certificate or taking the Capstone Project, there is a small charge for that.

Do you know where people are going after college? Ben Schmidt, an assistant professor of history at Northeastern University, was curious about careers after college degrees, so he used a quick Sankey diagram to look at data from the American Community Survey.

And finally, if you learned R in its early days (early 2000s or before), you may still be using some old-fashioned ways to accomplish some tasks better served by newer functions and packages. To help you become a better R coder, Revolution Analytics offers hipsteR: Learn what you missed in R as an early adopter.

Randy Olsen, PhD student at Michigan State University’s Computer Science program, studies the percentages of undergraduate degrees conferred to men in the USA and publishes his findings in a blog titled The double-edged sword of gender equality.