The bean that we roast, grind, steep and drink is actually the seed from a coffee cherry, a stone fruit that grows on a spindly shrub, native to Ethiopia. Coffee plants take three to five years to bear fruit, but will produce for 25-40 years upon maturation. This makes coffee production inelastic to short-run price changes: Growers cannot quickly produce more product to adapt to spikes in demand, and neither can they adjust to overproduction – and price drops – or drops in consumption, such as recessions in principal consuming countries.
“Consumption of coffee is relatively stable, expanding or contracting only gradually in response to sharp changes in supply and price brought about by short-run factors such as variations in crops due to changes in weather.”
Despite this relative production stability, the coffee market itself is volatile and difficult to predict. Coffee prices, especially for the consumer, can be heavily impacted by distributor decisions.
Nearly all of the world's coffee beans come from one of two species: Arabica and Robusta. 75–80% of the coffee produced worldwide is the Arabica species, and 20% is Robusta. My model captured 73% of Arabica and 78% of Robusta global exports, by focusing on the primary coffee-producing countries.
The USDA’s Foreign Agricultural Service issues semi-annual reports on coffee production; among the influences in its reports are previous production volumes, droughts, abnormally warm temperatures, frosts, pest incidences, diseases that affect coffee plants and labor shortages. These influences are quantifiable, and – to some degree – predictable.
By considering past production trends, ending stocks (the amount of coffee held in storehouses before exporting) and frost incidences for these primary producing countries, I sought to model future price predictions through an industry-focused lens:
Based on past patterns in coffee production, and the effect of weather conditions on crop yield, can we predict upcoming pricing changes for coffee roasters or suppliers?
Sometimes, coffee price increases are caused by increasing demand or market changes; but more often, the market is impacted by poor harvest caused by low temperature and frost.
Frosts can be devastating to coffee producers, as they have the potential to disrupt harvests for up to 5 years. Volatility levels are generally highest in May through August, when it’s winter in the southern hemisphere.
To capture that in the model, I used temperature data from Berkeley Earth, an independent organization that merges and cross-validates 16 data sets to track global temperature.
I also wanted to include the amount each country produced the previous year, and the amount each country held in inventory. So, I incorporated data from the USDA’s Foreign Agricultural Service. The FAS has specialists stationed all around the world, providing figures that are validated and balanced.
This chart contains data dating back to 1960. Remember that my model only looks as far back as 1990.
So, how did I create my model?
I imported the data and performed standard data cleaning and formatting, like converting certain strings into date-time values. Only two things stood out in the processing phase: First, Berkeley Earth records days using a decimal notation, shown below, which I had to change into a usable format. I also had to convert the annual production data to compare it to the other data, which was monthly. I did this by filling the gaps with the previous recorded value (a technique called padding or forward-filling).
2005.067 = 2005 + (25 − 0.5) / 365 = January 25, 2005
Ultimately, a random forest regressor, optimized with GridSearchCV, seemed to fit the nature of the data best. I used 200 trees and 10-fold cross-validation, which are also ways to minimize the chances of overfitting and minimize errors when I show new data to the model.
So... what about my latte?
I can't answer that directly. While the model suggests raw coffee will become more expensive over the next few months, how much companies charge consumers depends on their business internals.
For example, while researching for this project, J.M. Smuckers announced it would increase its ground coffee prices by an average of 6%. Smuckers owns brands like Folgers and Cafe Bustelo and is licensed to sell Dunkin Donuts brand ground coffee.
However, since the model is directionally accurate, I wanted to see what the next few months might look like.