# Data Science: Como agentes reguladores, professores e praticantes estão fazendo isso errado

2017 Apr 25Esse post da Data Robot é um daqueles tipos de post que mostra muito como a evolução das plataformas de Big Data, aliado com um maior arsenal computacional e preditivo estão varrendo para baixo do tapete qualquer *bullshit* disfarçado com tecnicalidades em relação à Data Science. Vou reproduzir na íntegra, pois vale a pena usar esse post quando você tiver que justificar a qualquer *burocrata de números* (não vou dar nome aos bois dado o butthurt que isso poderia causar) porque ninguém mais dá a mínima para P-Valor, testes de hipóteses, etc na era em que temos uma abundância de dados; e principalmente está havendo a morte da significância estatística.

*“Underpinning many published scientific conclusions is the concept of ‘statistical significance,’ typically assessed with an index called the p-value. While the p-value can be a useful statistical measure, it is commonly misused and misinterpreted.”* *ASA Statement on Statistical Significance and p-Values*

If you’ve ever heard the words “statistically significant” or “fail to reject,” then you are among the countless thousands who have been traumatized by an academic approach building predictive models. Unfortunately, I can’t claim innocence in this matter. I taught statistics when I was in grad school, and I do have a Ph.D. in applied statistics. I was born into the world that uses formal hypothesis testing to justify every decision made in the model building process:

Should I include this variable in my model? How about an F-test?

Do my two samples have different means? Student’s t-test!

Does my model fit my data? Why not try the Hosmer–Lemeshow test or maybe use the Cramér–von Mises criterion?

Are my variables correlated? How about a test using a Pearson Correlation Coefficient?

And on, and on, and on, and on…

These tests are all based on various theoretical assumptions. If the assumptions are valid, then they allegedly tell you whether or not your results are “statistically significant.”

Over the last century, as businesses and governments have begun to incorporate data science into their business processes, these “statistical tests” have also leaked into commercial and regulatory practices.

For instance, federal regulators in the banking industry issued this tortured guidance in 2011:

*“… statistical tests depend on specific distributional assumptions and the purpose of the model… Any single test is rarely sufficient, so banks should apply a variety of tests to develop a sound model.”*

In other words, statistical tests have lots of assumptions that are often (always) untrue, so use lots of them. (?!)

## Here’s why statistical significance is a waste of time

### If assumptions are invalid, the tests are invalid — even if your model is good

I developed a statistical test of my very own for my dissertation. The procedure for doing this is pretty simple. First, you make some assumptions about independence and data distributions, and variance, and so on. Then, you do some math that relies (heavily) on these assumptions in order to come up with a p-value. The p-value tells you what decision to make.

As an example, let’s take linear regression. Every business stats student memorizes the three assumptions associated with the p-values in this approach: independence (for which no real test exists), constant variance, and normality. If all these assumptions aren’t met, then none of the statistical tests that you might do are valid; yet regulators, professors, scientists, and statisticians all expect you to rely (heavily) on these tests.

What’s are you to do if your assumptions are invalid? In practice, the general practice is to wave your hands about “robustness” or some such thing and then continue along the same path.

### If your data is big enough, EVERYTHING is significant

*“The primary product of a research inquiry is one or more measures of effect size, not P values.”* *Jacob Cohen*

As your data gets bigger and bigger (as data tends to do these days), everything becomes statistically significant. On one hand, this makes intuitive sense. For example, the larger a dataset is, the most likely an F-test is to tell you that your GLM coefficients are nonzero; i.e., larger datasets can support more complex models, as expected. On the other hand, for many assumption validity tests — e.g., tests for constant variance — statistical significance indicates *invalid* assumptions. So, for big datasets, you end up with tests telling you every feature is significant, but assumption tests telling you to throw out all of your results.

### Validating assumptions is expensive and doesn’t add value

Nobody ever generated a single dollar of revenue by validating model assumptions (except of course the big consulting firms that are doing the work). No prospect was converted; no fraud was detected; no marketing message was honed by the drudgery of validating model assumptions. To make matters worse, it’s a never ending task. Every time a model is backtested, refreshed, or evaluated, the same assumption-validation-song-and-dance has to happen again. And that’s assuming that the dozens of validity tests don’t give you inconsistent results. It’s a gigantic waste of resources because there is a better way.

### You can cheat, and nobody will ever know

Known as data dredging, data snooping, or p-hacking, it is very easy and relatively undetectable to manufacture statistically significant results. Andrew Gelman observed that most modelers have a (perverse) incentive to produce _statistically significant_results — even at the expense of reality. It’s hardly surprising that these techniques exist, given the pressure to produce valuable data driven solutions. This risk, on its own, should be sufficient reason to abandon p-values entirely in some settings, like financial services, where cheating could result in serious consequences for the economy.

### If the model is misspecified, then your p-values are likely to be misleading

Suppose you’re investigating whether or not a gender gap exists in America. Lots of things are correlated with gender; e.g., career choice, hours worked per week, percentage of vacation taken, participation in a STEM career, and so on. To the extent that *any* of these variables are excluded from your investigation — whether you know about them or not — the significance of gender will be overstated. In other words, *statistical significance* will give the impression that a gender gap exists, when it may not — simply due to model misspecification.

## Only out-of-sample accuracy matters

Whether or not results are statistically significant is the *wrong question*. The only metric that actually matters when building models is whether or not your models can make accurate predictions on new data. Not only is this metric difficult to fake, but it also perfectly aligns with the business motivation for building the model in the first place. Fraud models that do a good job predicting fraud actually prevent losses. Underwriting models that accurately segment credit risk really do increase profits. Optimizing model accuracy instead of identifying statistical significance makes good business sense.

Over the course of the last few decades lots and lots of tools have been developed outside of the hypothesis testing framework. Cross-validation, partial dependence, feature importance, and boosting/bagging methods are just some of the tools in the machine learning toolbox. They provide a means not only for ensuring out-of-sample accuracy, but also understanding which features are important and how complex models work.

A survey of these methods is out of scope, but let me close with a final point. Unlike traditional statistical methods, tasks like cross-validation, model tuning, feature selection, and model selection are highly automatable. Custom coded solutions of any kind are inherently error prone, even for the most experienced data scientist

Many of the world’s biggest companies are recognizing that bespoke models, hand-built by Ph.D.’s are too slow and expensive to develop and maintain. Solutions like DataRobot provide a way for business experts to build predictive models in a safe, repeatable, systematic way that yields business value much more quickly and much cheaper than other approaches.

By Greg Michaelson, Director – DataRobot Labs