After a recent Wordpress upgrade took my site down for an indefinite length of time, I decided to finish migrating this site to a static site generator. I chose Hugo for its performance and compatibility with Jekyll , which I was experimenting with in 2013 when I last considered moving the site away from Wordpress. At the time, I also intended to do a redesign and got a logo made for the site at…
As a graduate student, I came to love working with the roll call voting data sets that have been compiled for the United States Congress by political scientists like Keith Poole and Howard Rosenthal. These datasets can be represented in simplified form as matrices in which the rows correspond to legislators and the columns correspond to bills that the legislators vote for or against. One encoding…
Over the last couple of years, I’ve seen a large number of people attempt to diagnose the quality of their randomized experiments by looking for imbalances in covariates, because they expect covariate imbalances to be ruled out by successful randomization. But imbalance is, in general, not guaranteed for any specific random assignment – and, as such, many attempts to check for…

 Introduction
 
 
 Link to heading 
 
 
 Yesterday, Uri Simonsohn published a blog post called “Interactions in Logit Regressions: Why Positive May Mean Negative” . I love Uri’s blog in general, but I was pretty confused by this latest post. I found it very hard to understand exactly what was being claimed in the absence of formal mathematical…
I recently reread Yarkoni and Westfall’s in-progress paper, “Choosing prediction over explanation in psychology: Lessons from machine learning” . I like this paper even more than I liked their previous paper , but I think a few notes of caution should be raised about the ways in which a transition to predictive modeling could create problems that psychologists are seldom trained…
I broadly believe that the statistics community would benefit from greater exposure to computer science concepts. Consistent with that belief, I argue in this post that the concept of type-safety could be used to develop a normative theory for how statistical computing systems ought to behave. I also argue that such a normative theory would allow us to clarify the ways in which current systems can…
Today I saw a claim being made on Twitter that 17% of Jill Stein supporters in Louisiana are also David Duke supporters. For anyone familiar with US politics, this claim is a priori implausible, although certainly not impossible. 
 Given how non-credible this claim struck me as being, I decided to look into the origin of this number of 17%. I found that this claim is based on numbers reported…
The other day a friend posted the following old joke about the level of rigor that mathematicians usually require. ( Disclaimer: if you take the joke as a serious claim about the standards of quality in the other fields referenced in the joke, it is an obviously unfair characterization of both astronomy and physics. ) 
 
 A Mathematician, a Physicist, and an astronomer were travelling…
I just found a minimal example of how easy it is to confuse R’s CSV parser when providing it with ill-formatted data. To make it easy to understand, I put material for reproducing the problem up on GitHub . 
 I’m sure one could construct many similar examples for Python and Julia. The problem here is two-fold: (1) the CSV format is just kind of awful and (2) many end-users complain…

 Deriving Distributions from Distances
 
 
 Link to heading 
 
 
 Several of the continuous univariate distributions that frequently come up in statistical theory can be derived by transforming distances into probabilities. Essentially, these distributions only differ in terms of how frequently values
are drawn that lie at a distance \(d\) from the mode. To see how…
In my experience, people seldom appreciate just how much more compelling a 5-sigma effect is than a 2-sigma effect . I suspect part of the problem is that p-values don’t invoke the visceral sense of magnitude that statements of the form, “this would happen 1 in K times”, would invoke. 
 To that end, I wrote a short Julia script to show how often a K-sigma effect would occur…

 The Big Message
 
 
 Link to heading 
 
 
 People sometimes use \(R^2\) as their preferred measure of model fit. Unlike quantities such as MSE or MAD , \(R^2\) is not a function only of model’s errors, its definition contains an implicit model comparison between the model being analyzed and the constant model that uses only the observed mean to make predictions.…
Yesterday, a coworker pointed me to a new paper by Jacob Westfall and Tal Yarkoni called “Statistically controlling for confounding constructs is harder than you think”. I quite like the paper, which describes some problems that arise when drawing conclusions about the relationships between theoretical constructs using only measurements of observables that are, at best, approximations…

 Introduction
 
 
 Link to heading 
 
 
 One of the things that set statistics apart from the rest of applied mathematics is an interest in the problems introduced by sampling: how can we learn about a model if we’re given only a finite and potentially noisy sample of data? 
 Although frequently important, the issues introduced by sampling can be a…
Over the last few months, I’ve had a lot of conversations with people about the use of winsorization to deal with heavy-tailed data that is positively skewed because of large outliers. After a conversation with my friend Chris Said this past week, it became clear to me that I needed to do some simulation studies to understand the design space of techniques for dealing with outliers. 
 In…

 Introduction
 
 
 Link to heading 
 
 
 Although I’ve recently decided to take a break from working on OSS for a little while, I’m still as excited as ever about Julia as a language. 
 That said, I’m still unhappy with the performance of Julia’s core data analysis infrastructure. The performance of code that deals with missing values has…
Lately, I’ve been rereading a lot of Meehl’s papers on the epistemological problems with research in psychology. This passage from “The Problem Is Epistemology, Not Statistics: Replace Significance Tests by Confidence Intervals and Quantify Accuracy of Risky Numerical Predictions” strikes me as an almost perfect summary of his concerns, although it’s quite abstract…

 Introduction
 
 
 Link to heading 
 
 
 Several months ago, I promised to write an updated version of my old post, “The State of Statistics in Julia” , that would describe how Julia’s support for statistical computing has evolved since December 2012. 
 I’ve kept putting off writing that post for several reasons, but the most important…

 1st Normal Form : The database contains at least one table that is an exact copy of another table, except with additional columns. 
 2nd Normal Form : The database contains at least one table that is a corrupt, out-of-date copy of another table, except with additional columns. It is impossible to determine if these additional columns can be trusted. 
 3rd Normal Form : The database…
Many newcomers to Julia are confused by the seemingly dissimilar behaviors of the following two functions: 
 julia> a = [1, 2, 3]
 3-element Array{Int64,1}:
 1
 2
 3
 
 julia> function foo!(a)
 a[1] = 10
 return
 end
 foo! (generic function with 1 method)
 
 julia> foo!(a)
 
 julia> a
 3-element Array{Int64,1}:
 10
 2
…

 tl;dr
 
 
 Link to heading 
 
 
 Please do not use arithmetic on data.frame objects when programming in R. It’s a hack that only works if you know everything about your datasets. If anything happens to change the order of the rows in your data set, previously safe data.frame arithmetic operations will produce incorrect answers. If you learn to always explicitly…

 Introduction
 
 
 Link to heading 
 
 
 I just got home from JuliaCon , the first conference dedicated entirely to Julia . It was a great pleasure to spend two full days listening to talks about a language that I started advocating for just a little more than two years ago. 
 What follows is a very brief review of the talks that excited me the most. It’s not…
Here are two hypothetical conversations about psychological research. I’ll leave it to others to decide whether these conversation could ever take place. 
 
 Theories are just directional assertions about effects
 
 
 Link to heading 
 
 
 
 Person A: And, just as I predicted, I found in my early studies that the correlation between X and Y is 0.4. 
…

 Introduction
 
 
 Link to heading 
 
 
 A recent thread on Theoretical CS StackExchange comparing the Johnson-Lindenstrauss Lemma with the Singular Value Decomposition piqued my interest enough that I decided to spend some time last night reading the standard JL papers. Until this week, I only had a vague understanding of what the JL Lemma implied. I previously…

 Introduction
 
 
 Link to heading 
 
 
 It may be old news to some, but I just recently discovered that the automatic type inference system that R uses when parsing CSV files assumes that data sets will never contain 64-bit integer values. 
 Specially, if an integer value read from a CSV file is too large to fit in a 32-bit integer field without overflow, the…
Correction: One problem with the argument I make below is that password storage length isn’t actually relevant if websites hash passwords instead of storing them in plaintext. So there’s no need to convince websites to store longer passwords: they should always be storing a fixed length hash to begin with. Thanks to @petrillic for bringing this mistake to my attention. 
 tl;dr:…

 Introduction
 
 
 Link to heading 
 
 
 Some people have come to believe that Julia’s vectorized code is unusably slow. To correct this misconception, I outline a naive benchmark below that suggests that Julia’s vectorized code is, in fact, noticeably faster than R’s vectorized code. When experienced Julia programmers suggest that newcomers should…
For many of the people I talk to, Julia’s main appeal is speed. But achieving peak performance in Julia requires that programmers absorb a few subtle concepts that are generally unfamiliar to users of weakly typed languages. 
 One particularly subtle performance pitfall is the need to write type-stable code. Code is said to be type-stable if the type of every variable does not vary over…
To celebrate my last full month on the East Coast, I’m doing a bunch of talks. If you’re interested in hearing more about Julia or statistics in general, you might want to come out to one of the events I’ll be at: 
 
 Julia Tutorial at DataGotham : On 9/12, Stefan and I will be giving a 3-hour long, hands on Julia tutorial as part of the Thursday DataGotham activities…
As a fun side project last night, I decided to implement a basic package for working with Hopfield networks in Julia . 
 Since I suspect many of the readers of this blog have never seen a Hopfield net before, let me explain what they are and what they can be used for. The short-and-skinny is that Hopfield networks were invented in the 1980’s to demonstrate how a network of simple neurons…
A few days ago I disabled the comment system on this site. I’d been debating the change for some time, but reached a final decision while reading the comments on an article about a vaccine for Lyme disease . 
 Although this site has generally had very high quality comments, I’ve become increasingly opposed (as a matter of principle) to the use of online comment systems. My feelings…
The last two weeks have been full of changes for me. For those who’ve been asking about what’s next, I thought I’d write up a quick summary of all the news. 
 (1) I successfully defended my thesis this past Monday. Completing a Ph.D. has been a massive undertaking for the past five years, and it’s a major relief to be done. From now on I’ll be (perhaps…

 Introduction
 
 
 Link to heading 
 
 
 In my last post , I described how we can derive modes, medians and means as three natural solutions to the problem of summarizing a list of numbers, \((x_1, x_2, \ldots, x_n)\), using a single number, \(s\). In particular, we measured the quality of different potential summaries in three different ways, which led us to modes,…

 Introduction / Warning
 
 
 Link to heading 
 
 
 Any traditional introductory statistics course will teach students the definitions of modes, medians and means. But, because introductory courses can’t assume that students have much mathematical maturity, the close relationship between these three summary statistics can’t be made clear. This post tries to…
A while back a friend asked me for advice about speeding up some R code that they’d written. Because they were running an extensive Monte Carlo simulation of a model they’d been developing, the poor performance of their code had become an impediment to their work. 
 After I looked through their code, it was clear that the performance hurdles they were stumbling upon could be…
Today I saw an article on Hacker News entitled, “America’s CEOs Want You to Work Until You’re 70” . I was particularly surprised by this article appearing out of the blue because I take it for granted that America will eventually have to raise the retirement age to avoid bankruptcy. After reading the article, I wasn’t able to figure out why the story had been run at…

 A Brief Introduction to Metaprogramming in Julia
 
 
 Link to heading 
 
 
 In contrast to my previous post , which described one way in which Julia allows (and expects) the programmer to write code that directly employs the atomic operations offered by computers, this post is meant to introduce newcomers to some of Julia’s higher level functions for…
When people try out Julia for the first time, many of them are worried by the following example: 
 julia> factorial(n) = n == 0 ? 1 : n * factorial(n - 1)
 
 julia> factorial(20)
 2432902008176640000
 
 julia> factorial(21)
 -4249290049419214848
 If you’re not familiar with computer architecture, this result is very troubling. Why would Julia claim that the…

 Introduction
 
 
 Link to heading 
 
 
 A few months ago, Drew Conway and I gave a webcast that tried to teach people about the basic principles behind linear and logistic regression. To illustrate logistic regression, we worked through a series of progressively more complex spam detection problems. 
 The simplest data set we used was the following: 
 
…
Having spent all five of my years as a graduate student trying to get psychologists and economists to agree on basic ideas about decision-making, I think the following two pieces complement one another perfectly: 
 
 Cosma Shalizi’s comments on rereading Blanchard and Fischer’s “Lectures on Macroeconomics” : 
 
 
 Blanchard and Fischer is about…
One of these days I am going to finish my series on problems with how NHST is issued in the social sciences. Until then, I came up with a cheap criticism of p-values today. 
 To make sense of my complaint, you’ll want to head over to Andy Gelman’s blog and read the comments on his recent blog post about p-values. Reading them makes one thing clear: not even a large group of stats…
Updated 12.2.2012: Added sample output based on a suggestion from Stefan Karpinski. 
 
 Introduction
 
 
 Link to heading 
 
 
 Over the last few weeks, the Julia core team has rolled out a demo version of Julia’s package management system . While the Julia package system is still very much in beta, it nevertheless provides the first plausible way for…
[ Updated 10/18/2012 : Fixed a typo in which mantissa was replaced with exponent.] 
 Over the weekend, Viral Shah updated Julia’s implementation of randn() to give a 20% speed boost . Because we all wanted to test that this speed-up had not come at the expense of the validity of Julia’s RNG system, I spent some time this weekend trying to get tests up and running. I didn’t…
What do you think when you see a model like the one below? 
 
 Does this strike you as a good model? Or as a bad model? 
 There’s no right or wrong answer to this question, but I’d like to argue that models that are able to match white noise are typically bad things, especially when you don’t have a clear cross-validation paradigm that will allow you to demonstrate…

 One Paragraph Summary
 
 
 Link to heading 
 
 
 Always explore your data visually. Whatever specific hypothesis you have when you go out to collect data is likely to be worse than any of the hypotheses you’ll form after looking at just a few simple visualizations of that data. The most effective hypothesis testing framework in existence is the test of…

 Introduction
 
 
 Link to heading 
 
 
 Statistically-trained readers of this blog will be very familiar with the Central Limit Theorem , which describes the asymptotic sampling distribution of the mean of a random vector composed of IID variables. Some of the most interesting recent work in mathematics has been focused on the development of increasingly powerful…

 The Quick-and-Dirty Summary
 
 
 Link to heading 
 
 
 I was recently asked to participate in a proposed SXSW panel that will debate the question, “Will Data Scientists Be Replaced by Tools?” This post describes my current thinking on that question as a way of (1) convincing you to go vote for the panel’s inclusion in this year’s SXSW and (2)…
As some of you may know already, I’m co-organizing an upcoming conference called DataGotham that’s taking place in September. To help spread the word about DataGotham, I’m cross-posting the most recent announcement below: 
 
 We’d like to let you know about DataGotham: a celebration of New York City’s data community! 
 http://datagotham.com 
 This is an event run…
Recently a few members of R Core have indicated that part of what slows down the development of R as a language is that it has become increasingly difficult over the years to achieve consensus among the core developers of the language. Inspired by these claims, I decided to look into this issue quantitatively by measuring the quantity of commits to R’s SVN repository that were made by each…