Spring 2025 Quiz 5

← return to practice.dsc10.com


This quiz was administered in-person. It was closed-book; students were not allowed to use the DSC 10 Reference Sheet. Students had 20 minutes to work on the quiz.

This quiz covered Lectures 21-24 of the Spring 2025 offering of DSC 10.


Problem 1

In music theory, polyphony is a number that counts how many independent melodies are being played at the same time. Polyphony is an integer at any given moment, but the average polyphony for a song can be a non-integer.

Minchan collects some data on pieces composed by Johann Sebastian Bach and Wolfgang Amadeus Mozart. Minchan’s data is in the DataFrame music, whose first few rows are shown at right. For each piece, we have the composer and the average polyphony.


Minchan wants to conduct a permutation test with the following hypotheses:

For this permutation test, we will use the absolute difference of medians as our test statistic.


Problem 1.1

Fill in the blanks below to complete the permtuation test described above. Assume observed is the observed test statistic, and has already been calculated correctly.

total = 0
for i in np.arange(5000):
    shuffled_composer = np.random.permutation(__(a)__)
    shuffled_df = music.assign(shuff=shuffled_composer)
    poly = shuffled_df.groupby(__(b)__).__(c)__.get("polyphony")
    stat = __(d)__
    if stat __(e)__ observed:
        __(f)__
p_value = total / 5000

(a): music.get("composer")
(b): "shuff"
(c): median()
(d): abs(poly.loc["Bach"] - poly.loc["Mozart"]) can be in either order, can also use iloc[0], iloc[1] instead
(e): >=
(f): total = total + 1


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 58%.


Problem 1.2

The following distributions come from the "polyphony" column of music:

Bach’s Average Polyphony
Mozart’s Average Polyphony


Based on these distributions, estimate the observed value of the test statistic in the permutation test above. Choose the closest answer below.

Answer: 1


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 51%.


Problem 1.3

If Minchan repeats the permutation test, this time using the absolute difference of means as the test statistic, how will the observed value of the test statistic change?

Answer: Option 1


Difficulty: ⭐️⭐️⭐️⭐️

The average score on this problem was 48%.



Problem 2

A Musical Instrument Digital Interface (MIDI) file is a digital file format that stores musical performance data. Jack has created a small MIDI file with 10 notes. For each note i he has recorded two variables, x_i and y_i.

Jack’s data is below, along with some summary statistics.

i 12345678910
xi 1010101010
yi 78868686788678787886


\text{Mean}(x) = 0.5 \quad \text{SD}(x) = 0.5 \quad \text{Mean}(y) = 82 \quad \text{SD}(y) = 4


Problem 2.1

Calculate r, the correlation coefficient between x and y.

Answer: Option 1


Difficulty: ⭐️⭐️⭐️⭐️

The average score on this problem was 32%.


Problem 2.2

Calculate the slope of the regression line for the original dataset, using the value of r you chose in part (a).

Answer: -4.8


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 60%.



👋 Feedback: Find an error? Still confused? Have a suggestion? Let us know here.