Taking a look at the futures curve

The futures curve can often paint a confusing picture of market expectations and supply and demand in the spot market. For those not actively involved with the flow of information in the spot market, the picture can seem even further confusing. Take a look at the current cotton futures curve, for instance.

chart-15

Cotton futures curve

The first obvious point to note is that the curve is in backwardation. From our finance 101 classes, we know that there can be several possible reasons for such a term structure:

  • Imbalances or disruptions in the spot market supply/demand vs future supply/demand
  • Market expectations for a decline in prices in the future
  • Impact from storage costs and cost of carry

We also know that for a market in backwardation, an easy arbitrage is possible if you can borrow the asset today, sell it, and buy futures in order to lock in the gain. So what does it tell us if this pattern persists? Clearly, nobody is able to borrow this asset, otherwise this pattern would reverse. What causes this situation is the notion of convenience yield. Holders of the commodity are unwilling to lend the commodity for short sellers, or unwilling to offload their own positions, in order to lock in a profit. This is because the benefits, or perceived benefits, to the inventory holders is worth more to them than the potential profit to be had. In such a situation, we can expect the futures curve to remain in backwardation until the spot market supply and demand normalizes.

As a final mention, if the market is in backwardation, we would expect for inventories to decline as those who are willing to lend or sell today do so. Indeed, on February 1st, the International Cotton Advisory Committee did confirm that cotton inventories have fallen 5% year on year.

Don’t expect any big moves until we get a clearer picture of the 2017/2018 crop estimates!

Advertisements

Forecasting global acerage (part 2)

The Context

In my last post on this topic, we created a function on excel to help us project global acerage of cotton planting.

In this post, I take the next steps for actually forecasting what acerage could be in the coming years using a simple Matlab code. The goal here is to specify our variables (that I largely covered in the last post), and to project this function into the future, say, 10 years. I then have Matlab run the simulation a thousand times to allow us to calculate the average projection for each year into the future. Now, in our case, keep in mind that with a mean reverting function should produce projections around the mean, so why proceed anyways? Two reasons: Firstly, current plantings are well below long term averages, so this analysis could help us project how quickly it will revert to the mean, and the probability distribution of plantings above or below certain levels. Secondly, we just covered this topic in my stochastic calculus class and I wanted to try it out.

Are the data normal?

The first thing I did was verify that the variable we are considering can indeed be described as normally distributed, as the function we created depends on this assumption. A few ways to do this are with a Jarque-Berra test, a qq plot, or visually with a histogram. As we can see from the below graphs, as well as the results of the JB test not shown, the distribution of cotton plantings is indeed more or less what we would expect if the variable was normally distributed. Knowing this, we can proceed with our analysis. Often times, and especially with financial assets, the period-on-period change is used rather than the actual level, but since in our case both distributions look “relatively” normally distributed, its safe for us to proceed directly projecting absolute levels.

chart-9chart-14

The Monte Carlo Simulation

With this small piece of the puzzle done, we can now look at how this acerage will affect price movements over the next year. But first, let’s take a look at the results:

The first graph here looks a bit crazy, but it is a good visual representation of what I’ve done – 1000 simulations of different trajectories 10 years into the future, starting out with this year’s estimated acerage in 2017/18E.

chart-7

Graphic of all 1000 simulations

The Results

Here is perhaps a more useful one, a line chart of the average projections for each year into the future. If we recall back to part 1 of this series, the function we used is a mean reverting one. Therefore, it makes sense that a Monte Carlo projection centers around the long term mean. What is perhaps more interesting for us is the distribution of results we get.

chart-8

Monte Carlo projection

Below is a histogram of both our projections for next year, as well as the projection for 2026/2027. Again, a mean reverting function will have a fairly concentrated distribution, but it is interesting to note the lower ranges for next year compared to the future, as global cotton plantings this year are well below the normal long term average.

Chart 6.jpg

Distributions for projections of 2018/19 & 2026/27

Finally, with this data in hand, we can actually get to more useful and practical applications, such as constructing probability intervals for the coming year. Our average projection for 2018/19 is 31,893,000 hectares to be planted, with a confidence interval of (31,440 ; 32,346) at a 95% level of confidence. Note that this does not mean I claim with 95% certainty that the actual number of hectares planted will be within this range. The technical interpretation is that we can be 95% certain that the true average projection is in this interval – it corrects for sampling error, not modelling error! (The error that the model does not perfectly reflect the variable in question, which, of course, no model does).

Conclusion

Overall, this was definitely overkill for such a small piece of my overall database. More than anything it was a good opportunity to become familiar with the USDA data, and try out some stuff I’ve been learning in class. But it’s a good exercise to get things started, and may also help me when it comes to projecting global production, and then prices. This will be the next piece in building my global database, so until next time!

 

The Code: For those who are interested…

% % Example Monte Carlo Simulation for cotton plantings worldwide
%
% Created in December 2016 by Alex Molson
% Simple Monte Carlo simulation to project 1000s of hectares of cotton planted
%Checking for normality
qqplot(Hectares)

h=jbtest(Hectares)
h1=jbtest(Change)

z=diff(Hectares)
qqplot(z)

figure
subplot(2,1,2)
histfit(z)
title(‘Change in hectares’)
hold on
subplot(2,1,1)
histfit(Hectares)
title(‘Total hectares’)
hold off

%Section 1: Specifying variables
S0=30488; %Current year’s cotton plantings
Stdev=1633; %Assumed volatility in yearly plantings
k=0.65; %Assumed speed of adjustment coefficient
Avg=32602; %Assumed long term average for cotton plantings
n=11; %How many years I would like included in the analysis (including current year)
n1=1000; %How many trials of simulation I would like to run

Stch=normrnd(0,Stdev,[n,n1]); % Creates the stochastic gyrations

Est=zeros(n,n1); %Creates a matrix of zeros that we will populate with our estimates
Est(1,1:n1)=S0; %Forces first value for all trials to be current year’s

%This small section actually integrates the function for each row value in
%each trial after S0
for i=2:n
for j=1:n1
Est(i,j)=Est(i-1,j)+(k*(Avg-Est(i-1,j)))+Stch(i,j);
end
end

%Creates a small plot of all our trials
plot(Est);
set(gca, ‘YTickLabel’, num2str(get(gca,’YTick’)’,’%d’))
set(gca,’XLim’,[1 n])
set(gca,’XTick’,[1:1:n])
set(gca,’XTickLabel’,[‘2016/17E’;’2017/18E’;’2018/19E’;’2019/20E’;’2020/21E’;’2021/22E’;’2022/23E’;’2023/24E’;’2024/25E’;’2025/26E’;’2026/27E’])
set(gca, ‘XTickLabelRotation’,[45])

%Creates a vector matrix containing the average simulation values for each
%year in the future, then creates a small plot of it
M=mean(Est,2);
plot(M);
set(gca, ‘YTickLabel’, num2str(get(gca,’YTick’)’,’%d’))
set(gca,’XLim’,[1 n])
set(gca,’XTick’,[1:1:n])
set(gca,’XTickLabel’,[‘2016/17E’;’2017/18E’;’2018/19E’;’2019/20E’;’2020/21E’;’2021/22E’;’2022/23E’;’2023/24E’;’2024/25E’;’2025/26E’;’2026/27E’])
set(gca, ‘XTickLabelRotation’,[45])

disp(M); %Displays the matrix with our estimates

P1=Est(2,1:n1);
P10=Est(10,1:n1);
h1=histogram(P1)
hold on
h2=histogram(P10)
title(‘2018/19E vs 2026/27E’)
%%Confidence Interval
Stdev1=std(P1);
ConfInt=[M(2,1)-(1.96*Stdev/(50^0.5)), M(2,1)+(1.96*Stdev/(50^0.5))]
ConfInt2=[M(2,1)-(1.645*Stdev/(50^0.5)), M(2,1)+(1.645*Stdev/(50^0.5))]

Forecasting global acerage (part 1)

The Context

As with any commodity, I’m starting my analysis by building up my various databases. In this case, I’m mostly using USDA annual reports, which compile detailed data by country on acerage, yields, stocks, production, trade, and consumption. It’s a lot of copy pasting, similar to what I used to do when I worked as an equity analyst. One can only imagine how many times the same work is done around the world in our field…

In any case, in the process of building up the database I also naturally took to a bit of forecasting. The idea will be to eventually build up an idea of total supply and demand. The first step I’ll be taking in this forecasting will be the projection of global acerage devoted to cotton planting. In part 1 here, we will be creating a function to help us project future acerage, which we will then use in a Monte Carlo simulation later on, perhaps in part 2.

Creating our Function

Of course, acerage (hectarage, technically) devoted to cotton will undoubtedly reflect a combination of observed cotton prices, planters’ expectations, and the relative competitiveness of other crops. Clearly it would be very difficult to  effectively include all these variables to come up with a precise forecast. In fact, if we are hoping to make a forecast of cotton prices, and plan on using acerage as one of our inputs, then we can’t also use prices in projecting acerage – it would be a recursive calculation. It would also be a bit of overkill for what is, in the broader scheme of things, a small part of my analysis.

Instead, to get things started I’ll be forecasting global acerage using a mean reverting geometric brownian motion function, or, at least a kind of GBM, of the form:

equation-1

Here, we project next year’s acerage based on last year’s figure (Xt), the speed of adjustment coefficient (k chapeau, as it is called in french; this determines how quickly the function will revert to its mean), the long term average of global acerage (mu chapeau), and a stochastic error term (which itself is distributed according to the volatility of yearly acerage). Last year’s prices are observable, but we’ll need to estimate k chapeau, mu chapeau, and the standard deviation of our stochastic error term.

We could do this using a simple regression (of Xt+1 on Xt) on excel or Matlab, but for this particular data series I’ve decided to just wing it: in our case, the volatility of annual planting is growing as farmers become more methodical about crop planting, so the regression results are a bit misleading. We should be able to produce a reliable function in any case.

For our model, I simply use the average acerage of our data set as the long term average (I use USDA FAS data here going back to 1966), and have estimated k chapeau at 0.65 (for eyeballing this coefficient, we can calculate the half-life of our mean reversion, which for 0.65 is about HL=ln(2)/0.65 = 1.06, so we would expect the difference between annual acerage and the long term average to reduce by about half within a period of just over one year). Standard deviation is just calculated as the annual volatility for our data sample, from 1966.

So my final function on excel was:

equation-3

As for what this means in projecting global acerage, we now have the building blocks for Monte Carlo or other statistical analyses. Below we can see a sample of projections from the function: a Monte Carlo analysis would involve repeating the experiment ten or a hundred thousand times and extracting probabilities from these results.

chart-5

A sample of projections from our function for cotton hectares planted globally.

So there we have it, a function to help us project annual cotton acerage, which will, in turn, be useful in calculating global production and supply. Of course, these remain just rough estimates; Putting too much emphasis on models is dangerous, but for my purposes in getting a grip on the dynamics of the cotton market, we’re off to a good start!