Q#81: Delivery times

Pizza Time

Suppose you are working for a food delivery company looking to compare delivery times across its two delivery systems (one with autonomous vehicles called System A, one with contract drivers called System B).

The data table below, called ‘delivery_cycle_times’, shows the full cycle time of delivering food for a given order in minutes. Given this, run a statistical test using python to determine whether there is a significant difference in food delivery between the two systems:

TRY IT YOURSELF

ANSWER

As a Data Scientist folks will come to you to get insights on the business process and more often than not it will be a generic request and you will have to decide what is the best way to prove or disprove a point.

To determine if there is a significant difference in food delivery times between System A and System B, we can employ a common statistical test called the independent two-sample t-test. This test allows us to compare the means of two independent samples and determine if the difference between them is statistically significant.

Let’s use Python to conduct the statistical test. We can utilize the scientific computing library, NumPy, for the calculations and the statistical library, SciPy, to perform the t-test. Here’s the Python code:

import numpy as np
from scipy import stats

# Defining the delivery times for System A and System B
system_a = np.array([23, 20, 26, 30, 15, 26])
system_b = np.array([25, 28, 35, 32, 19, 30])

# Performing the two-sample t-test
t_statistic, p_value = stats.ttest_ind(system_a, system_b)

# Outputting the results
print("T-Statistic:", t_statistic)
print("P-Value:", p_value)

Interpreting the Results:

After executing the code, we obtain the t-statistic and p-value, which are crucial in interpreting the results of the statistical test. The t-statistic represents the calculated value used to determine the difference between the means of the two samples. On the other hand, the p-value provides us with the probability of observing such a difference due to random chance alone.

In our case, if the p-value is less than a pre-determined significance level (commonly 0.05), we can conclude that there is a statistically significant difference in food delivery times between System A and System B.

--

--