generated from carpentries/workbench-template-rmd
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-generated via {sandpaper} Source : eb73856 Branch : main Author : Sarah Kaspar <[email protected]> Time : 2023-02-07 19:23:14 +0000 Message : Merge pull request #1 from zkamvar/znk-update-cache Update Package Cache
- Loading branch information
1 parent
d92ef89
commit 4d269f7
Showing
41 changed files
with
1,007 additions
and
529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,55 @@ | ||
--- | ||
title: "The binomial distribution" | ||
teaching: 10 | ||
exercises: 2 | ||
teaching: 5 | ||
exercises: 0 | ||
--- | ||
|
||
:::::::::::::::::::::::::::::::::::::: questions | ||
|
||
- What is the binomial distribution and? | ||
- What is the binomial distribution? | ||
- What kind of data is it used on? | ||
|
||
:::::::::::::::::::::::::::::::::::::::::::::::: | ||
|
||
::::::::::::::::::::::::::::::::::::: objectives | ||
|
||
|
||
- Explain how the binomial distribution describes outcomes of counting. | ||
|
||
:::::::::::::::::::::::::::::::::::::::::::::::: | ||
|
||
## Overview probability distributions | ||
|
||
The binomial distribution is what we have just seen in the example: We use it when we have a fixed sample size and count the number of "successes" in that sample -- for example mutations in a genome, or the number of cells within a sample that show a certain phenotype. | ||
|
||
TRANSLATE VIDEO | ||
|
||
|
||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: instructor | ||
|
||
Inline instructor notes can help inform instructors of timing challenges | ||
associated with the lessons. They appear in the "Instructor View" | ||
The binomial distribution is what we have just seen in the example: We use it when we have a fixed sample size and count the number of "successes" in that sample. Examples are: | ||
|
||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | ||
- how many locations in the genome carry a mutation | ||
- the number of cells within a sample that show a certain phenotype | ||
- how many patients out of 100 have a certain disease | ||
- how many out of 10 frogs are light green | ||
|
||
::::::::::::::::::::::::::::::::::::: challenge | ||
<p align="center"> | ||
<img src="/fig/sampling-frogs-2.png" width="500"/> | ||
</p> | ||
|
||
## Challenge 1: Which of the following statements are true? | ||
The binomial model has two parameters, which means the probabilities for the individual outcomes depend on two things: | ||
- $n$ is the number of trials, or frogs, or patients, and it’s fixed. | ||
- $p$ is the success probability. | ||
|
||
We are in a diagnostic laboratory that gets blood samples from incoming hospital patients and tests them for some disease. Which of these experiments can be modeled with a binomial distribution? | ||
Then the probability of observing $k$ successes out of $n$ draws (for example $k=4$ light coloured frogs out of $N=10$) can be described by this formula: | ||
|
||
1. Counting the total number of samples that get tested over one day. | ||
2. Counting the number of positive samples out of 50 samples that get tested successively. | ||
3. Measuring all the blood sample's volumes (in mL). | ||
$$P(X=k) = {n\choose k}p^k(1-p)^k$$ | ||
|
||
You don't have to remember this piece of math -- it's just to make the point that you can calculate the probability of an event that is modeled with the binomial distribution, if you know the success probability $p$ and the number of trials $n$, i.e. the parameters. | ||
|
||
:::::::::::::::::::::::: solution | ||
|
||
## Solution | ||
Counting the number of positive samples out of 50 samples that get tested successively. | ||
::::::::::::::::::: callout | ||
In the binomial we just define a particular outcome as success, for example a light-coloured frog, or a patient with disease, even though that may not be a favourable outcome. | ||
::::::::::::::::::::::::::::: | ||
|
||
::::::::::::::::::::::::::::::::: | ||
Here is what the distribution looks like for a success probability of 0.3 and a sample size of 10. | ||
|
||
|
||
## Challenge 2: Discrete distributions | ||
<p align="center"> | ||
<img src="/fig/binomial.png" width="500"/> | ||
</p> | ||
|
||
What is the probability of an outcome of X=1.5 in a discrete distribution? | ||
|
||
- 0 | ||
- 0.5 | ||
- 0.15 | ||
|
||
:::::::::::::::::::::::: solution | ||
|
||
The value $1.5$ is not discrete, and can therefore not occur in a discrete distribution. Its probability is zero. | ||
|
||
::::::::::::::::::::::::::::::::: | ||
:::::::::::::::::::::::::::::::::::::::::::::::: | ||
|
||
The expected value of the binomial is $n \times p$, which is quite intuitive: If we catch 10 frogs and the probability of being light-green is 0.3, then we expect to catch 3 light-green frogs on average. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.