Skip to content

Commit 735972f

Browse files
committed
Clean up
Delete newquestion folder General language cleanups Fix index
1 parent 3ba34f6 commit 735972f

File tree

4 files changed

+13
-200
lines changed

4 files changed

+13
-200
lines changed

newquestions/bayescoins/.gitignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

newquestions/bayescoins/ExampleQuestion.tex

Lines changed: 0 additions & 176 deletions
This file was deleted.

src/QuantitativePrimer.tex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,7 @@ \subsection{Phone interview, 1 hour}
787787
\subsection{Face-to-face, 1 hour}
788788

789789
\begin{question}{bayescoins}
790+
\index{questions!Bayes' law and coin flips}
790791
You have a bag with 1000 coins in it.
791792
One of them is a double headed coin, the other 999 are fair coins.
792793
I pick one coin from the bag at random, and flip it ten times.
@@ -1660,7 +1661,7 @@ \subsection{Questions for them}
16601661
to foldernames?
16611662
\item What programming languages does the team use? R, Python, C++, Julia, Matlab?
16621663
For data analysis? For scripting? For production?
1663-
\item Is the team Bayesians, frequentists, or whatever gets the job done?
1664+
\item Is the team made up of Bayesians, frequentists, or whatever gets the job done?
16641665
\item What are the backgrounds of the other team members? What would someone with my background contribute?
16651666
\item Are modellers expected to write the code to implement their models, or is this handled by developers?
16661667
\item How are datasets accessed? SQL (Postgres, MySQL, MSSQL, sqlite), Hadoop, csvs, Excel, shared folders, or do people throw around USB sticks?

src/answers/bayescoins.tex

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
\begin{answer}{bayescoins}
2-
This is another question about Bayes' law.
3-
Let's make some notation to use.
2+
This is another question that tests your knowledge of Bayes' law.
3+
Let's define some notation to use.
44
Define $H$ as the event that a coin comes up head, and $T$ that a coin comes up tails, and let $10H$ denote getting ten heads from ten coin flips.
55
Let $C_{F}$ be the event where we select the fair coin from the bag, and $C_{R}$ the event that we select the rigged coin.
66
This is one of the simplest questions about Bayes' law as there is not much to unpack.
@@ -27,11 +27,11 @@
2727
Since this will happen with certainty
2828
$P( 10H \vert C_{R} ) = 1$.
2929
For the fair coin each flip is independent, so you have
30-
$P( 10H \vert C_{F} )=P( 10 \vert C_{F} )^{10}= ({1}/{2})^{10} = {1}/{1024}$.
30+
$$P( 10H \vert C_{F} )=P( H \vert C_{F} )^{10}= ({1}/{2})^{10} = {1}/{1024}.$$
3131
Since you picked te coin out of a bag of 1000 coins, the probability that you selected the rigged coin is
3232
$P(C_{R}) = 1/1000$ and the probability that the coin you selected is fair is
3333
$P(C_{F}) = 999/1000$.
34-
You can substitute
34+
You can substitute these into \eqref{eq:1000coins:bayeslaw1} to get
3535
\begin{align*}
3636
P( C_{R} \vert 10H)
3737
&=
@@ -69,7 +69,7 @@
6969
which is slightly more than $1/2$.
7070

7171
This question is so well known that your interviewer likely won't even let you finish it.
72-
Once they see you can answer it they will move on to the next question.
72+
Once they see that you are on the right track they will move on to the next question.
7373
My interviewer didn't care about the answer, but he wanted me to describe \eqref{eq:1000coins:bayeslaw1} in detail.
7474
Since Bayes' law is just the application of conditional probability, you can derive it from first principles:
7575
\begin{align}
@@ -82,8 +82,8 @@
8282
P( 10H )
8383
}
8484
\end{align}
85-
and even a frequentist will agree with you here.
86-
The nominator is the joint probability of ten heads and the rigged coin, and it is easier to split this into another conditional probability:
85+
and even a frequentist will agree.
86+
The nominator is the joint probability of ten heads and the rigged coin being selected, and it is easier to split this into another conditional probability:
8787
\begin{align*}
8888
P( 10H , C_{R} )
8989
=
@@ -97,7 +97,7 @@
9797
P( C_{R} \vert 10H ) p( 10H )
9898
\text{,}
9999
\end{align*}
100-
but this is not helpful, as it contains the probability we are trying to determine and will lead to circular reasoning.
100+
but this is not helpful, as it contains the quantity we are trying to solve for, $P( C_{R} \vert 10H )$, and will lead to circular reasoning.
101101

102102
You can expand denominator in
103103
\eqref{eq:1000coins:bayesexplain}
@@ -119,18 +119,18 @@
119119
\text{,}
120120
\end{align*}
121121
by applying the law of conditional probability to each of the terms.
122-
Combining the nominator and the denominator yields \eqref{eq:1000coins:bayeslaw1}.
122+
Putting all this together yields \eqref{eq:1000coins:bayeslaw1}.
123123

124124
My interviewer used this Bayes' law question to test my handle on probability concepts.
125125
It is easy to confuse these basic concepts, which is another reason for doing proper interview preparation.
126126
Some interviewers ask this question and demand an ``intuitive'' solution that doesn't rely on algebraic manipulation.
127-
In this case, you could opt for a visual explanation of Bayes' Law, like that of answer \ref{a:bayeslawdisease}.
127+
In this case, you could opt for a visual explanation of Bayes' Law as discussed in answer \ref{a:bayeslawdisease}.
128128
If that's not what your interviewer wants, use the following argument.
129129
You know the probability of choosing the rigged coin is $1/1000$.
130130
You also know the probability of getting ten heads from a fair coin is $1/2^{10} = 1/1024$.
131131
These two events are about equally likely, meaning the probability that we have the double headed coin is about a half.
132132
If you only had nine heads in a row, the fair coin would give a probability of $1/512 = 2/1024$.
133-
That means the outcome of nine heads is about twice as likely with the fair coin as the probability of selecting the rigged coin.
133+
That means the outcome of nine heads is about twice as likely with the fair coin as the probability of selecting the rigged coin from the bag.
134134
So the odds of ${fair}{:}{rigged}$ are $2{:}1$, leading you to assign a probability of about $1/3$ to the rigged coin being selected.
135135
%TODO: could link this up to section on gambling mathematics
136136
\end{answer}

0 commit comments

Comments
 (0)