Dust flux, Vostok ice core

Dust flux, Vostok ice core
Two dimensional phase space reconstruction of dust flux from the Vostok core over the period 186-4 ka using the time derivative method. Dust flux on the x-axis, rate of change is on the y-axis. From Gipp (2001).
Showing posts with label Detour gold. Show all posts
Showing posts with label Detour gold. Show all posts

Thursday, March 6, 2014

The PDAC experience, part three

My son was playing around with the various pens I brought back from various companies. I use PDAC to stock up.

Clearly I need to start doing more due diligence.

My son got all of the pens to work except one: Detour Gold. So, naturally we took it apart to have a look.
Nice looking pen!


So far, so good.


Aha! No pen tip, no ink reservoir--just an empty shell.

You may insert your own punch line here.

I currently have no position in Detour, although I admit I did very well on it in the past.

Friday, October 4, 2013

One more time--the distinction between human- and algo-trading

The markets do not act like they once did. The trading in certain stocks is operating on time-scales so small that they cannot be in response to human thought. Not only are certain individuals able to access key information before others and so respond to news releases faster than the speed of light, but certain entities have free range to post and cancel orders on a microsecond basis, and queue-jump by shaving off (or adding on) tiny fractions of a penny from their orders.

Stocks traded by humans tend to make significant moves on a timescale of minutes to days. Even when there is a news event that radically changes the apparent value of a company, if there are only humans in the market, the move takes time to occur. Below we a couple of charts for Detour Gold (I currently have no position in this stock)


Normally, when looked at on a ms timescale, the graph is not really distinguishable from a straight line.


The little squares occur because all the price-changes I saw in the course of the day were a penny. On this scale it scarcely matters which axis is the current price and which is the lagged-price.

Once the algos get involved, the millisecond phase space plots get a lot more interesting. Some of them are works of art! Below, some plots for Century Casinos (I have no position in this one, either). Data here.



Algos playing tug-o-war.

Nice to look at, but maybe not so nice to trade against.

Remember the adage about playing poker: If you don't know who the sucker is . . .

Wednesday, June 13, 2012

Origins of multistability in economic systems: commentary on Soros (2012)

All over the world, the same message is relentlessly hammered home--conventional economics has failed. Policy makers did not foresee the 2008 crisis--and their attempts at remediation of the unemployment situation have had effects opposite to what was intended.

Why is this? Does economics in the real world differ so much from the theoretical? And if so, why?

Let us consider how complex behaviour arises in some natural systems.

Multistability in natural systems

The global climate system is a nonlinear, nonequilibrium system involving internal time-varying mechanisms, feedbacks, and external forcing. Systems with feedbacks are commonly multistable, prone to bifurcations, and hysteresis—even when those systems are driven by invariant driving functions.

In previous posts we have seen that the phase space projections of numerous climate functions show multistability--that is they tend to evolve not to a single equilibrium, but oscillate among any number of equilibria. The reason that multiple equilibria arise is because the dynamics of the climate system include both negative and positive feedbacks.


Different forms of stability. For asymptotic stability, given a limited range of  initial 
conditions, the system evolves towards a fixed point. For Lyapunov stability, once the system
reaches a limited region of phase space (b), the system tends to remain there. 


Where negative feedbacks dominate, the system tends to be stable. In the diagram above, there are different forms of stability, but the two most important are asymptotic stability (also called a point attractor) and Lyapunov stability. It will normally not be possible to distinguish between these on the basis of observation of some system.

Positive feedbacks tend to enhance the effects of external forcing, multiplying the magnitude of the stresses brought on by forcing. The presence of both negative and positive feedbacks supports a system with multiple disjoint regions of equilibria, bounded by separatrices. 


Time evolution of a system with multiple equilibria. In actuality, the separatrices 
are likely to show fractal interfingering.

I have commented on applications of this idea to unemployment, but have not discussed the origins of the necessary feedbacks required to generate multistability. Some comments by George Soros (below) seem to shed some light on this topic.

Soros' remarks on global economy

George Soros recently spoke at the Festival of Economics in Trento, Italy. What made his remarks interesting to me were his allusions to nonlinear dynamics in the evolution of the economic system, and their effects on policy. Soros begins by remarking on the lack of success policy makers have had in predicting economic outcomes in the past few years. The reasons for these failures . . .
go back to the foundations of economic theory. Economics tried to model itself on Newtonian physics. It sought to establish universally and timelessly valid laws governing reality. But economics is a social science and there is a fundamental difference between the natural and social sciences. Social phenomena have thinking participants who base their decisions on imperfect knowledge.
Anyone reading about Austrian Economics will be familiar with the argument. Market participants will try to act in a way that maximizes benefits to themselves, but what constitutes maximum benefit may vary from one to another. A highly technical treatment of this topic can be found here (probably not of interest to most of you, except for the part about aggressive participants with a strategy of investing in risky assets increasing the likelihood of a market crash for everyone).

The market participants do not perceive the true nature of the system in which they are operating, and so many will choose suboptimal strategies. However, as they act, they also change the nature of the system, so that what would have been an optimal strategy had all participants been "rational" may become suboptimal in the real world. Likewise, strategies which would be suboptimal in a purely rational world may become optimal.
I found a two-way connection between the participants’ thinking and the situations in which they participate. On the one hand people seek to understand the situation; that is the cognitive function. On the other, they seek to make an impact on the situation; I call that the causative or manipulative function. The two functions connect the thinking agents and the situations in which they participate in opposite directions. In the cognitive function the situation is supposed to determine the participants’ views; in the causative function the participants’ views are supposed to determine the outcome. When both functions are at work at the same time they interfere with each other. The two functions form a circular relationship or feedback loop. 
For instance, under normal circumstances it would not be advantageous to rush to the bank and withdraw all of your money. However, the economic system could be altered to the point where that might turn out to be the optimal strategy after all. 

Soros goes on to describe the inflation and bursting of a bubble in terms of the interaction between positive and negative feedbacks.
I developed a model of a boom-bust process or bubble which is endogenous to financial markets, not the result of external shocks. According to my theory, financial bubbles are not a purely psychological phenomenon. They have two components: a trend that prevails in reality and a misinterpretation of that trend. A bubble can develop when the feedback is initially positive in the sense that both the trend and its biased interpretation are mutually reinforced. Eventually the gap between the trend and its biased interpretation grows so wide that it becomes unsustainable. After a twilight period both the bias and the trend are reversed and reinforce each other in the opposite direction. Bubbles are usually asymmetric in shape: booms develop slowly but the bust tends to be sudden and devastating . . .
At any moment of time there are myriads of feedback loops at work, some of which are positive, others negative. They interact with each other, producing the irregular price patterns that prevail most of the time; but on the rare occasions that bubbles develop to their full potential they tend to overshadow all other influences.
What does the phase space of a system with myriads of feedback loops look like?




The recognition of multiple equilibria in economic systems does not go far enough, in Soros's view, because the collapse of bubbles can trigger policy responses which greatly alter the workings of the system. In other words, politics can become a potent driving force, with both secular components (such as the progressive concentration of wealth and power into fewer hands over the last forty years) and singular spectacular events (such as declaration of wage and price controls, short-duration spikes in interest rates; or even irreversible decisions like detaching the dollar from gold).

The addition of the political drivers adds a dimension which has no analog in nature. It also forces us to recognize that the future evolution of the economy will be not only a function of the feedbacks and forces we consider above, but also the entire history of the economy as well. For instance, Soros argues that the present European crisis is as much a function of history as of excessive government debt . . . 
because the financial problems were reinforced by a process of political disintegration. While the European Union was being created, the leadership was in the forefront of further integration; but after the outbreak of the financial crisis the authorities became wedded to preserving the status quo. This has forced all those who consider the status quo unsustainable or intolerable into an anti-European posture. That is the political dynamic that makes the disintegration of the European Union just as self-reinforcing as its creation has been. 
Unfortunately the non-linearities in the system make prediction hazardous. But given the preliminary indicators of bank runs in Europe, South America, and Africa, as well as Oanda's recent announcement . . . errm, yes, excuse me, but I have some preparations to see to.

Friday, January 27, 2012

Phase space portrait for Detour Gold . . .

The last time we looked we saw that the reconstructed two-dimensional phase space was characterized by a long period of relative stability in the $30 area, from at least January until early September. It moved rapidly to the $37 area, seemed to complete a cycle, then the price fell in late September, along with practically everything else in the sector.


Since the end of September, the phase space portrait for price has generally remained in what we identified as LSA 30--an area of Lyapunov stability centred at the $30 region, with one excursion above (in November) and below (in December).

Our best hope in the intermediate term is for continued strength in the sector and the price to move back to what we proposed to be LSA 37. But there is a lot of inertia in LSA 30.

Disclosure: Long DGC-T.

Saturday, October 22, 2011

Inference of dynamics for complex systems part 2

Phase space portraits

As we left our last installment we had the problem of a series of observations from some interesting system, and we were seeking a means of understanding it. First of all, however, we had some doubts as to whether the measurements we have made will tell us anything about the system, or whether there will be other information needed in order to make any useful inferences.


Approaches to studying dynamic systems include both qualitative studies of the general trends of a system and quantitative studies in which invariant properties of the system are evaluated [Abarbanel, 1996]. System dynamics are evaluated by reconstructing the system’s phase space, which is a geometrical representation of the system projected in a “space” created of different variables [Packard et al., 1980; Abarbanel, 1996]. The climate system can be described by a phase space with coordinates x1, x2, x3, . . . xn, and the functions x1(t), x2(t), x3(t), . . ., xn(t) (the outputs of the system). As time (t) varies, the sequential plot of points of coordinate {x1(t), x2(t), x3(t), . . ., xn(t)} describes the time evolution of the system in phase space.

The number of output functions (n) is called the embedding dimension [Sauer et al., 1991]. The evolution of the system is marked by the trajectory traced out by sequential plots of individual states with coordinates defined by the values of the n functions at each observed time. Describing the trajectory of the system as it flows through phase space is a qualitative means of characterizing the dynamics of the system. The system may also be characterized quantitatively in terms of its invariant properties, such as the Lyapunov exponents and the correlation dimension of the system, which can be calculated from the phase space portrait [Abarbanel, 1996].

Phase space from multiple time series

How do we select the coordinates? One method is to create a phase space by plotting scatterplots of several different records which have been sampled at the same time intervals. For instance, Saltzman and Verbitsky [1994] created a phase space using, as variables, ice mass, ocean temperature, and atmospheric CO2. The state of the system is defined by its location in phase space at a particular time. The plot of successive states through time traces out the trajectory of the system. Traditionally the trajectory is constructed by drawing a curved line, rather than straight line segments through the states in sequence.


The drawback with the Saltzman and Verbitsky approach in paleoclimate is that is difficult to find many records that have been sampled at the same intervals. You are restricted to the portion of the geologic record covered by the shortest record. Additionally, there are errors in both magnitude and time.

Let's not worry about interpretation yet. Today is only about basic methodologies.

Economic systems can quite profitably be studied using this approach, mainly because there are so many of them, the errors tend to be small (except see here), and the timing is usually well constrained as well. So we can compare US unemployment rate to interest rates, for instance.


Data from BLS site.

Commonly we might look at observations like the one above, and not draw the trajectory (the curve that runs sequentially through the data). Instead, a traditional approach might have been to draw a line of best fit in the hopes of defining a correlation. In looking at the above figure, we see two clusters of observations. Past experience tells us it is risky to define a line of best fit using the traditional methods in this way, as the result is heavily weighted by the line between the centres of each cluster.

Similarly we can look at the average duration of unemployment vs unemployment rate.


Data from BLS site.

Or unemployment rate (vertical axis) vs monetary measures.


Data from BLS and St. Louis Fed site.

Or house prices vs real interest rates.


Data from Shiller [2005].

Defining a phase space from multiple variables requires multiple records. The state space can only be characterized over the duration of the shortest record. Dating errors will lead to various forms of distortion in the projected phase space. The economic time series tend to lend themselves well to this form of projection, because many of them exist to any arbitrary level of precision. If you choose month-end or year-end prices, there are normally no dating errors.

Phase space from a single time series

It is pretty uncommon to have more than one geological time series of sufficient length with good dating control. So geologists will normally have to work with a single time series. The method below can similarly be used in other types of time series as well.

When you have one time series, you may wonder how much dynamic information it contains. Fortunately, ergodic theory suggests that dynamic information about the entire system is contained in each time series output from the system [Abarbanel, 1996]. Therefore, a phase space portrait reflecting the dynamics of the entire system may be reconstructed from a single time series.

Time-derivative method

Packard et al. [1980] propose a method in which the function is plotted along one axis, and its various time derivatives are plotted on the other axes. If we use the simplest two-dimensional case, the graph would consist of a scatterplot of the function against its first time derivative. (i.e. y vs. dy/dt). An example of such a plot appears on the masthead of the blog.


In the above figure, we see the ice volume proxy plotted on the horizontal axis (ice volume increases towards the right) plotted against its first derivative over an interval of time lasting about 120,000 years. The numbers on the graph represent the time in thousands of years before present (ka BP). The rate of change of ice volume is plotted with +ve on top, so that as global ice volume grows (near A, for example), the system will move towards the right through phase space.

Any equilibria in this type of figure must necessarily occur along the zero rate of change axis.

Note the error bars presented on some of the states. Similar error bars would be found at all other states in the figure as well. The error in estimating the rate of change is a consequence of the error in measurement being similar in size to the difference between successive measurements. The size of the error bars is large compared to the variability of some parts of the trajectory--consequently our confidence in this trajectory is not as great as it otherwise might be.

Time-delay method

We reduce these errors by reconstructing the phase space by the time delay method [Packard et al., 1980], in which the elements of a time series are plotted against n-1 lagged observations from the same series (figure 2B). Identifying the lags and the embedding dimension (n) are key decisions in the reconstruction. To simplify things in the following discussion we shall only use two dimensions. Thus we reconstruct our phase space portrait by a scatterplot of the data against a lagged copy of itself. The optimum lag is defined by the first minimum of the average mutual information function [Fraser and Swinney, 1986]; however for quasiperiodic data we find that this tends to be the first minimum of the autocorrelation function (about ¼ of the period of the dominant waveform).

Thus for ice volume:


Here we are looking at a two-dimensional phase space reconstructed from ice volume proxy data covering about 200,000 years. In this projection, lower glacial ice volume is at the lower left corner of the plot, with greater ice volume towards the upper right corner. We'll interpret these later. Moving on


Case-Shiller index



Official unemployment rate


Detour Gold Corp.


CNTY busted trades (1 s of trading activity each figure)


Gold-silver ratio in phase space

Dynamic systems, like climate, have historically been analyzed using power spectral methods, such as the Fourier transform and wavelet analysis [Hays et al., 1976; Imbrie et al., 1992]. This has been a reflection of the predominantly linear assumptions underlying early analytical methods.

The power spectrum is not an invariant property of a nonlinear time series [Abarbanel, 1996], meaning that significant changes may appear in the power spectrum despite the lack of changes in the dynamics of the system. Therefore, changes in power spectrum are insufficient evidence to infer changes in dynamics.

In our next installment we'll talk a bit about equilibrium and what any of the above plots have to say about it.

References

Abarbanel, H. D. I. (1996), Analysis of Observed Chaotic Data, Springer-Verlag, New York.

Fraser, A. M., and H. L. Swinney (1986), Independent coordinates for strange attractors from mutual information, Phys. Rev. A, 33, 1134-1140.

Hays, J. D., J. Imbrie, and N. J. Shackleton (1976), Variations in the Earth’s orbit: Pacemaker of the ice ages. Science, 194, 1121-1132.

Imbrie, J., et al. (1992), On the structure and origin of major glaciation cycles, 1, Linear responses to Milankovitch forcing, Paleoceanography, 7, 701-738, 1992.

Packard, N. H., J. P. Crutchfield, J. D. Farmer and R. S. Shaw (1980), Geometry from a time series, Phys. Rev. Lett., 45, 712-716.

Saltzman, B., and M. Verbitsky (1994), Late Pleistocene climatic trajectory in the phase space of global ice, ocean state, and CO2: observations and theory, Paleoceanography, 9, 767-779.

Sauer, T., J. A. Yorke and M. Casdagli (1991), Embedology. Journal of Statistical Physics, 65, 579-616.

Shiller, R. J. (2005), Irrational Exuberance, 2nd ed., Princeton University Press.

Wednesday, October 19, 2011

Inference of dynamics for complex systems, part 1

Today I will start over with the analysis of dynamic systems, describing a methodology and some of the rationale behind the interpretations from previous postings, as it occurs to me that all of this stuff, though discussed before, is buried in the archives and is not easy to pull together.

This will also be good for me as I have to put together some kind of paper on the topic for one or more conferences in the first half of next year. GAC, in St. John's next year, will be a given as it is my old alma mater, but I am giving thought to presenting at the upcoming 3rd Multiconference on Complexity, Informatics and Cybernetics.

You are studying an interesting system, with many components. You know that many of the components interact, but you don't know the details of their interaction. If the interactions vary with changing conditions  within the system (feedback) it may be described as a complex adaptive system. Examples of such systems include, but are not limited to, ecosystems and other biological systems, the stock market and other economic systems, the climate system, and some would argue, the entire earth system.

The behaviour of such systems is typically nonlinear, and typically characterized by self-organization and emergent phenomena. The presence of negative feedback gives the system a form of resilience, allowing it to resist perturbations; and the presence of positive feedback causes the system to experience episodes of rapid change, usually resulting in a shift from one equilibrium condition to another. Multistability (the presence of more than one equilibrium condition) is a common feature of such systems.

The system has input signals, which may be time-dependent, however it may be that you are only able to observe some of these signals; furthermore there may be input signals of which you are unaware. There are output signals, which you observe, and compile into one or more time series; however there is no way to know if your output signal is important in terms of developing a global understanding of the system of interest.

There are conditions within the system which influence the manner in which the input signals feed through to the output signals. You may have an inkling of some of these rules (commonly expressed as differential equations) but normally your understanding of these rules is incomplete. You hope to understand your system by deducing these equations on the basis of your observations.

Here are some examples of systems we may wish to study.











Daily closing prices for Detour Gold Corp. (DGC-T), from late November 2009 to October 2011.


Gold-silver ratio.


Case-Shiller index. Data from Robert Shiller data page.



Unemployment rate (from US BLS site).


Trading activity in Century Casinos, June 21, 2011. From Nanex.


Paleoclimate proxy records over the past two million years. Magnetic susceptibility of loess (proxy for Himalayan monsoon strength) at top. Deep water 18-O record (proxy for global glacial ice volume) at bottom.

At first glance, the problem seems insurmountable. How do you study a system when you can't even be sure that your observations are meaningful? What if you have failed to observe the most important observable parameters?

It is especially bad for the geological time series, for in addition to the above problem, there are both errors in measurement and errors in the date (or time) of each observation.

In future installments, we will work through the data sets shown above; but we will start with some thoughts on equilibrium.

Tuesday, September 27, 2011

Recognizing change in complex systems: excursions vs. bifurcations

Continued from last time.


Once again, we have a fifteen-year plot of gold/copper ratio vs. silver/rough rice ratio. We are continuing our discussion of whether the event labelled C, which is still unfolding, is likely to be an excursion (which will then return to the region populated by most of the graph) or a bifurcation (which will lead us to a new area of Lyapunov stability somewhere new in phase space).

It appears to be at least a once-in-a-generation event. But how significant is it?

For this spike to represent a bifurcation as opposed to an excursion, what we would have to see the function settle in around a new area of phase space. Looking at the shape of the spike, the likely area for such a new area of stability will be centred near the "C", and could extend from the far right of the graph to the kink in the curve near (350, 1.5). For this to form with any degree of satisfaction is likely to take about two more years. If we don't see any sign of orbiting about the "C", then the most likely outcome is a return to the 15-year area of stability.

I found it interesting that on this graph, the silver spike of 1998 does not appear. It is lost in the middle of area of stability.

Is it possible that the late spike in silver is due to its comparison to a soft commodity, which perhaps haven't performed as well as metals? We can check this by changing our ratios slightly.


Same four commodities--but compared differently. This time we are looking at the silver($/oz) to copper ($/lb) ratio against gold to rough rice. There are three significant excursions, labelled A, B, and C.

Excursion A represents the spike in silver price in 1998 due to the Warren Buffet purchase. Excursion B is the rise in price in copper in 2006, which exceeded (in percentage terms) the gain in silver which occurred at the same time.

Excursion C has two phases. For the first six months or so, the excursion is dominated by increased gold prices (compared to rice), and for the last 13 months or so, the excursion records the outperformance of silver.

Once again, we won't be sure that this is a bifurcation as opposed to an excursion unless the phase space settles somewhere near or above the "C" for at least another two years.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

It is obvious gold has not behaved well lately. Some of the stocks have been hit as well. We haven't looked at Detour Gold Corp. for awhile.


The recent price action has mirrored that of gold, with a sharp rise from the end of July and a sharper decline in the past few trading days.


The two-dimensional reconstructed phase space of the last eight months of the price of DGC-T.

The phase space portrait occupies a Lyapunov-stable area at around $30 for about six months, and from the beginning of August, the system evolves towards the $37 area. The system completes an orbit in the $37 range before leaving the area. This behaviour suggests that there may be another LSA in the $37 range, but I would feel more comfortable with it after a few more orbits.

What happens next? The two most likely scenarios would appear to be a return to the $30 LSA, or a return to the incipient LSA in the $37 range. Being long Detour, I would be encouraged by a reinforcement of the $37 LSA. Unfortunately, this outcome is nearly impossible. The reason is in the nature of the construction of the graph. Recall that the phase space reconstruction is generated by the price at closing of a particular day (on the vertical axis) against the closing price four trading days earlier (horizontal axis).

The coordinates of the last point are ($37.60, $31.00). In four days, the value of the x-coordinate is going to be $31 (today's closing price). In three days, the value of the x-coordinate is going to be $31.17 (yesterday's closing price). I don't know what the closing price of Detour will be on those days--but if it is at about the current price, then the state will lie within LSA30. The only possible hope for the Detour price state to reach the orbit at $37 would be for the price to recover to about $37 within the next three trading days--by Friday. Even then the state would not lie within LSA37, but at least the trajectory would indicated that that would be the likely outcome.

In fact, if we don't see some reassuring action tomorrow--when x falls to $33.60--we will be right on the outer edge of LSA30.

There is another, less desirable outcome. The price may continue falling to the previous LSA near the $23 level. Doh!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Time to liquidate more cocoa. Sadly, the good Ghanaian stuff is all gone. I am forced to take the South American stuff. But I can at least sweeten it a little with this.




Saturday, February 19, 2011

Recent price action in Detour Gold

An update on the state space for the price of Detour Gold Corp. When we last checked, the price was confined to a Lyapunov-stable area centred around $30.

Over the past two months we have seen a price correction in Detour Gold (disclosure--long position), followed by a return to the $32 level.

The two-dimensional state space shows the correction as a minor excursion towards LSA23.


The system has returned to LSA30.

Thursday, December 23, 2010

Reconstructed phase space portraits and charting

It's been awhile since we last checked in on Detour Gold Corp. (disclosure: long).

Over the past seven months, we have seen some nice price action, with a major rise in the early summer.

The two-d reconstructed phase portrait using the time-delay method with a lag of three days (as last time).


In our last installment on this stock the price was rising more or less monotonically. Now we see that what happened was a distinctive shift from one range (at lower left) to a higher price area, where the price has been bouncing around for awhile.

Looking at the two LSAs above, one represents a price range in the $21-25 range, and the second is $27-33. Should it fall out of this range, we would presume it could fall back into the other.

We can see a connection between the price chart and the reconstructed phase space portrait. It is clear that what we call confinement to a Lyapunov-stable area (and use as an indicator of at least temporary stability) . . .


 . . . may be perceived by the chartists as "trading within a range".


(Those diagonal lines aren't intended to be there--they magically appeared during the conversion of the above chart from excel to corel to jpg). 

If we look at the higher of the two Lyapunov-stable areas (LSA30), we see that different parts of it are occupied at different times.

Detail of LSA30 by month.

In particular, the regions of phase space centered at about $30 and at about $31.50 are visited at least three times, and several of those visits are characterized by small loops in the phase space portrait, suggesting quasi-stability. On the price chart above, those regions correspond with what chartists would call support and resistance. 

The phase space portraits of complex systems are often characterized by areas of high probability density, which are sometimes (if they have the correct characteristics) called attractors, but may more commonly be referred to as Lyapunov-stable areas (LSA). An LSA is an area in phase space where the state of the system tends to remain assuming there are no dramatic changes in the dynamics of the system. We would normally interpret such an area as evidence for a metastable state in that region of phase space.

If the state space of the system normally occupies an area below the range of values represented within the LSA, then the upper and outer limit of values will appear (on a one-dimensional chart) to be resistance--and chartists frequently describe such phenomena as the price "bouncing" off resistance.

If the state space of the system is occupying the region above the LSA, the chartists will term the lower boundary of the LSA to be "support".

If support is broken, it means the system has left the LSA, and is moving towards another one, presumably at a lower price. The chartist will say that support has failed, and will look back along the chart for the next region of support, which will have been the lowest value of the next lower LSA. If the price has broken down through an all-time low, then there is no telling how low the price will go.

If resistance is broken, the price may move towards the next higher LSA if one is present. If so, the highest value within the LSA will be seen by the chartist as "the next area of resistance". If the price has broken to a new all time high, then we are probably all in the dark.

Wednesday, September 1, 2010

How life imitates the stock market, part 5: Choosing a lag for phase space reconstruction

We continue with reconstructing a phase space for Detour Gold Corp. (DGC-T). Disclosure -- long position (which long predates my use of this analytical tool).

A two-dimensional phase space can be reconstructed from a time series by creating a scatter plot of the time series against a lagged copy of itself. By doing so we create a plot which is topologically equivalent (though not absolutely identical to) a phase space consisting of the time series plotted against its first time derivative.

How much of a lag should we choose. It should be intuitively obvious that the lag should not be too small. If, for instance, we had pricing data for our stock that was collected at one-second intervals, a lag of 1 s would probably not show very interesting dynamics, as 1 s is not enough time for much to happen with price (except very rarely).

The price data in the DGC pricing time series is at one-day intervals, so that one day should be the smallest lag we can look at. Well, we could look at a zero lag plot, but it is not very interesting.

The zero-lag 2-d phase space for Detour Gold. Actually, it does show something interesting--there is something of a gap in price from about $25 to $27 and $28 to $29. But we could have learned that from a simple one-dimensional plot.

A lag of one day (for instance plotting Friday's closing price against Thursday's, etc.) looks a little more interesting. . .


It is a little difficult to make out where the graph starts, but its ending stands out, with the last price in our time series being just above $31. Here is the phase space with a lag of two days . . .


Many of the same features are present, but the curve diverges a little more from the diagonal line. Even though equivalent features can be found in both of the lagged time series, the specific shape of corresponding features changes somewhat from one lag to another.

Here is the phase space with a lag of three days.



And for four . . .



Nothing much new here. The overall form is the same, however you may notice that the lower part of the plot is spread away from the diagonal more than is the case in the one-day-lag phase space. The last plot also is not quite as tangled as the one-day-lag phase space.

Overall, this is not a very interesting plot. Part of it is because the dynamics of the stock performance over the last nine months has not been very interesting--at least from a dynamics perspective (it is always interesting to see a stock for which one has a long position rising).

The reason for the minor differences in the reconstructed phase spaces has to do with the connection between the lag, and the portion of the curve over which the slope (the first derivative) is calculated. When we used the price difference last time, we were actually using that as an estimate of the slope of the tangent to the price function. When I chose to take the price difference over a two-day period (and then divided by two), I was estimating the tangent slope from two points that were separated by two days.

In the small diagram at left, we are interested in finding the slope of the tangent (yellow line) to the curve at point T.

By using the price difference over two days, we calculate the slope of the green line segment, which is our estimate of the slope of the yellow line.

Because the only data we actually have are represented by the red blobs, we cannon find the slope of the yellow line directly.

The lag plot essentially estimates the slope of the yellow line differently.

For the one-day lag, your estimate of the slope is the short red line segment; for the two-day lag, the orange segment; three-day lag, the green; and for the four day lag, the estimate for the slope of the yellow tangent line is the slope of the blue segment.

Clearly, none of these look like particularly good estimates. So what is the relative merit of choosing one lag over another.

If the time series is especially busy, with a lot of variability, then the slopes estimated between neighbouring points will similarly show a lot of variability. If the the slopes are estimated between points that are farther apart (longer lag), there will be less variability.

The choice of a lag can therefore be influenced by the scale of the dynamics of interest. If you are interested in short timescale dynamics, you need to use a short lag, and if you are interested in longer-term dynamics, you need to use a longer lag.

The formal rules (first minimum of the average mutual information) is selected because this maximizes the differences between the two axes so that the maximum information is revealed.

Unfortunately, the DGC plots don't show a lot of interpretable dynamics. So let's look at some functions with some interesting dynamics.

The plot at left shows the plot of the proxy function for global ice volume over the past million years. Data from Shackleton et al. (1990).

In various papers and presentations over the past ten years I have used this record and others to study global climate dynamics.

The2-d state space reconstructed below used a lag of 6,000 years and covers about half of the record shown above (from 500,000 years ago until present).

Now here we have a phase space which allows us to interpret a lot about the dynamics of the system. It is a little complex, and like other plots above, it just consists of numerous clockwise loops overlapping each other.

The record would look better rendered in three dimensions, as the apparent intersections would be shown to be areas where the function passes beneath itself.

In the coming discussions we will look at ways to clarify the plot at left and see what can be interpreted from it.


Reference:

Shackleton N J, Berger A, Peltier W R. An alternative astronomical calibration of the lower Pleistocene timescale based on ODP Site 677. Trans R Soc. Edinburgh Earth Sci, 1990, 81: 251―261.