GM's blackest algorithmic code

Inspired by the poetic stylings of W.B. Cypher to make a buck before mere anarchy is loosed upon the world, I was looking at some of the daily London Fix data. I noted that the minimum gold price in a given month has been a linear function of its monthly maximum and median price, with min = a + b*sqrt(max)*median^2 fitting damn well.

You see where I'm going here? As soon as a month is half-finished, we know what the lowest possible median can be ($1628.60 this month), and we know what the lowest possible maximum can be ($1674.25 this month), so we should be able to predict a floor to the monthly price with great accuracy and precision.






Actually a multiple regression works a little better, though it's not strightforward to depict it graphically.  But I don't have to. Anytime a month's end approaches, just plug into the following equation and chug (your drink of choice):

MINIMUM = e^[0.021 + 1.325*ln(MEDIAN) - 0.332*ln(MAXIMUM)]

You want a confidence interval? And keep in mind that unlike in previous regression posts, here we're not dealing with a time series, strictly speaking, since all axes are prices -- so confidence intervals are more legitimate. (In other words, though price direction is correlated from month to month, the relative distance between monthly maximum, minimum, and median is not.)

After removing a few outliers (and why not - if e.g. a Lehman collapses again, no model based on past performance means anything anyway), the lower bound of the 99% confidence interval for this month's minimum price is $1560. So gold should not make a new low this month. You heard it here first.

16 comments:

Louis Cypher said...

That's pretty cool ... my concern is that we will see more of the same next month. My drink of choice is Absinthe because I like a little wormwood with my booze.

Slow Loris Larry said...

GM:

I'm no statistician, by any means, but it occurs to me that you should be able do the same for 'moving months'.

In other words, presume that an month is thirty days (or twenty-eight), so you do the calculation on the midpoint, today's date, and calculate what the max and min would be for 15 days (or two weeks) hence.

Wouldn't it be nice if that turned out to have some statistically valid predictive value (presumably with outliers discounted).

Warren James said...

That is hot. Is the sample size the same range as your charts previous (e.g. from 2009 or 2001?).

Lots to chew on ... :) If ever I figured there was some kind of throttle/brake mechanic present on the emergent monetary mess then this would have to be evidence of. I second Larry's suggestion (but I'm not smart enough to do the math).

Anonymous said...


GM,

WTF ... btw can you mark the most recent couple of months red in your chart? I wonder whether the months since mid 2012 contribute to the outliers (well, are a little bit off perhaps).

Victor

Biosci said...

The log transform hides a lot of sins; half a natural log is a 65% price change. More than you'd expect in a month (we hope). Plotting this as a function of % change within a month or between months might make it seem a bit less deterministic.

GM Jenkins said...

Louis- I agree, after my black algorithmic code spit out a $1560 low for feb, I had to go long but I'm out on the 28th.

Warren - I wonder how general the phenomenon is. It makes sense that median and max will correlate with min in general, but the tightness and 12 year pattern surprised me.

SLL - that's a fantastic idea - I gotta check that out when I have time again. If history shows that the X-day median and X-day maximum have been good estimators of the X-day minimum, then you can just plug in the lower bounds for the X-day median and X-day maximum on day X-n to get a good estimate of the worst case scenario over the next n days. In fact you can exhaustively go through X's and n's. LOL. Who knows what you'd find?

Vtc: the main outliers were a few months in the fall of 2008 and Aug and Sept 2011 - they stand out pretty clearly on the chart.

Biosci- i see your point, but i did transofrm back to dollars, and i got a lower limit of $1560 for Feb. So I don't think that nullifies the approach. . . Gimmicky, perhaps :P

Biosci said...

GM,

I'm not doubting the validity of the approach, only the interpretation. What you seem to be discovering is a linear relationship between (% change, max to median) and (% change, median to minimum). According to your logistic regression, with a median $1500 price, varying the max from +0 to +8% gives minima of -3% to -5.5% from the median. We know that MoM price change in the last 10 years has typically ranged from -5% to +10%; all I'm saying is that it's not immediately obvious to me that your method yields finer predictions than the gross methods.

Perhaps more to the point, the predicted minima are usually going to be far enough away from the medians that a trade, e.g. a selling a GLD credit spread, wouldn't make you any money.

77 said...

gold books a loss of 5.1% for the month of February and setting a fifth consecutive monthly drop. This marks gold's longest run of monthly declines in 16 years.
...this is probably healthy for gold as it went up 12 straight years.

silver 'shortages and backwardation' still abound across the gold bug sites, as silver stocks at comex rise to most since 1995 at over 162mil...

still everyday at the gold bug sites it's only bullish articles, why not it worked for 12 straight years...this time the bottom might not come in until the bullish articles cease...

cheers!

Tony said...

A little side note...GLD just lost another 12 tonnes.

Anonymous said...

Apparently there is another approach to dealing with massive public debt... I would like to see FOFOA's analysis of this... ;-)

Tony said...

+1 Jd'A....hahaha

Anonymous said...

If you stare long enough at the charts you will eventually see Christ or at least the next Pope.

Anonymous said...

duggo,

if your pope thing works out, I suggest you cash in:

http://www.oddschecker.com/politics-and-election/next-pope/winner

Victor

Anonymous said...


... and don't forget to scroll down.

Biosci said...

Richard Dawkins at 666:1? Priceless!

Anonymous said...

Going according to form the next Pope will be someone who has worked or is still working for Goldman Sachs.