# A tibble: 2 × 3
type total prop
<chr> <int> <dbl>
-1 fake 1076 0.897
-2 real 123 0.103
+1 fake 1069 0.889
+2 real 133 0.111
@@ -1586,6 +1586,81 @@ Important
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 not probabilities, they 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:
which is the value we get as .2 in the bar plot above.
+
the likelihood values for \(Y = 1\) are here:
+
+
d |>
+filter(ys ==1)|>
+select(-display_pi) |>
+ knitr::kable()
+
+
+
+
+
pies
+
ys
+
fys
+
+
+
+
+
0.1
+
1
+
0.354294
+
+
+
0.2
+
1
+
0.393216
+
+
+
0.3
+
1
+
0.302526
+
+
+
0.4
+
1
+
0.186624
+
+
+
0.5
+
1
+
0.093750
+
+
+
0.6
+
1
+
0.036864
+
+
+
0.7
+
1
+
0.010206
+
+
+
0.8
+
1
+
0.001536
+
+
+
0.9
+
1
+
0.000054
+
+
+
+
+
diff --git a/R/ch2.qmd b/R/ch2.qmd
index 4701623..975e471 100644
--- a/R/ch2.qmd
+++ b/R/ch2.qmd
@@ -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()
+```
+
+
diff --git a/R/ch2_files/figure-html/unnamed-chunk-11-1.png b/R/ch2_files/figure-html/unnamed-chunk-11-1.png
index 7057949..f58d865 100644
Binary files a/R/ch2_files/figure-html/unnamed-chunk-11-1.png and b/R/ch2_files/figure-html/unnamed-chunk-11-1.png differ
diff --git a/R/ch2_files/figure-html/unnamed-chunk-6-1.png b/R/ch2_files/figure-html/unnamed-chunk-6-1.png
index d2ed0b1..cfb1e1e 100644
Binary files a/R/ch2_files/figure-html/unnamed-chunk-6-1.png and b/R/ch2_files/figure-html/unnamed-chunk-6-1.png differ
diff --git a/R/styles.css b/R/styles.css
index b90550d..ea389ca 100644
--- a/R/styles.css
+++ b/R/styles.css
@@ -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';