The p-value is less than or equal to the significance level (0.01), you would reject the null hypothesis that there is no significant difference in pulse rate when taking a quiz versus attending a regular class.
To perform a randomization test for the mean pulse rate difference between taking a quiz and attending a regular class, you can follow these steps:
Calculate the observed mean difference:
Observed Mean Difference=

Create a null distribution:
Combine the pulse rate differences into one dataset.
Shuffle the dataset to create a null distribution.
Repeat this process a large number of times (e.g., 6000 simulations).
Calculate the mean difference for each simulated dataset.
Calculate the p-value:
p-value =

import numpy as np
# Given data
pulse_rate_differences = np.array([2, -1, 5, -8, 1, 20, 15, -4, 9, -12])
observed_mean_difference = np.mean(pulse_rate_differences)
# Number of simulations
num_simulations = 6000
# Simulate the null distribution
null_distribution = []
for _ in range(num_simulations):
shuffled_data = np.random.permutation(pulse_rate_differences)
null_distribution.append(np.mean(shuffled_data))
# Calculate the p-value
p_value = np.mean(null_distribution >= observed_mean_difference)
print("Observed Mean Difference:", observed_mean_difference)
print("p-value:", p_value.
This code calculates the p-value for the randomization test.
If the p-value is less than or equal to the significance level (0.01), you would reject the null hypothesis that there is no significant difference in pulse rate when taking a quiz versus attending a regular class.