Ever wondered when is the best time to purchase a flight ticket? If you are:

Have a look at a simple anaylsis by using almost 3.5 million flight data from Berlin for the year 2015:

flights1way_500 <- flights1way %>%
  filter(priceusd_seat <= 500)

ggplot(data=flights1way_500,aes(x=daystodeparture,y=priceusd_seat)) +
  geom_point(alpha=.1, color="#880011") + 
  stat_smooth(method="gam", formula = y~s(x)) +
  scale_x_continuous(limits = c(0,100)) +
  ylab("Average Price (USD)") + xlab("Days to Departure") +
  ggtitle("EU Destinations Price (from Berlin) vs. Days to Departure") 

There seems to be a dramatic increase in flight price around the 13th day before departure. 13 days, that’s is your takeaway, and it doesn’t mean buying much far in advance is always cheaper.