You are tracking the distance to the Hogwarts Express. A magical instrument reports it’s 100 leagues away. Before the reading, your belief about the distance was a Gaussian . The instrument’s reading is the true distance plus Gaussian noise .
a. What is the PDF of your prior belief of the train’s true distance?
The Probability Density Function of the prior belief about the train's true distance is given by the Gaussian distribution with and , that is .
b. What is the probability density of seeing a reading of 100 leagues, given the true distance is t?
Let's call R the random variable that represents seeing a reading of pages, in this case 100. In shorts, we have to compute , where , as stated in the text, is the true distance plus a Gaussian noise . This means that the distribution of is . Then:
c. What is the PDF of your posterior belief (after the reading) of the train’s true distance? (You can leave a constant and don’t need to simplify).
In shorts, we have to compute . We can calculate this using Bayes' Theorem, that is:
Since the question allows us to leave a constant:
We have already found in part (a) and in part (b), so we have only to substitute:
We can combine the constant terms into a single proportionality constant:
2. Owls arrival in Owlery
On average, 5.5 owls arrive at the Owlery per minute. What is the probability that:
a. More than 7 owls will arrive in the next minute?
First, we decide to model the owl arrivals using a Poisson distribution, since we're looking at the number of events (owl arrivals) occurring in a fixed interval of time, given a known average rate of occurrence, and assuming the events happen independently.
The Probability Mass Function (PMF) for a Poisson distribution is:
In this case, we want to compute , where .
Let's do that:
b. More than 13 owls will arrive in the next 2 minutes?
The idea is the same as before, but note that the rate is owls per minute; therefore, for this case, . As before:
c. More than 15 owls will arrive in the next 3 minutes?
The idea is the same as before, but note that the rate is owls per minute; therefore, for this case, . As before:
3. Finding the median of a random variable
The median of a continuous random variable (like the height of a gnome) having cumulative distribution function is the value such that . Find the median of (in terms of distribution parameters) if:
a. (Uniform distribution, like the spread of Floo powder).
We only need to calculate , using Python or using the integral, that is .
b. What is the probability that the weekly number of visitors exceeds 2000 in at least 2 of the next 3 weeks?
Let's first compute the probability that the number of visitors exceeds 2000 for any given week:
.
Now, let's call be the number of weeks (out of 3) with more than visitors.
Surely, follows a binomial distribution with trials and .
Let's compute it:
5. Distribution of magical power levels of three Hogwarts students
Let X, Y , and Z be independent random variables representing the magical power levels of three Hogwarts students, where (Gryffindor), (Hufflepuff), and (Ravenclaw).
a. Let . What is the distribution of the combined power A?
For any two independent normal random variables and the sum of those two random variables is another normal: .
b. Let . What is the distribution of B (perhaps after a powerenhancing charm)?
If is a Normal such that and is a linear transform of such that then is also a Normal where: , then .
c. Let , where , , and are real-valued constants representing spell modifiers. What is the distribution (and parameters) for C? Show how you derived your answer.
As before, is a normal. Let's start by calculating its mean, that is simply
Let's now calculate the variance. Rember that the variance is not linear like expectation: .
Then
Putting all together:
6. A strange probability density function
The joint probability density function of continuous random variables X (skill in Potions) and Y (skill in Charms) is given by where .
a. What is the value of for this to be a valid probability density function?
To be a valid PDF, the total integral over the region must equal 1:
Let's compute the inner integral first:
Now substitute into the outer integral:
Set this equal to 1:
b. Are Potion skill () and Charm skill () independent? Explain.
Two variables and are independent if
Let's compute first the marginal density function of :
Now the marginal density function of :
In the previous answer we discovered that , thus we can conclude that:
The answer is no, and are not independent.
c. What is the marginal density function of ?
We have computed it in the previous answer:
d. What is the marginal density function of ?
We have computed it in the first answer:
7. Choosing random house points
Choose a number at random from the set of house points awarded by Professor McGonagall. Now choose a number at random from the subset of points no larger than , .
a. Determine the joint probability mass function of (initial points) and (second random selection).
Let's discuss about the random variable . is uniformly distributed over , thus:
Now the random variable .
Given , is uniformly distributed over , thus:
Putting all together:
b. Determine the conditional mass function as a function of and .
Using Bayes’ rule:
From the answer before, we know that , while .
We need to compute the denominator , that is:
So putting it all together:
c. Are and independent? Explain.
No, the value of is constrained by (), so knowledge of affects the possible values of . More formally, if and are independent: