more work

This commit is contained in:
Emanuel Rodriguez 2022-09-13 23:27:50 -07:00
parent 0d08907a15
commit 2c6cfadb0c
5 changed files with 199 additions and 100 deletions

View File

@ -241,12 +241,12 @@ Probability and Likelihood
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true" tabindex="-1"></a> gt<span class="sc">::</span><span class="fu">cols_width</span>(<span class="fu">everything</span>() <span class="sc">~</span> <span class="fu">px</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-display">
<div id="gqllsnwjsv" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<div id="ujjornjsef" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>html {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
}
#gqllsnwjsv .gt_table {
#ujjornjsef .gt_table {
display: table;
border-collapse: collapse;
margin-left: auto;
@ -271,7 +271,7 @@ Probability and Likelihood
border-left-color: #D3D3D3;
}
#gqllsnwjsv .gt_heading {
#ujjornjsef .gt_heading {
background-color: #FFFFFF;
text-align: center;
border-bottom-color: #FFFFFF;
@ -283,7 +283,7 @@ Probability and Likelihood
border-right-color: #D3D3D3;
}
#gqllsnwjsv .gt_title {
#ujjornjsef .gt_title {
color: #333333;
font-size: 125%;
font-weight: initial;
@ -295,7 +295,7 @@ Probability and Likelihood
border-bottom-width: 0;
}
#gqllsnwjsv .gt_subtitle {
#ujjornjsef .gt_subtitle {
color: #333333;
font-size: 85%;
font-weight: initial;
@ -307,13 +307,13 @@ Probability and Likelihood
border-top-width: 0;
}
#gqllsnwjsv .gt_bottom_border {
#ujjornjsef .gt_bottom_border {
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
}
#gqllsnwjsv .gt_col_headings {
#ujjornjsef .gt_col_headings {
border-top-style: solid;
border-top-width: 2px;
border-top-color: #D3D3D3;
@ -328,7 +328,7 @@ Probability and Likelihood
border-right-color: #D3D3D3;
}
#gqllsnwjsv .gt_col_heading {
#ujjornjsef .gt_col_heading {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
@ -348,7 +348,7 @@ Probability and Likelihood
overflow-x: hidden;
}
#gqllsnwjsv .gt_column_spanner_outer {
#ujjornjsef .gt_column_spanner_outer {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
@ -360,15 +360,15 @@ Probability and Likelihood
padding-right: 4px;
}
#gqllsnwjsv .gt_column_spanner_outer:first-child {
#ujjornjsef .gt_column_spanner_outer:first-child {
padding-left: 0;
}
#gqllsnwjsv .gt_column_spanner_outer:last-child {
#ujjornjsef .gt_column_spanner_outer:last-child {
padding-right: 0;
}
#gqllsnwjsv .gt_column_spanner {
#ujjornjsef .gt_column_spanner {
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
@ -380,7 +380,7 @@ Probability and Likelihood
width: 100%;
}
#gqllsnwjsv .gt_group_heading {
#ujjornjsef .gt_group_heading {
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
@ -405,7 +405,7 @@ Probability and Likelihood
vertical-align: middle;
}
#gqllsnwjsv .gt_empty_group_heading {
#ujjornjsef .gt_empty_group_heading {
padding: 0.5px;
color: #333333;
background-color: #FFFFFF;
@ -420,15 +420,15 @@ Probability and Likelihood
vertical-align: middle;
}
#gqllsnwjsv .gt_from_md > :first-child {
#ujjornjsef .gt_from_md > :first-child {
margin-top: 0;
}
#gqllsnwjsv .gt_from_md > :last-child {
#ujjornjsef .gt_from_md > :last-child {
margin-bottom: 0;
}
#gqllsnwjsv .gt_row {
#ujjornjsef .gt_row {
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
@ -447,7 +447,7 @@ Probability and Likelihood
overflow-x: hidden;
}
#gqllsnwjsv .gt_stub {
#ujjornjsef .gt_stub {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
@ -460,7 +460,7 @@ Probability and Likelihood
padding-right: 5px;
}
#gqllsnwjsv .gt_stub_row_group {
#ujjornjsef .gt_stub_row_group {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
@ -474,11 +474,11 @@ Probability and Likelihood
vertical-align: top;
}
#gqllsnwjsv .gt_row_group_first td {
#ujjornjsef .gt_row_group_first td {
border-top-width: 2px;
}
#gqllsnwjsv .gt_summary_row {
#ujjornjsef .gt_summary_row {
color: #333333;
background-color: #FFFFFF;
text-transform: inherit;
@ -488,16 +488,16 @@ Probability and Likelihood
padding-right: 5px;
}
#gqllsnwjsv .gt_first_summary_row {
#ujjornjsef .gt_first_summary_row {
border-top-style: solid;
border-top-color: #D3D3D3;
}
#gqllsnwjsv .gt_first_summary_row.thick {
#ujjornjsef .gt_first_summary_row.thick {
border-top-width: 2px;
}
#gqllsnwjsv .gt_last_summary_row {
#ujjornjsef .gt_last_summary_row {
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
@ -507,7 +507,7 @@ Probability and Likelihood
border-bottom-color: #D3D3D3;
}
#gqllsnwjsv .gt_grand_summary_row {
#ujjornjsef .gt_grand_summary_row {
color: #333333;
background-color: #FFFFFF;
text-transform: inherit;
@ -517,7 +517,7 @@ Probability and Likelihood
padding-right: 5px;
}
#gqllsnwjsv .gt_first_grand_summary_row {
#ujjornjsef .gt_first_grand_summary_row {
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
@ -527,11 +527,11 @@ Probability and Likelihood
border-top-color: #D3D3D3;
}
#gqllsnwjsv .gt_striped {
#ujjornjsef .gt_striped {
background-color: rgba(128, 128, 128, 0.05);
}
#gqllsnwjsv .gt_table_body {
#ujjornjsef .gt_table_body {
border-top-style: solid;
border-top-width: 2px;
border-top-color: #D3D3D3;
@ -540,7 +540,7 @@ Probability and Likelihood
border-bottom-color: #D3D3D3;
}
#gqllsnwjsv .gt_footnotes {
#ujjornjsef .gt_footnotes {
color: #333333;
background-color: #FFFFFF;
border-bottom-style: none;
@ -554,7 +554,7 @@ Probability and Likelihood
border-right-color: #D3D3D3;
}
#gqllsnwjsv .gt_footnote {
#ujjornjsef .gt_footnote {
margin: 0px;
font-size: 90%;
padding-left: 4px;
@ -563,7 +563,7 @@ Probability and Likelihood
padding-right: 5px;
}
#gqllsnwjsv .gt_sourcenotes {
#ujjornjsef .gt_sourcenotes {
color: #333333;
background-color: #FFFFFF;
border-bottom-style: none;
@ -577,7 +577,7 @@ Probability and Likelihood
border-right-color: #D3D3D3;
}
#gqllsnwjsv .gt_sourcenote {
#ujjornjsef .gt_sourcenote {
font-size: 90%;
padding-top: 4px;
padding-bottom: 4px;
@ -585,64 +585,64 @@ Probability and Likelihood
padding-right: 5px;
}
#gqllsnwjsv .gt_left {
#ujjornjsef .gt_left {
text-align: left;
}
#gqllsnwjsv .gt_center {
#ujjornjsef .gt_center {
text-align: center;
}
#gqllsnwjsv .gt_right {
#ujjornjsef .gt_right {
text-align: right;
font-variant-numeric: tabular-nums;
}
#gqllsnwjsv .gt_font_normal {
#ujjornjsef .gt_font_normal {
font-weight: normal;
}
#gqllsnwjsv .gt_font_bold {
#ujjornjsef .gt_font_bold {
font-weight: bold;
}
#gqllsnwjsv .gt_font_italic {
#ujjornjsef .gt_font_italic {
font-style: italic;
}
#gqllsnwjsv .gt_super {
#ujjornjsef .gt_super {
font-size: 65%;
}
#gqllsnwjsv .gt_footnote_marks {
#ujjornjsef .gt_footnote_marks {
font-style: italic;
font-weight: normal;
font-size: 75%;
vertical-align: 0.4em;
}
#gqllsnwjsv .gt_asterisk {
#ujjornjsef .gt_asterisk {
font-size: 100%;
vertical-align: 0;
}
#gqllsnwjsv .gt_indent_1 {
#ujjornjsef .gt_indent_1 {
text-indent: 5px;
}
#gqllsnwjsv .gt_indent_2 {
#ujjornjsef .gt_indent_2 {
text-indent: 10px;
}
#gqllsnwjsv .gt_indent_3 {
#ujjornjsef .gt_indent_3 {
text-indent: 15px;
}
#gqllsnwjsv .gt_indent_4 {
#ujjornjsef .gt_indent_4 {
text-indent: 20px;
}
#gqllsnwjsv .gt_indent_5 {
#ujjornjsef .gt_indent_5 {
text-indent: 25px;
}
</style>
@ -851,12 +851,12 @@ Bayes Rule
<span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a> gt<span class="sc">::</span><span class="fu">cols_width</span>(<span class="fu">everything</span>() <span class="sc">~</span> <span class="fu">px</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-display">
<div id="roxupfdiiw" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<div id="pnxskxfvyw" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
<style>html {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
}
#roxupfdiiw .gt_table {
#pnxskxfvyw .gt_table {
display: table;
border-collapse: collapse;
margin-left: auto;
@ -881,7 +881,7 @@ Bayes Rule
border-left-color: #D3D3D3;
}
#roxupfdiiw .gt_heading {
#pnxskxfvyw .gt_heading {
background-color: #FFFFFF;
text-align: center;
border-bottom-color: #FFFFFF;
@ -893,7 +893,7 @@ Bayes Rule
border-right-color: #D3D3D3;
}
#roxupfdiiw .gt_title {
#pnxskxfvyw .gt_title {
color: #333333;
font-size: 125%;
font-weight: initial;
@ -905,7 +905,7 @@ Bayes Rule
border-bottom-width: 0;
}
#roxupfdiiw .gt_subtitle {
#pnxskxfvyw .gt_subtitle {
color: #333333;
font-size: 85%;
font-weight: initial;
@ -917,13 +917,13 @@ Bayes Rule
border-top-width: 0;
}
#roxupfdiiw .gt_bottom_border {
#pnxskxfvyw .gt_bottom_border {
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
}
#roxupfdiiw .gt_col_headings {
#pnxskxfvyw .gt_col_headings {
border-top-style: solid;
border-top-width: 2px;
border-top-color: #D3D3D3;
@ -938,7 +938,7 @@ Bayes Rule
border-right-color: #D3D3D3;
}
#roxupfdiiw .gt_col_heading {
#pnxskxfvyw .gt_col_heading {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
@ -958,7 +958,7 @@ Bayes Rule
overflow-x: hidden;
}
#roxupfdiiw .gt_column_spanner_outer {
#pnxskxfvyw .gt_column_spanner_outer {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
@ -970,15 +970,15 @@ Bayes Rule
padding-right: 4px;
}
#roxupfdiiw .gt_column_spanner_outer:first-child {
#pnxskxfvyw .gt_column_spanner_outer:first-child {
padding-left: 0;
}
#roxupfdiiw .gt_column_spanner_outer:last-child {
#pnxskxfvyw .gt_column_spanner_outer:last-child {
padding-right: 0;
}
#roxupfdiiw .gt_column_spanner {
#pnxskxfvyw .gt_column_spanner {
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #D3D3D3;
@ -990,7 +990,7 @@ Bayes Rule
width: 100%;
}
#roxupfdiiw .gt_group_heading {
#pnxskxfvyw .gt_group_heading {
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
@ -1015,7 +1015,7 @@ Bayes Rule
vertical-align: middle;
}
#roxupfdiiw .gt_empty_group_heading {
#pnxskxfvyw .gt_empty_group_heading {
padding: 0.5px;
color: #333333;
background-color: #FFFFFF;
@ -1030,15 +1030,15 @@ Bayes Rule
vertical-align: middle;
}
#roxupfdiiw .gt_from_md > :first-child {
#pnxskxfvyw .gt_from_md > :first-child {
margin-top: 0;
}
#roxupfdiiw .gt_from_md > :last-child {
#pnxskxfvyw .gt_from_md > :last-child {
margin-bottom: 0;
}
#roxupfdiiw .gt_row {
#pnxskxfvyw .gt_row {
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
@ -1057,7 +1057,7 @@ Bayes Rule
overflow-x: hidden;
}
#roxupfdiiw .gt_stub {
#pnxskxfvyw .gt_stub {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
@ -1070,7 +1070,7 @@ Bayes Rule
padding-right: 5px;
}
#roxupfdiiw .gt_stub_row_group {
#pnxskxfvyw .gt_stub_row_group {
color: #333333;
background-color: #FFFFFF;
font-size: 100%;
@ -1084,11 +1084,11 @@ Bayes Rule
vertical-align: top;
}
#roxupfdiiw .gt_row_group_first td {
#pnxskxfvyw .gt_row_group_first td {
border-top-width: 2px;
}
#roxupfdiiw .gt_summary_row {
#pnxskxfvyw .gt_summary_row {
color: #333333;
background-color: #FFFFFF;
text-transform: inherit;
@ -1098,16 +1098,16 @@ Bayes Rule
padding-right: 5px;
}
#roxupfdiiw .gt_first_summary_row {
#pnxskxfvyw .gt_first_summary_row {
border-top-style: solid;
border-top-color: #D3D3D3;
}
#roxupfdiiw .gt_first_summary_row.thick {
#pnxskxfvyw .gt_first_summary_row.thick {
border-top-width: 2px;
}
#roxupfdiiw .gt_last_summary_row {
#pnxskxfvyw .gt_last_summary_row {
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
@ -1117,7 +1117,7 @@ Bayes Rule
border-bottom-color: #D3D3D3;
}
#roxupfdiiw .gt_grand_summary_row {
#pnxskxfvyw .gt_grand_summary_row {
color: #333333;
background-color: #FFFFFF;
text-transform: inherit;
@ -1127,7 +1127,7 @@ Bayes Rule
padding-right: 5px;
}
#roxupfdiiw .gt_first_grand_summary_row {
#pnxskxfvyw .gt_first_grand_summary_row {
padding-top: 8px;
padding-bottom: 8px;
padding-left: 5px;
@ -1137,11 +1137,11 @@ Bayes Rule
border-top-color: #D3D3D3;
}
#roxupfdiiw .gt_striped {
#pnxskxfvyw .gt_striped {
background-color: rgba(128, 128, 128, 0.05);
}
#roxupfdiiw .gt_table_body {
#pnxskxfvyw .gt_table_body {
border-top-style: solid;
border-top-width: 2px;
border-top-color: #D3D3D3;
@ -1150,7 +1150,7 @@ Bayes Rule
border-bottom-color: #D3D3D3;
}
#roxupfdiiw .gt_footnotes {
#pnxskxfvyw .gt_footnotes {
color: #333333;
background-color: #FFFFFF;
border-bottom-style: none;
@ -1164,7 +1164,7 @@ Bayes Rule
border-right-color: #D3D3D3;
}
#roxupfdiiw .gt_footnote {
#pnxskxfvyw .gt_footnote {
margin: 0px;
font-size: 90%;
padding-left: 4px;
@ -1173,7 +1173,7 @@ Bayes Rule
padding-right: 5px;
}
#roxupfdiiw .gt_sourcenotes {
#pnxskxfvyw .gt_sourcenotes {
color: #333333;
background-color: #FFFFFF;
border-bottom-style: none;
@ -1187,7 +1187,7 @@ Bayes Rule
border-right-color: #D3D3D3;
}
#roxupfdiiw .gt_sourcenote {
#pnxskxfvyw .gt_sourcenote {
font-size: 90%;
padding-top: 4px;
padding-bottom: 4px;
@ -1195,64 +1195,64 @@ Bayes Rule
padding-right: 5px;
}
#roxupfdiiw .gt_left {
#pnxskxfvyw .gt_left {
text-align: left;
}
#roxupfdiiw .gt_center {
#pnxskxfvyw .gt_center {
text-align: center;
}
#roxupfdiiw .gt_right {
#pnxskxfvyw .gt_right {
text-align: right;
font-variant-numeric: tabular-nums;
}
#roxupfdiiw .gt_font_normal {
#pnxskxfvyw .gt_font_normal {
font-weight: normal;
}
#roxupfdiiw .gt_font_bold {
#pnxskxfvyw .gt_font_bold {
font-weight: bold;
}
#roxupfdiiw .gt_font_italic {
#pnxskxfvyw .gt_font_italic {
font-style: italic;
}
#roxupfdiiw .gt_super {
#pnxskxfvyw .gt_super {
font-size: 65%;
}
#roxupfdiiw .gt_footnote_marks {
#pnxskxfvyw .gt_footnote_marks {
font-style: italic;
font-weight: normal;
font-size: 75%;
vertical-align: 0.4em;
}
#roxupfdiiw .gt_asterisk {
#pnxskxfvyw .gt_asterisk {
font-size: 100%;
vertical-align: 0;
}
#roxupfdiiw .gt_indent_1 {
#pnxskxfvyw .gt_indent_1 {
text-indent: 5px;
}
#roxupfdiiw .gt_indent_2 {
#pnxskxfvyw .gt_indent_2 {
text-indent: 10px;
}
#roxupfdiiw .gt_indent_3 {
#pnxskxfvyw .gt_indent_3 {
text-indent: 15px;
}
#roxupfdiiw .gt_indent_4 {
#pnxskxfvyw .gt_indent_4 {
text-indent: 20px;
}
#roxupfdiiw .gt_indent_5 {
#pnxskxfvyw .gt_indent_5 {
text-indent: 25px;
}
</style>
@ -1272,11 +1272,11 @@ Bayes Rule
</thead>
<tbody class="gt_table_body">
<tr><td class="gt_row gt_left">fake</td>
<td class="gt_row gt_right">3967</td>
<td class="gt_row gt_right">0.3967</td></tr>
<td class="gt_row gt_right">4011</td>
<td class="gt_row gt_right">0.4011</td></tr>
<tr><td class="gt_row gt_left">real</td>
<td class="gt_row gt_right">6033</td>
<td class="gt_row gt_right">0.6033</td></tr>
<td class="gt_row gt_right">5989</td>
<td class="gt_row gt_right">0.5989</td></tr>
</tbody>
@ -1313,8 +1313,8 @@ Bayes Rule
# Groups: usage [2]
usage fake real
&lt;chr&gt; &lt;int&gt; &lt;int&gt;
1 no 2891 5910
2 yes 1076 123</code></pre>
1 no 2942 5856
2 yes 1069 133</code></pre>
</div>
</div>
<div class="cell">
@ -1341,8 +1341,8 @@ Bayes Rule
<pre><code># A tibble: 2 × 3
type total prop
&lt;chr&gt; &lt;int&gt; &lt;dbl&gt;
1 fake 1076 0.897
2 real 123 0.103</code></pre>
1 fake 1069 0.889
2 real 133 0.111</code></pre>
</div>
</div>
</section>
@ -1586,6 +1586,81 @@ Important
<p>this has been mentioned before but its an important message to drive home. Note that the reason why thes values sum to a value greater than 1 is that they are <strong>not</strong> probabilities, they are likelihoods. We are determining how likely each value of <span class="math inline">\(\pi\)</span> is given that we have observed <span class="math inline">\(Y = 1\)</span>.</p>
</div>
</div>
<p>We can formalize the likelihood function <span class="math inline">\(L\)</span> in our example as follows:</p>
<p><span class="math display">\[L(\pi|y=1) = f(y=1|\pi) = {6 \choose 1}\pi^1(1-\pi)^{6-1}\]</span> <span class="math display">\[ = 6\pi(1 - \pi)^5\]</span></p>
<p>We can test this out</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb26"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a><span class="dv">6</span> <span class="sc">*</span> .<span class="dv">2</span> <span class="sc">*</span> (.<span class="dv">8</span> <span class="sc">^</span> <span class="dv">5</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-stdout">
<pre><code>[1] 0.393216</code></pre>
</div>
</div>
<p>which is the value we get as .2 in the bar plot above.</p>
<p>the likelihood values for <span class="math inline">\(Y = 1\)</span> are here:</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb28"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a>d <span class="sc">|&gt;</span></span>
<span id="cb28-2"><a href="#cb28-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(ys <span class="sc">==</span> <span class="dv">1</span>)<span class="sc">|&gt;</span></span>
<span id="cb28-3"><a href="#cb28-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">select</span>(<span class="sc">-</span>display_pi) <span class="sc">|&gt;</span></span>
<span id="cb28-4"><a href="#cb28-4" aria-hidden="true" tabindex="-1"></a> knitr<span class="sc">::</span><span class="fu">kable</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output-display">
<table class="table table-sm table-striped">
<thead>
<tr class="header">
<th style="text-align: right;">pies</th>
<th style="text-align: right;">ys</th>
<th style="text-align: right;">fys</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: right;">0.1</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">0.354294</td>
</tr>
<tr class="even">
<td style="text-align: right;">0.2</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">0.393216</td>
</tr>
<tr class="odd">
<td style="text-align: right;">0.3</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">0.302526</td>
</tr>
<tr class="even">
<td style="text-align: right;">0.4</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">0.186624</td>
</tr>
<tr class="odd">
<td style="text-align: right;">0.5</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">0.093750</td>
</tr>
<tr class="even">
<td style="text-align: right;">0.6</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">0.036864</td>
</tr>
<tr class="odd">
<td style="text-align: right;">0.7</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">0.010206</td>
</tr>
<tr class="even">
<td style="text-align: right;">0.8</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">0.001536</td>
</tr>
<tr class="odd">
<td style="text-align: right;">0.9</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">0.000054</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
</main>

View File

@ -543,4 +543,27 @@ are likelihoods. We are determining how likely each value of
$\pi$ is given that we have observed $Y = 1$.
:::
We can formalize the likelihood function $L$ in our example
as follows:
$$L(\pi|y=1) = f(y=1|\pi) = {6 \choose 1}\pi^1(1-\pi)^{6-1}$$
$$ = 6\pi(1 - \pi)^5$$
We can test this out
```{r}
6 * .2 * (.8 ^ 5)
```
which is the value we get as .2 in the bar plot above.
the likelihood values for $Y = 1$ are here:
```{r}
d |>
filter(ys == 1)|>
select(-display_pi) |>
knitr::kable()
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,4 +1,5 @@
@import url('https://fonts.googleapis.com/css?family=Lora&display=swap');
@import url('https://fonts.googleapis.com/css?family=Source+Code+Pro&display=swap');
body {
font-family: 'Lora';