2024-03-21

Hypothesis Testing

  • Hypothesis testing allows for statistical verification of claims made about a set of data, often comparing two different population or sample parameters

  • Needed when we’re limited to a random sample that is much smaller than the overall population

  • Step 1: Set a null and alternate hypothesis

    • Null typically assumes equality between parameters being measured
  • Step 2: Choose the appropriate test statistic and carry out the test

  • Step 3: Obtain a p-value, and choose the null or alternate hypothesis based on the p-value

Data Analysis for Transit

  • The Orbit Saturn is a bus in Tempe that historically runs late very often
  • On Oct 23, the city makes schedule changes that are intended to improve its reliability
  • Buses have GPS equipment that records data at each “timepoint” along each bus route
  • We can use this GPS data to evaluate the effectiveness of the changes

Context:

  • We compare similar 3 week samples directly before and after changes
  • When a bus crosses a time point, it records the deviation from schedule

On-Time Performance by Month

Running Times for First Leg of Trip

R Output for Last Slide

histogramdata = data.frame("Running_Time" = c(5,6,7,8,9,10,11,12,13,14,15,16, 
  17,18,19,20,21,22,23,24,25,26,27,30), "Frequency" =
  c(6,24,120,224,211,54,28,6,4,6,1,1,6,3,4,3,6,10,12,4,5,2,1,1))   
plot_ly(x = histogramdata$Running_Time, y = histogramdata$Frequency, 
        type = "bar") %>% layout(yaxis = list(title = "Frequency"), 
        xaxis = list(title ="Running Time"), title = "Leg 1 Running Times")

Relationship Between Ridership and On-Time Performance

Average Deviation

  • We take 3 week samples from before and after change (before = sample 1, after = sample 2)

$ p_1 = 0.785, n_1 = 3970 $
$ p_2 = 0.868, n_2 = 3670 $
$ z = = -9.538 $

-The z-value of -9.538 is significant, with a p-value of approx 0. So we can confidently say buses are running on time more often.

Test of Standard Deviation

$ S_1 = 4.270, n_1 = 3970 $
$ S_2 = 4.351, n_2 = 3670 $
$ F = = 0.963, p = 0.25 $

-The p-value for our F test is not significant, so we cannot say that the spread of running times changed significantly. Thus, On-Time Performance increased, but factors like traffic, that cause delays still persist