Skip to content

Commit

Permalink
deploy: aea8123
Browse files Browse the repository at this point in the history
  • Loading branch information
s3alfisc committed Dec 15, 2024
1 parent 143c039 commit 8564bab
Show file tree
Hide file tree
Showing 29 changed files with 2,619 additions and 2,619 deletions.
130 changes: 65 additions & 65 deletions changelog.html

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions compare-fixest-pyfixest.html

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions difference-in-differences.html

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions marginaleffects.html
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ <h1 class="title">Marginal Effects and Hypothesis Tests via <code>marginaleffect


<p>We can compute marginal effects and linear and non-linear hypothesis tests via the excellent <a href="https://github.com/vincentarelbundock/pymarginaleffects">marginaleffects</a> package.</p>
<div id="bd35bdc3" class="cell" data-execution_count="1">
<div id="bee69e29" class="cell" data-execution_count="1">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">from</span> marginaleffects <span class="im">import</span> hypotheses</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> pyfixest <span class="im">as</span> pf</span>
Expand All @@ -271,7 +271,7 @@ <h1 class="title">Marginal Effects and Hypothesis Tests via <code>marginaleffect
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a>fit.tidy()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display">

<div id="IMoTyc"></div>
<div id="1OziX9"></div>
<script type="text/javascript" data-lets-plot-script="library">
if(!window.letsPlotCallQueue) {
window.letsPlotCallQueue = [];
Expand All @@ -295,17 +295,17 @@ <h1 class="title">Marginal Effects and Hypothesis Tests via <code>marginaleffect
var div = document.createElement("div");
div.style.color = 'darkred';
div.textContent = 'Error loading Lets-Plot JS';
document.getElementById("IMoTyc").appendChild(div);
document.getElementById("1OziX9").appendChild(div);
};
var e = document.getElementById("IMoTyc");
var e = document.getElementById("1OziX9");
e.appendChild(script);
})()
</script>

</div>
<div class="cell-output cell-output-display">

<div id="qs5I5h"></div>
<div id="ccg89F"></div>
<script type="text/javascript" data-lets-plot-script="library">
if(!window.letsPlotCallQueue) {
window.letsPlotCallQueue = [];
Expand All @@ -329,9 +329,9 @@ <h1 class="title">Marginal Effects and Hypothesis Tests via <code>marginaleffect
var div = document.createElement("div");
div.style.color = 'darkred';
div.textContent = 'Error loading Lets-Plot JS';
document.getElementById("qs5I5h").appendChild(div);
document.getElementById("ccg89F").appendChild(div);
};
var e = document.getElementById("qs5I5h");
var e = document.getElementById("ccg89F");
e.appendChild(script);
})()
</script>
Expand Down Expand Up @@ -398,7 +398,7 @@ <h1 class="title">Marginal Effects and Hypothesis Tests via <code>marginaleffect
</div>
<p>Suppose we were interested in testing the hypothesis that <span class="math inline">\(X_{1} = X_{2}\)</span>. Given the relatively large differences in coefficients and small standard errors, we will likely reject the null that the two parameters are equal.</p>
<p>We can run the formal test via the <code>hypotheses</code> function from the <code>marginaleffects</code> package.</p>
<div id="e5527710" class="cell" data-execution_count="2">
<div id="f9d24f89" class="cell" data-execution_count="2">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>hypotheses(fit, <span class="st">"X1 - X2 = 0"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="2">
<div><style>
Expand Down Expand Up @@ -454,7 +454,7 @@ <h2 class="anchored" data-anchor-id="non-linear-hypothesis-tests-ratio-estimates
<p>We can also test run-linear hypotheses, in which case <code>marginaleffects</code> will automatically compute correct standard errors based on the estimated covariance matrix and the Delta method. This is for example useful for computing inferential statistics for the “relative uplift” in an AB test.</p>
<p>For the moment, let’s assume that <span class="math inline">\(X1\)</span> is a randomly assigned treatment variable. As before, <span class="math inline">\(Y\)</span> is our variable / KPI of interest.</p>
<p>Under randomization, the model intercept measures the “baseline”, i.e.&nbsp;the population average of <span class="math inline">\(Y\)</span> in the absence of treatment. To compute a relative uplift, we might compute</p>
<div id="9aeae210" class="cell" data-execution_count="3">
<div id="ced1a1e8" class="cell" data-execution_count="3">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>(fit.coef().xs(<span class="st">"X1"</span>) <span class="op">/</span> fit.coef().xs(<span class="st">"Intercept"</span>) <span class="op">-</span> <span class="dv">1</span>) <span class="op">*</span> <span class="dv">100</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="3">
<pre><code>np.float64(-211.71906665561212)</code></pre>
Expand All @@ -481,7 +481,7 @@ <h3 class="anchored" data-anchor-id="the-multivariate-delta-method">The Multivar
<section id="using-the-delta-method-via-marginaleffects" class="level3">
<h3 class="anchored" data-anchor-id="using-the-delta-method-via-marginaleffects">Using the Delta Method via <code>marginaleffects</code>:</h3>
<p>We can employ the Delta Method via <code>marginaleffects</code> via the <code>hypotheses</code> function:</p>
<div id="522a3bde" class="cell" data-execution_count="4">
<div id="9c73bf9a" class="cell" data-execution_count="4">
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>hypotheses(fit, <span class="st">"(X1 / Intercept - 1) * 100 = 0"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="4">
<div><style>
Expand Down
Binary file modified quarto_example/QuartoExample.pdf
Binary file not shown.
Loading

0 comments on commit 8564bab

Please sign in to comment.