working through examples of conditional probs
This commit is contained in:
parent
e79fd84b94
commit
601bfc9411
19
R/ch2.R
19
R/ch2.R
|
@ -25,3 +25,22 @@ fake_news|>
|
|||
tally() |>
|
||||
mutate(prop = n / sum(n))
|
||||
|
||||
# usage of "!" in fake vs real articles
|
||||
fake_news |>
|
||||
group_by(type, title_has_excl) |>
|
||||
summarise(
|
||||
total_usage_of_excl = n()
|
||||
) |>
|
||||
ungroup() |>
|
||||
group_by(type) |>
|
||||
summarise(
|
||||
prop_excl_within_type = total_usage_of_excl / sum(total_usage_of_excl),
|
||||
title_has_excl
|
||||
) |>
|
||||
filter(type == "fake")
|
||||
|
||||
# P(A ^ B) = P(A|B)*P(B)
|
||||
# P(B) = .4
|
||||
# P(A|B) = .2667
|
||||
# => P(A|B)*P(B)
|
||||
.4 * .2667
|
||||
|
|
Loading…
Reference in New Issue