“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.”

- Maria Konnikova, speaking on Mike Pesca’s podcast, The Gist.

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.

*Code in R:*

trials = 100000 results = rep(0,trials) for(i in 1:trials) { results[i] = sum(sample(c(0,1),48,replace=T)) } extremes = length(results[results<=14]) + length(results[results>=34]) extremes/trials dat <- data.frame( x=results, above=((results <= 14) | (results >= 34))) library(ggplot2) qplot(x,data=dat,geom="histogram",fill=above,breaks=seq(1,48))

Pinned, entropy augmented, digitally normal distribution, of no particular work-related use and thus perfectly suitable for today. Code in R:

iters = 1000 sd = 2 precision = 20 results = rep(0,iters) for(i in 1:iters) { x = floor(rnorm(20,5,sd) %% 10) results[i] = paste(c('.',x),sep="",collapse="") } results = as.numeric(results) plot(density(results,bw=.01),col="blue",lwd=3,bty="n")

- Professor Ramon van Handel of Princeton University posts his lecture notes on Probability in High Dimension.
- Everday Anayltics shares his experience as a statistical consultant on a project for Delta Airline data using PCA and K-means Clustering.
- If you know R and want to improve your SAS skills (or the other way around), check out this tutorial on logistic regressions using both packages.
- Do you trade stocks? If so, here is A Simple Shiny App for Monitoring Trading Strategies.
- Maybe I Don’t Really Know R After All.
- And finally, why we should Separate Statistical Models of “What Is Learned” from “How It Is Learned”.

- Writing functions is an important part of programming, and in order to write proper functions you need to know how to debug when your functions aren’t working. Slawa Rokicki, PhD student at Harvard, explains How to write and debug an R function.
- It is often said that you should avoid loops in R because R is extremely slow with iterations, and hence many R-programmers try to avoid loops by working with matrices and arrays. Did you know that an even better option is to run your loops in C++ and import your result back into R? Here is a quick tutorial called how you can use C++ within R.
- Rasmus Bååth blogs about the The Most Comprehensive Review of Comic Books Teaching Statistics.
- Did you know that more and more startups are starting to use R as their primary data analysis tool? According to Revolution Analytics, Uber and CultureAmp have just joined the R camp.
- Xi’an reviews a new paper called Generalizations related to hypothesis testing with the Posterior distribution of the Likelihood Ratio by Smith and Ferrari.
- And finally, DiffusePrioR writes “If history can tell us anything about the World Cup, it’s that the host nation has an advantage of all other teams”. Do you agree or disagree, and what do you think is Brazil’s chance of winning the World Cup?

http://bit.ly/SHnlXH

]]>- Like the plots above? Learn how to create these in R from Freakonometrics’ new post called Box plot, Fisher’s style.
- If you are on the job market, Tal Galili from R bloggers has compiled 6 new R jobs for seekers like you.
- Big Data has gained lots of popularity recently, and every data scientist should know at least something about it. If you are new to data science, consider this introduction to R for Big Data with PivotalR.
- Using Repeated Measures to Remove Artifacts from Longitudinal Data by Dmitry Grapov.
- And finally, Andrew Gelman discusses Why we hate stepwise regression.

Right now I’m working on a project that involves new ways to view units of content and the relationships between them. I’ve posted the comic I worked on, it has a number of stats references throughout. This is early alpha stages for the software, you may run into issues. To see the relationships, go to the puffball menu and make sure that “Show relationships” is clicked.

]]>- Alvaro Galindo reviews Social Media Mining with R by by Nathan Danneman and Richard Heinmann.
- Some popular articles on R tip and tricks are: R has some sharp corners by Win-Vector LLC, Sample uniformly within a fixed radius by Forester (Assistant Professor at the University of Minnesota Twin Cities), The Birthday Simulation by Wes Stevenson, and didYouMean() Function: Using Google to correct errors in Strings by Sam Weiss.
- R bloggers compiles a list of R related positions for those who are on the job market.
- Xi’an discusses a special issue Statistical Science named Big Bayes Stories: A Collection of Vignettes.
- Last week, we featured an article on R vs. Julia. This week, Matloff (aka Mad (Data) Scientist) writes another comparison called R beats Python! R beats Julia! Anyone else wanna challenge R?

- Are you a self-taught “scientist programmer”? Here is why people think code written by people like you is ugly.
- As always, R articles are extremely popular. This week, we have: Facebook teaches you exploratory data analysis with R by Revolution Analytics, Beyond R, or on the Hunt for New Tools by Quintuitive, Bootstrap Critisim (with example) by Eran Raviv, The apply command 101 by Learning R by Imitation, and Can We do Better than R-squared? by Learning as You Go.
- Julia is a new programming language (only 2 years old) for scientific computing and it has gained lots of popularity recently. In the past, we shared some articles comparing R and Julia. This week, Alvaro Galindo writes another comparison called Julia versus R – Playing around.
- Sébastien Bubeck, assistant professor at Princeton, releases the first draft of his monograph based some old lecture notes called Theory of Convex Optimization for Machine Learning.
- And finally, happy Victoria Day to those in Canada!