Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
mjskay committed Nov 15, 2018
1 parent 0e33b7a commit e42cedc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions marginal-effects_categorical-predictor.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ $$
\end{align}
$$

Put another way, what's the probability that a new observation $y$ will be equal to `TRUE` given its particular values of $A$ and $B$?
Put another way, what proportion of observations in the population do we expect to be equal to `TRUE` for each combination of values of $A$ and $B$?

Fortunately, `add_fitted_draws` gives us the posterior distribution for exactly this quantity:

Expand Down Expand Up @@ -159,8 +159,6 @@ $$

**It is very important to stress** that this depends on a population made up of equal proportions of all possible values of $B$ being a meaningful thing to talk about.

Also remember that all of these expectations are random variables.

Given the above, we can take the following steps to get the marginalized version:

1. Condition on all values of categorical variables (using `modelr::data_grid`)
Expand Down
3 changes: 1 addition & 2 deletions marginal-effects_categorical-predictor.html
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ <h3>Marginal effects at particular/“representative” values (“MER” margin
\textrm{E}[y | A, B] &amp;= q | A, B
\end{align}
\]</span></p>
<p>Put another way, what’s the probability that a new observation <span class="math inline">\(y\)</span> will be equal to <code>TRUE</code> given its particular values of <span class="math inline">\(A\)</span> and <span class="math inline">\(B\)</span>?</p>
<p>Put another way, what proportion of observations in the population do we expect to be equal to <code>TRUE</code> for each combination of values of <span class="math inline">\(A\)</span> and <span class="math inline">\(B\)</span>?</p>
<p>Fortunately, <code>add_fitted_draws</code> gives us the posterior distribution for exactly this quantity:</p>
<pre class="r"><code>AB_plot = df %&gt;%
data_grid(A, B) %&gt;%
Expand Down Expand Up @@ -472,7 +472,6 @@ <h3>Average marginal effects (“AME”)</h3>
\end{align}
\]</span></p>
<p><strong>It is very important to stress</strong> that this depends on a population made up of equal proportions of all possible values of <span class="math inline">\(B\)</span> being a meaningful thing to talk about.</p>
<p>Also remember that all of these expectations are random variables.</p>
<p>Given the above, we can take the following steps to get the marginalized version:</p>
<ol style="list-style-type: decimal">
<li>Condition on all values of categorical variables (using <code>modelr::data_grid</code>)</li>
Expand Down

0 comments on commit e42cedc

Please sign in to comment.