Your goal is be able to perform an experiment where we measure whether or not the neuron fired a spike and see what information you can decode (or mind read) about the location of the rat. As a first step, enumerate all the possible outcomes for the experiment and calculate their probabilities given the initial data you collected.

We assume two possible events for the spike measured (the event $R=0$ or the event $R=1$) and two possible events for the rat location (the event A or B, as we will assume from now on that the rat is either in room A or room B). Hence, there will be four possible outcomes of the experiment:

The rat is room A and the neuron spikes (the event $A$ and the event $R=1$).
The rat is room A and the neuron does not spike (the event $A$ and the event $R=0$).
The rat is room B and the neuron spikes (the event $B$ and the event $R=1$).
The rat is room B and the neuron does not spike (the event $B$ and the event $R=0$).
For starters, let's determine the probability of the first outcome, that the rat is in room A and the neuron spikes.

We already estimated the probability that the rat is in room A, $P(A)=$ , and the conditional probability of a spike given A, $P(R=1\,|\,A)=$ .

To estimate the probability that the rat is in room A and the neuron spikes, we need to multiply the probability that the rat is in room A, $P(A)$, by the probability that the neuron spikes conditioned on the rat being in room A. In equations, we write this as $$P(R=1, A) = P(A) P(R=1 \,|\, A).$$
(The comma means “and”, so $P(A,B)$ means the probability of event $A$ and event $B$. The order doesn't matter, so $P(R=1, A) = P(A, R=1)$)

Calculate the probability of the first outcome. $P(R=1,A) = $

To calculate the probability that the rat is in room $A$ and the neuron did not spike, we can use an analogous formula: $P(R=0,A) = P(A)P(R=0\,|\, A)$. We've already calculated both probabilities on the right hand side, so all is needed is to multiply them. Therefore $P(R=0, A) = $

Hint
Since we know that either the event $R=1$ occurred or the event $R=0$ occurred, the probability that either even occurred must be 1. Therefore, the probability that the event $R=0$ occurred is just one minus the probability that the event $R=1$ occurred.

Hide help

Repeat this calculation for the third and fourth outcomes.

The probability of the third outcome, i.e., that the rat was in room B and the neuron spiked, is:
$P(R=1, B) = P(B) P(R=1\,|\,B) = $ .

The probability of the fourth outcome, i.e., that the rat was in room B and the neuron did not spike, is:
$P(R=0, B) =$ .

Summarize the results in a contingency table.
The bottom right corner is the overall total, i.e., the probability that any of the four outcomes occurred: $P(R=1, A) + P(R=0, A) + P(R=1, B) + P(R=0,B) $. The value for this corner makes sense because we allow a small probability that one of the four outcomes did not occur. one of the four outcomes must occur.

Hint
In the main part of the contingency table (the four cells in the upper left), enter the probabilities of the four different outcomes. The row and column headings label the events so that, for example, the upper left cell is $P(A,R=0)$.

The final row and column total the corresponding row or column. For example, the top right cell is the total probability that event A occurred, i.e., $P(A) = P(A, R=0) + P(A, R=1)$.

Hide help

Now, if you record the neuron for one 10 ms window (without observing the rat), we want to calculate the probability that you will record a spike, i.e., the probability of the event $R=1$. We denote this probability by $P(R=1)$.

If you record a spike, which outcome(s) from the contingency table must have occurred? One of the two outcomes in the second column. The second outcome from the second column. The first outcome from the first column. The first outcome from the second column. The second outcome from the first column. One of the two outcomes in the first column. One of the two outcomes in the first row. One of the two outcomes in the second row.

Since the probability that a neuron spiked is the sum of the probabilities of those outcomes, the probability you will record a spike is $P(R=1)=$

On the other hand, the probability you don't record a spike is $P(R=0) = $ .

Hint
To calculate the probability $P(R=1)$, we just need to add up the probabilities of all the outcomes that include the neuron spiking. Since we've enumerated all the possible outcomes, it's just a matter of picking the ones with a spike and adding up their probabilities.

To calculate the probability $P(R=0)$, we could add up the probabilities of all the outcomes that include the neuron not spiking. Or since we are assuming that either $R=0$ or $R=1$, we could just subtract $P(R=1)$ from $1$ to get $P(R=0)$.

Hide help

We can finally get to answer the question we started out to answer: if we record a spike from the neuron in a 10 ms window (without observing the rat's location), what's the probability it is in room A? (We can then get the probability it is in room B for free since these probabilities must add up to one.)

Here's a trivial question. If we record that the fact that the neuron spiked, what's the probability that $R=1$? . That's because, if we recorded that spike, we know that we had to be in the second column of the contingency table, so the total probability of that column must be 1.

Given that we know that we are in the second column (i.e., that we measured that a spike occurred), what's the likelihood we were in the first row versus in the second row (i.e., that the rat was in room A rather than room B)? To answer this question, we just need to rescale the probabilities so that the total probability for second column is 1. In other words, we need to divide the values in the second column by its total $P(R=1) = $ .

What you calculated in that rescaled table were the conditional probabilities: the probability $P(A \,|\, R=1)$ of being in room $A$ conditioned on the presence of a spike and the probability $P(B \,|\, R=1)$ of being in room $B$ conditioned on the presence of a spike.

By rescaling the table column, you calculated $P(A \,|\, R=1)$ as the ratio of two probabilities: (i) the probability that the rat was in room A and the neuron spiked and (ii) the probability that the neuron spiked. In equations:
\begin{align}
P(A \,|\, R=1) = \frac{P(R=1,A)}{P(R=1)}.
\label{eq:pAR1}
\end{align}
The division by $P(R=1)$ is the rescaling due to the fact we are only considering cases where the neuron spiked. You could think of estimating the probability $P(A \,|\, R=1)$ by counting all the times the rat was in room A with the neuron spiking and dividing (i.e., rescaling) by the total number of times that the neuron spiked.

Let's summarize the results.

Equation \eqref{eq:pAR1} gives an expression for $P(A \,|\, R=1)$. The numerator of this expression is $P(R=1, A)$. Above, we calculated this value as $P(R=1, A) = P(R=1 \,|\,A) P(A)$. Recall that we started with the values of $P(R=1 \,|\,A)$ and $P(A)$, as they are the probability of a spike given that the rat was in room A and the probability of the rat being in room A, respectively.

Rewrite equation \eqref{eq:pAR1} using the numerator $P(R=1 \,|\,A) P(A)$.
$P(A \,|\, R=1) =$

This expression for $P(A \,|\, R=1)$ in terms of $P(R=1 \,|\,A)$ is called Bayes' Theorem . If you know the probability $P(A)$ that the rat is in room A and the probability $P(R=1)$ that the neuron fires a spike, then you can use Bayes' Theorem to convert $P(R=1 \,|\,A)$ (the probability of spiking conditioned on being in room A) into $P(A \,|\, R=1)$ (the probability of being in room A conditioned on spiking).

You can likewise use Bayes' theorem in the case where you record the activity of the neuron in a 10 ms window and observe that the neuron did not fire a spike. In this case, we know that an outcome from the first column of the contingency table occurred, and Bayes' theorem is equivalent to rescaling that column by its total.

Write Bayes' theorem for determining the probability that the rat is in room A given that you measured that the neuron did not spike.
$P(A \,|\, R=0) =$

Write Bayes' theorem for determining the probability that the rat is in room B given that you measured that the neuron did not spike.
$P(B \,|\, R=0) =$

However, since we assume that rat must be in either room A or room B, we know that $P(A \,|\, R=0) + P(B \,|\, R=0) = $ . Hence, it'd be overkill to use Bayes' theorem twice for both $P(A \,|\, R=0)$ and $P(B \,|\, R=0)$, but you could if you like.

Given that the neuron did not spike in a 10 ms window, what is the probability that the rat is in room A?
$P(A \,|\, R=0) = $ .

What is the probability that the rat is in room B when you observe a lack of a spike?
$P(B\,|\, R=0) = $ .