Skip to content

Commit 4269a07

Browse files
committed
Update documentation
1 parent 068f690 commit 4269a07

File tree

112 files changed

+2313
-1960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+2313
-1960
lines changed

.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: e692c567d4e7c73f800d65e54311b420
3+
config: 0a85976861bf9fc55bff888562c121eb
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

01-Introduction-To-Causality.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
href="_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
2222

2323
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
24-
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=62ba249389abaaa9ffc34bf36a076bdc1d65ee18" type="text/css" />
24+
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=5115cc725059bd94278eecd172e13a965bf8f5a9" type="text/css" />
2525
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css" />
2626
<link rel="stylesheet" type="text/css" href="_static/copybutton.css" />
2727
<link rel="stylesheet" type="text/css" href="_static/mystnb.css" />
@@ -37,7 +37,7 @@
3737
<script src="_static/doctools.js"></script>
3838
<script src="_static/clipboard.min.js"></script>
3939
<script src="_static/copybutton.js"></script>
40-
<script src="_static/scripts/sphinx-book-theme.js?digest=f31d14ad54b65d19161ba51d4ffff3a77ae00456"></script>
40+
<script src="_static/scripts/sphinx-book-theme.js?digest=9c920249402e914e316237a7dbc6769907cce411"></script>
4141
<script>let toggleHintShow = 'Click to show';</script>
4242
<script>let toggleHintHide = 'Click to hide';</script>
4343
<script>let toggleOpenOnPrint = 'true';</script>
@@ -612,7 +612,7 @@ <h2>Data Science is Not What it Used to Be (or it Finally Is)<a class="headerlin
612612
<h2>Answering a Different Kind of Question<a class="headerlink" href="#answering-a-different-kind-of-question" title="Permalink to this headline">#</a></h2>
613613
<p>Machine Learning is currently very good at answering the type of question of the prediction kind. As Ajay Agrawal, Joshua Gans, and Avi Goldfarb put it in the book Prediction Machines, “the new wave of artificial intelligence does not actually bring us intelligence but instead a critical component of intelligence - prediction”. We can do all sorts of beautiful things with machine learning. The only requirement is that we frame our problems as prediction ones. Want to translate from English to Portuguese? Then build an ML model that predicts Portuguese sentences when given English sentences. Want to recognize faces? Then create an ML model that predicts the presence of a face in a subsection of a picture. Want to build a self-driving car? Then make one ML model to predict the direction of the wheel and the pressure on the brakes and accelerator when presented with images and sensors from the surroundings of a car.</p>
614614
<p>However, ML is not a panacea. It can perform wonders under rigid boundaries and still fail miserably if its data deviates a little from what the model is accustomed to. To give another example from Prediction Machines, “in many industries, low prices are associated with low sales. For example, in the hotel industry, prices are low outside the tourist season, and prices are high when demand is highest and hotels are full. Given that data, a naive prediction might suggest that increasing the price would lead to more rooms sold.”</p>
615-
<p>ML is notoriously bad at this inverse causality type of problem. They require us to answer “what if” questions, which Economists call counterfactuals. What would happen if I used another price instead of this price I’m currently asking for my merchandise? What would happen if I do a low sugar one instead of this low-fat diet I’m in? If you work in a bank, giving credit, you will have to figure out how changing the customer line changes your revenue. Or, if you work in the local government, you might be asked to figure out how to make the schooling system better. Should you give tablets to every kid because the era of digital knowledge tells you to? Or should you build an old-fashioned library?</p>
615+
<p>ML is notoriously bad at this inverse causality type of problem. They require us to answer “what if” questions, which economists call counterfactuals. What would happen if I used another price instead of this price I’m currently asking for my merchandise? What would happen if I do a low sugar one instead of this low-fat diet I’m in? If you work in a bank, giving credit, you will have to figure out how changing the customer line changes your revenue. Or, if you work in the local government, you might be asked to figure out how to make the schooling system better. Should you give tablets to every kid because the era of digital knowledge tells you to? Or should you build an old-fashioned library?</p>
616616
<p>At the heart of these questions, there is a causal inquiry we wish to know the answer to. Causal questions permeate everyday problems, like figuring out how to make sales go up. Still, they also play an essential role in dilemmas that are very personal and dear to us: do I have to go to an expensive school to be successful in life (does education cause earnings)? Does immigration lower my chances of getting a job (does immigration causes unemployment to go up)? Does money transfer to the poor lower the crime rate? It doesn’t matter the field you are in. It is very likely you had or will have to answer some type of causal question. Unfortunately for ML, we can’t rely on correlation-type predictions to tackle them.</p>
617617
<p>Answering this kind of question is more challenging than most people appreciate. Your parents have probably repeated to you that “association is not causation”, “association is not causation”. But actually, explaining why that is the case is a bit more involved. This is what this introduction to causal inference is all about. As for the rest of this book, it will be dedicated to <strong>figuring out how to make association be causation</strong>.</p>
618618
</section>

02-Randomised-Experiments.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
href="_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
2222

2323
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
24-
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=62ba249389abaaa9ffc34bf36a076bdc1d65ee18" type="text/css" />
24+
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=5115cc725059bd94278eecd172e13a965bf8f5a9" type="text/css" />
2525
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css" />
2626
<link rel="stylesheet" type="text/css" href="_static/copybutton.css" />
2727
<link rel="stylesheet" type="text/css" href="_static/mystnb.css" />
@@ -37,7 +37,7 @@
3737
<script src="_static/doctools.js"></script>
3838
<script src="_static/clipboard.min.js"></script>
3939
<script src="_static/copybutton.js"></script>
40-
<script src="_static/scripts/sphinx-book-theme.js?digest=f31d14ad54b65d19161ba51d4ffff3a77ae00456"></script>
40+
<script src="_static/scripts/sphinx-book-theme.js?digest=9c920249402e914e316237a7dbc6769907cce411"></script>
4141
<script>let toggleHintShow = 'Click to show';</script>
4242
<script>let toggleHintHide = 'Click to hide';</script>
4343
<script>let toggleOpenOnPrint = 'true';</script>
@@ -583,7 +583,7 @@ <h2>The Golden Standard<a class="headerlink" href="#the-golden-standard" title="
583583
<p><span class="math notranslate nohighlight">\(
584584
E[Y|T=1] - E[Y|T=0] = \underbrace{E[Y_1 - Y_0|T=1]}_{ATT} + \underbrace{\{ E[Y_0|T=1] - E[Y_0|T=0] \}}_{BIAS}
585585
\)</span></p>
586-
<p>To recap, association becomes causation if there is no bias. There will be no bias if <span class="math notranslate nohighlight">\(E[Y_0|T=0]=E[Y_0|T=1]\)</span>. In words, association will be causation if the treated and control are equal or comparable, except for their treatment. Or, in more technical words, when the outcome of the untreated is equal to the counterfactual outcome of the treated. Remember that this counterfactual outcome is the outcome of the treated group if they had not received the treatment</p>
586+
<p>To recap, association becomes causation if there is no bias. There will be no bias if <span class="math notranslate nohighlight">\(E[Y_0|T=0]=E[Y_0|T=1]\)</span>. In words, association will be causation if the treated and control are equal or comparable, except for their treatment. Or, in more technical words, when the outcome of the untreated is equal to the counterfactual outcome of the treated. Remember that this counterfactual outcome is the outcome of the treated group if they had not received the treatment.</p>
587587
<p>I think we did an OK job explaining how to make association equal to causation in math terms. But that was only in theory. Now, we look at the first tool we have to make the bias vanish: <strong>Randomised Experiments</strong>. Randomised experiments randomly assign individuals in a population to a treatment or to a control group. The proportion that receives the treatment doesn’t have to be 50%. You could have an experiment where only 10% of your samples get the treatment.</p>
588588
<p>Randomisation annihilates bias by making the potential outcomes independent of the treatment.</p>
589589
<p><span class="math notranslate nohighlight">\(

03-Stats-Review-The-Most-Dangerous-Equation.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
href="_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
2222

2323
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
24-
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=62ba249389abaaa9ffc34bf36a076bdc1d65ee18" type="text/css" />
24+
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=5115cc725059bd94278eecd172e13a965bf8f5a9" type="text/css" />
2525
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css" />
2626
<link rel="stylesheet" type="text/css" href="_static/copybutton.css" />
2727
<link rel="stylesheet" type="text/css" href="_static/mystnb.css" />
@@ -37,7 +37,7 @@
3737
<script src="_static/doctools.js"></script>
3838
<script src="_static/clipboard.min.js"></script>
3939
<script src="_static/copybutton.js"></script>
40-
<script src="_static/scripts/sphinx-book-theme.js?digest=f31d14ad54b65d19161ba51d4ffff3a77ae00456"></script>
40+
<script src="_static/scripts/sphinx-book-theme.js?digest=9c920249402e914e316237a7dbc6769907cce411"></script>
4141
<script>let toggleHintShow = 'Click to show';</script>
4242
<script>let toggleHintHide = 'Click to hide';</script>
4343
<script>let toggleOpenOnPrint = 'true';</script>
@@ -857,7 +857,7 @@ <h2>Confidence Intervals<a class="headerlink" href="#confidence-intervals" title
857857
</div>
858858
</div>
859859
<p>Of course, we don’t need to restrict ourselves to the 95% confidence interval. We could generate the 99% interval by finding what we need to multiply the standard deviation by so the interval contains 99% of the mass of a normal distribution.</p>
860-
<p>The function <code class="docutils literal notranslate"><span class="pre">ppf</span></code> in python gives us the inverse of the CDF. Instead of multiplying the standard error by 2 like we did to find the 95% CI, we will multiply it by <code class="docutils literal notranslate"><span class="pre">z</span></code>, which will result in the 99% CI. So, <code class="docutils literal notranslate"><span class="pre">ppf(0.5)</span></code> will return 0.0, saying that 50% of the mass of the standard normal distribution is below 0.0. By the same token, if we plug 99.5%, we will have the value <code class="docutils literal notranslate"><span class="pre">z</span></code>, such that 99.5% of the distribution mass falls below this value. In other words, 0.05% of the mass falls above this value.</p>
860+
<p>The function <code class="docutils literal notranslate"><span class="pre">ppf</span></code> in python gives us the inverse of the CDF. Instead of multiplying the standard error by 2 like we did to find the 95% CI, we will multiply it by <code class="docutils literal notranslate"><span class="pre">z</span></code>, which will result in the 99% CI. So, <code class="docutils literal notranslate"><span class="pre">ppf(0.5)</span></code> will return 0.0, saying that 50% of the mass of the standard normal distribution is below 0.0. By the same token, if we plug 99.5%, we will have the value <code class="docutils literal notranslate"><span class="pre">z</span></code>, such that 99.5% of the distribution mass falls below this value. In other words, 0.5% of the mass falls above this value.</p>
861861
<div class="cell docutils container">
862862
<div class="cell_input docutils container">
863863
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">scipy</span> <span class="kn">import</span> <span class="n">stats</span>
@@ -984,7 +984,7 @@ <h2>Hypothesis Testing<a class="headerlink" href="#hypothesis-testing" title="Pe
984984
<img alt="_images/03-Stats-Review-The-Most-Dangerous-Equation_23_0.png" src="_images/03-Stats-Review-The-Most-Dangerous-Equation_23_0.png" />
985985
</div>
986986
</div>
987-
<p>With this at hand, we can say that we are 95% confident that the true difference between the online and face-to-face groups falls between -8.37 and -1.44. We can also construct a <strong>z statistic</strong> by dividing the difference in mean by the $SE\$ of the differences.</p>
987+
<p>With this at hand, we can say that we are 95% confident that the true difference between the online and face-to-face groups falls between -8.37 and -1.44. We can also construct a <strong>z statistic</strong> by dividing the difference in mean by the <span class="math notranslate nohighlight">\(SE\)</span> of the differences.</p>
988988
<p><span class="math notranslate nohighlight">\(
989989
z = \dfrac{\mu_{diff} - H_{0}}{SE_{diff}} = \dfrac{(\mu_1 - \mu_2) - H_{0}}{\sqrt{\sigma_1^2/n_1 + \sigma_2^2/n_2}}
990990
\)</span></p>

04-Graphical-Causal-Models.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
href="_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
2222

2323
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
24-
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=62ba249389abaaa9ffc34bf36a076bdc1d65ee18" type="text/css" />
24+
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=5115cc725059bd94278eecd172e13a965bf8f5a9" type="text/css" />
2525
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css" />
2626
<link rel="stylesheet" type="text/css" href="_static/copybutton.css" />
2727
<link rel="stylesheet" type="text/css" href="_static/mystnb.css" />
@@ -37,7 +37,7 @@
3737
<script src="_static/doctools.js"></script>
3838
<script src="_static/clipboard.min.js"></script>
3939
<script src="_static/copybutton.js"></script>
40-
<script src="_static/scripts/sphinx-book-theme.js?digest=f31d14ad54b65d19161ba51d4ffff3a77ae00456"></script>
40+
<script src="_static/scripts/sphinx-book-theme.js?digest=9c920249402e914e316237a7dbc6769907cce411"></script>
4141
<script>let toggleHintShow = 'Click to show';</script>
4242
<script>let toggleHintHide = 'Click to hide';</script>
4343
<script>let toggleOpenOnPrint = 'true';</script>

05-The-Unreasonable-Effectiveness-of-Linear-Regression.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
href="_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
2222

2323
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
24-
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=62ba249389abaaa9ffc34bf36a076bdc1d65ee18" type="text/css" />
24+
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=5115cc725059bd94278eecd172e13a965bf8f5a9" type="text/css" />
2525
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css" />
2626
<link rel="stylesheet" type="text/css" href="_static/copybutton.css" />
2727
<link rel="stylesheet" type="text/css" href="_static/mystnb.css" />
@@ -37,7 +37,7 @@
3737
<script src="_static/doctools.js"></script>
3838
<script src="_static/clipboard.min.js"></script>
3939
<script src="_static/copybutton.js"></script>
40-
<script src="_static/scripts/sphinx-book-theme.js?digest=f31d14ad54b65d19161ba51d4ffff3a77ae00456"></script>
40+
<script src="_static/scripts/sphinx-book-theme.js?digest=9c920249402e914e316237a7dbc6769907cce411"></script>
4141
<script>let toggleHintShow = 'Click to show';</script>
4242
<script>let toggleHintHide = 'Click to hide';</script>
4343
<script>let toggleOpenOnPrint = 'true';</script>

06-Grouped-and-Dummy-Regression.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
href="_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
2222

2323
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
24-
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=62ba249389abaaa9ffc34bf36a076bdc1d65ee18" type="text/css" />
24+
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=5115cc725059bd94278eecd172e13a965bf8f5a9" type="text/css" />
2525
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css" />
2626
<link rel="stylesheet" type="text/css" href="_static/copybutton.css" />
2727
<link rel="stylesheet" type="text/css" href="_static/mystnb.css" />
@@ -37,7 +37,7 @@
3737
<script src="_static/doctools.js"></script>
3838
<script src="_static/clipboard.min.js"></script>
3939
<script src="_static/copybutton.js"></script>
40-
<script src="_static/scripts/sphinx-book-theme.js?digest=f31d14ad54b65d19161ba51d4ffff3a77ae00456"></script>
40+
<script src="_static/scripts/sphinx-book-theme.js?digest=9c920249402e914e316237a7dbc6769907cce411"></script>
4141
<script>let toggleHintShow = 'Click to show';</script>
4242
<script>let toggleHintHide = 'Click to hide';</script>
4343
<script>let toggleOpenOnPrint = 'true';</script>

07-Beyond-Confounders.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
href="_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
2222

2323
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
24-
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=62ba249389abaaa9ffc34bf36a076bdc1d65ee18" type="text/css" />
24+
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=5115cc725059bd94278eecd172e13a965bf8f5a9" type="text/css" />
2525
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css" />
2626
<link rel="stylesheet" type="text/css" href="_static/copybutton.css" />
2727
<link rel="stylesheet" type="text/css" href="_static/mystnb.css" />
@@ -37,7 +37,7 @@
3737
<script src="_static/doctools.js"></script>
3838
<script src="_static/clipboard.min.js"></script>
3939
<script src="_static/copybutton.js"></script>
40-
<script src="_static/scripts/sphinx-book-theme.js?digest=f31d14ad54b65d19161ba51d4ffff3a77ae00456"></script>
40+
<script src="_static/scripts/sphinx-book-theme.js?digest=9c920249402e914e316237a7dbc6769907cce411"></script>
4141
<script>let toggleHintShow = 'Click to show';</script>
4242
<script>let toggleHintHide = 'Click to hide';</script>
4343
<script>let toggleOpenOnPrint = 'true';</script>

0 commit comments

Comments
 (0)