15 Comparing Times Into Stage
How do our drivers compare based on the time it takes them to driver a particular distance into the stage?
Recall that we are using each car’s own accumulated distance in to stage measure, rather than comparing times at distances into stage measured along some common, idealised route.
Sample common points to find the difference:
=100
segment_length
# stage_length set in earlier section
= seq(from=0, to=stage_length, by = segment_length)
segments
= approxfun(trj_ogier$cum_dist,
ogier_full_estimator $displacementTime) trj_ogier
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values
= approxfun(trj_evans$cum_dist,
evans_full_estimator $displacementTime) trj_evans
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values
= ogier_full_estimator(segments)
ogier_time_points = evans_full_estimator(segments)
evans_time_points
= ogier_time_points - evans_time_points
ogier_evans_point_delta
# Difference in time take to reach a particular point in the stage
ggplot()+geom_line(aes(x=segments, y=ogier_evans_point_delta))
Compare time into stage for a given distance into stage. Note that this is the distance into the stage as calculated from the trajectory, rather than by comparison of distances into the same (idealised) route.
ggplot() +
geom_line(data=(trj_ogier %>% mutate(dt=as.double(displacementTime)) %>% filter(dt >=0)),
aes(x=cum_dist,y=dt), color='blue') +
geom_line(data=(trj_evans %>% mutate(dt=as.double(displacementTime)) %>% filter(dt >=0)),
aes(x=cum_dist,y=dt), color='grey')