The kind of puzzle that Karl Friedrich was after

My editorial on You Tube

Over the last few updates, I have been indulging in the mathematical logic of Gaussian process, eating it with the spoon of mean-reversion. My so-far experience with using the logic of Gaussian process is that of my personal strategy as regards investment in the stock market, and especially as regards those short, periodical episodes of reshuffling in my investment portfolio, when I am exposed to, and I frequently yield to the gambling-like temptation of short trade (see Acceptably dumb proof. The method of mean-reversion , Fast + slower = compound rhythm, the rhythm of life, and We really don’t see small change ). Gambling-like is the key concept here. I engage into quick trade, and I feel that special flow, peculiar to gambling behaviour, and yet I want that flow to weave around a rational strategy, very much in the spirit of Abraham de Moivre’s ‘The doctrine of chances: or, A method of calculating the probabilities of events in play’, published in 1756. A bit of gambling, yes, but informed gambling.  

I am trying to understand why a neural network based on mean-reversed prices as input consistently underestimates the real price, and why the whole method of mean-reversion fails with super-stable prices, such as those of cobalt or uranium (see We really don’t see small change).

I like understanding things. I like understanding the deep logic of the things I do and the methods I use. Here comes the object of my deep intellectual dive, the normal distribution. In the two pictures below, you can see the initial outline of the problem.

How does a function, namely that of normal distribution, assist my process of decision making? Of course, the first-order answer is simple: ‘it gives you numbers, bro’, and when you see those numbers you essentially know what to do’. Good, great, but I want to understand HOW EXACTLY those numbers, thus the function I use, match with my thinking and my action.

Good. I have a function, i.e. that of normal distribution, and for some reason that function works. It works geometrically. The whole mathematical expression serves to create a fraction. If you look carefully at the equation, you will understand that with given mean value μ and standard deviation σ, there is no way this function can go above 1. It is always a fraction. A fraction can be seen from different angles. Firstly, it is a portion of something, like a / b, where a < b. There is a bigger something, the denominator of the fraction, σ[(2π)0,5] = σ* 2,506628275. (elevation to power 0,5 replaces the sign of square root, which I cannot reproduce exactly from the keyboard, as a font).  Secondly, as we talk about denominators, a fraction is a change in units of measurement. Instead of measuring reality in units of 1 – the smallest prime number – we measure reality in units of whatever we put in the denominator of the fraction. Thirdly, a fraction is a proportion between two sides of a rectangle, namely the proportion between the shorter side and the longer side.

Good, so what this function of normal distribution represents is a portion cut of a bigger something equal to σ[(2π)0,5], and that something is my unit of measurement, and, in the same time, it is the longer side of a rectangle. The expression σ[(2π)0,5] is something like one dimension of my world, whilst the whole equation of normal distribution, i.e. the value of that function, makes the other dimension. Is the Gaussian world a rectangular world? I need to know. I start talking to dead people. Usually helps. This time, my interlocutor is Karl Friedrich Gauss, in his General Investigations of Curved Surfaces, presented to the Royal Society, October 8th, 1827.

What many people ignore today is that what we call a Gaussian curve is the outcome of a mathematical problem, which, initially, had virtually nothing to do with probability. What Karl Friedrich Gauss (almost) solved was the problem of geodetic measurements, i.e. the distinction between the bird’s flight distance, and the actual length of the same distance on the rugged and uneven surface of the Earth. I know, when we go through mountains, it is sometimes uphill, sometimes downhill, and, on average, it is flat. Still, when you have to build a railroad through the same mountains, the actual length (spell: cost) of rails to put on the ground is much greater than what would be needed for building the same railroad in the plain. That’s the type of puzzle that Karl Friedrich was after.

Someone could say there is no puzzle. You want to know how long a rail do you need to go over a mountain, you send surveyors and they measure it. Splendid. Yet, civil engineering involves some kind of interference with the landscape. I can come up with the idea of putting my railroad alongside like the half-height of the mountain (instead of going right over its top), or maybe we could sort of shave off the top, couldn’t we, civilised people whom we are? Yes, those ideas are all valid, and I can have a lot of them. Sending surveyors each time I come up with a new concept can become terribly time- and money-consuming. What I could do with is a method of approximating each of those alternative distances on a curved surface, a method which finds good compromise between exactitude and simplicity.

Gauss assumed that when we convert the observation of anything curved – rugged land, or the orbit of a planet – into linear equations, we lose information. The challenge is to lose as little an amount thereof as possible. And here the story starts. Below, you will find a short quote from Gauss: the first paragraph of the introduction.   


Investigations, in which the directions of various straight lines in space are to be considered, attain a high degree of clearness and simplicity if we employ, as an auxiliary, a sphere of unit radius described about an arbitrary centre, and suppose the different points of the sphere to represent the directions of straight lines parallel to the radii ending at these points. As the position of every point in space is determined by three coordinates, that is to say, the distances of the point from three mutually perpendicular fixed planes, it is necessary to consider, first of all, the directions of the axes perpendicular to these planes. The points on the sphere, which represent these directions, we shall denote by (1), (2), (3). The distance of any one of these points from either of the other two will be a quadrant; and we shall suppose that the directions of the axes are those in which the corresponding coordinates increase.’

Before I go further, a disclaimer is due. What follows is my own development on Karl Friedrich Gauss’s ideas, not an exact summary on his thoughts. If you want to go to the source, go to the source, i.e. to Gauss’s original writings.

In this introductory paragraph, reality is a sphere. Question: what geometrical shape does my perception of reality have? Do I perceive reality as a flat surface, as a sphere (as it is the case with Karl Friedrich Gauss), or maybe is it a cone, or a cube? How can I know what is the geometrical shape of my perception? Good. I feel my synapses firing a bit faster. There is nothing like an apparently absurd, mindf**king question to kick my brain into higher gear. If I want to know what shape of reality I am perceiving, it is essentially about distance.

I approach the thing scientifically, and I start by positing hypotheses. My perceived reality is just a point, i.e. everything could be happening together, without any perceived dimension to it. Sort of a super small and stationary life. I could stretch into a segment, and thus giving my existence at least one dimension to move along, and yet within some limits. If I allow the unknown and the unpredictable into my reality, I can perceive it in the form of a continuous, endless, straight line. Sometimes, my existence can be like a bundle of separate paths, each endowed with its own indefiniteness and its own expanse: this is reality made of a few straight lines in front of me, crossing or parallel to each other. Of course, I can stop messing around with discontinuities and I can generalise those few straight lines into a continuous plane. This could make me ambitious, and I could I come to the conclusion that flat is boring. Then I bend the plane into a sphere, and, finally things get really interesting and I assume that what I initially thought is a sphere is actually a space, i.e. a Russian doll made of a lot of spheres with different radiuses, packed one into the other.

I am pretty sure that anything else can be made out of those seven cases. If, for example, my perceived reality is a tetrahedron (i.e. any of the Egyptian pyramids after having taken flight, as any spaceship should, from time to time; just kidding), it is a reality made of semi-planes delimited by segments, thus the offspring of a really tumultuous relationship between a segment and a plane etc.

Let’s take any two points in my universe. Why two and not just one? ‘Cause it’s more fun, in the first place, and then, because of an old, almost forgotten technique called triangulation. I did it in the boy scout times, long before Internet and commercial use of Global Positioning System. You are in the middle of nowhere, and you have just a very faint idea of where exactly that nowhere is, and yet you have a map of it. On the map of nowhere, you find points which you are sort of spotting in the vicinity. That mountain on your 11:00 o’clock looks almost exactly like the mountain (i.e. the dense congregation of concentric contour lines) on the map. That radio tower on your 01:00 o’clock looks like the one marked on the map etc. Having just two points, i.e. the mountain and the radio tower, you can already find your position. You need a flat surface to put your map on, a compass (or elementary orientation by the position of the sun), a pencil and a ruler (or anything with a straight, smooth, hard edge). You position your map conformingly to the geographical directions, i.e. the top edge of the map should be perpendicular to the East-West axis (or, in other words, the top edge of the map should be facing North). You position the ruler on the map so as it marks an imaginary line from the mountain in the real landscape to the mountain on the map. You draw that straight line with the pencil. I do the same for the radio tower, i.e. I draw, on the map, a line connecting the real radio tower I can see to the radio tower on the map. Those lines cross on the map, and the crossing point is my most likely position.

Most likely is different from exact. By my own experience of having applied triangulation in real outdoors (back in the day, before Google Maps, and almost right after Gutenberg printed his first Bible), I know that triangulating with two points is sort of tricky. If my map is really precise (low scale, like military grade), and if it is my lucky day, two points yield a reliable positioning. Still, what used to happen more frequently, were doubtful situations. Is the mountain I can see on the horizon the mountain I think it is on the map? Sometimes it is, sometimes not quite. The more points I triangulate my position on, the closer I come to my exact location. If I have like 5 points or more, triangulating on them can even compensate slight inexactitude in the North-positioning of my map.   

The partial moral of the fairy tale is that representing my reality as a sphere around me comes with some advantages: I can find my place in that reality (the landscape) by using just an imperfect representation thereof (the map), and some thinking (the pencil, the ruler, and the compass).  I perceive my reality as a sphere, and I assume, following the intuitions of William James, expressed in his ‘Essays in Radical Empiricism’ that “there is only one primal stuff or material in the world, a stuff of which everything is composed, and if we call that stuff ‘pure experience,’ then knowing can easily be explained as a particular sort of relation towards one another into which portions of pure experience may enter. The relation itself is a part of pure experience; one of its ‘terms’ becomes the subject or bearer of the knowledge, the knower,[…] the other becomes the object known.” (Excerpt From: William James. “Essays in Radical Empiricism”. Apple Books).

Good. I’m lost. I can have two alternative shapes of my perceptual world: it can be a flat rectangle, or a sphere, and I keep in mind that both shapes are essentially my representations, i.e. my relations with the primal stuff of what’s really going on. The rectangle serves me to measure the likelihood of something happening, and the unit of likelihood is σ[(2π)0,5]. The sphere, on the other hand, has an interesting property: being in the centre of the sphere is radically different from being anywhere else. When I am in the centre, all points on the sphere are equidistant from me. Whatever happens is always at the same distance from my position: everything is equiprobable. On the other hand, when my current position is somewhere else than the centre of the sphere, points on the sphere are at different distances from me.

Now, things become a bit complicated geometrically, yet they remain logical. Imagine that your world is essentially spherical, and that you have two complementary, perceptual representations thereof, thus two types of maps, and they are both spherical as well. One of those maps locates you in its centre: it is a map of all the phenomena which you perceive as equidistant from you, thus equiprobable as for their possible occurrence. C’mon, you know, we all have that thing: anything can happen, and we don’t even bother which exact thing happens in the first place. This is a state of mind which can be a bit disquieting – it is essentially chaos acknowledged – yet, once you get the hang of it, it becomes interesting. The second spherical map locates you away from its centre, and automatically makes real phenomena different in their distance from you, i.e. in their likelihood of happening. That second map is more structured than the first one. Whilst the first is chaos, the second is order.

The next step is to assume that I can have many imperfectly overlapping chaoses in an otherwise ordered reality. I can squeeze, into an overarching, ordered representation of reality, many local, chaotic representations thereof. Then, I can just slice through the big and ordered representation of reality, following one of its secant planes. I can obtain something that I try to represent graphically in the picture below. Each point under the curve of normal distribution can correspond to the centre of a local sphere, with points on that sphere being equidistant from the centre. This is a local chaos. I can fit indefinitely many local chaoses of different size under the curve of normal distribution. The sphere in the middle, the one that touches the very belly of the Gaussian curve, roughly corresponds to what is called ‘standard normal distribution’, with mean μ = 0, and standard deviation σ =1. This is my central chaos, if you want, and it can have indefinitely many siblings, i.e. other local chaoses, located further towards the tails of the Gaussian curve.

An interesting proportion emerges between the sphere in the middle (my central chaos), and all the other spheres I can squeeze under the curve of normal distribution. That central chaos groups all the phenomena, which are one standard deviation away from me; remember: σ =1. All the points on the curve correspond to indefinitely many intersections between indefinitely many smaller spheres (smaller local chaoses), and the likelihood of each of those intersections happening is always a fraction of σ[(2π)0,5] = σ* 2,506628275. The normal curve, with its inherent proportions, represents the combination of all the possible local chaoses in my complex representation of reality.    

Good, so when I use the logic of mean-reversion to study stock prices and elaborating a strategy of investment, thus when I denominate the differences between those prices and their moving averages in units of standard deviation, it is as if I assumed that standard deviation makes σ =1. In other words, I am in the sphere of central chaos, and I discriminate stock prices into three categories, depending on the mean-reversed price. Those in the interval -1 ≤ mean-reversed price ≤ 1 are in my central chaos, which is essentially the ‘hold stock’ chaos. Those, which bear a mean-reversed price < -1, are in the peripheral chaos of the ‘buy’ strategy. Conversely, those with mean-reversed price > 1 are in another peripheral chaos, that of ‘sell’ strategy.

Now, I am trying to understand why a neural network based on mean-reversed prices as input consistently underestimates the real price, and why the whole method of mean-reversion fails with super-stable prices, such as those of cobalt or uranium (see We really don’t see small change). When prices are super-stable, thus when the moving standard deviation is σ = 0, mean-reversion, with its denomination in standard deviations, yields the ‘Division by zero!’ error, which is the mathematical equivalent of ‘WTF?’. When σ = 0, my central chaos (the central sphere under the curve) shrinks a point, devoid of any radius. Interesting. Things that change below the level of my perception deprive me of my central sphere of chaos. I am left just with the possible outliers (peripheral chaoses) without a ruler to measure them.

As regards the estimated output of my neural network (I mean, not the one in my head, the one I programmed) being consistently below real prices, I understand it as a proclivity of said network to overestimate the relative importance of peripheral chaoses in the [x < -1] [buy] zone, and, on the other hand, to underestimate peripheral chaoses existing in the [x > 1] [sell] zone. My neural network is sort of myopic to peripheral chaoses located far above (or to the right of, if you prefer) the center of my central chaos. If, as I deeply believe, the logic of mean-reversion represents an important cognitive structure in my mind, said mind tends to sort of leave one gate unguarded. In the case of price estimation, it is the gate of ‘sell’ opportunities, which, in turn, leads me to buy and hold whatever I invest in, rather than exchanging it back into money (which is the exact economic content of what we call ‘selling’).         

Interesting. When I use the normal distribution to study stock prices, one tail of the distribution – the one with abnormally high values – is sort of neglected to the benefit of the other tail, that with low values. It looks like the normal distribution is not really normal, but biased.

We really don’t see small change

My editorial on You Tube

Whatever kind of story I am telling, it is, at the end of the day, my own story, the story of my existence: this is hermeneutic philosophy, which I fully espouse intellectually. What’s my story, then? My essential story, I mean, the one which I weave, barely perceptibly, into the fabric of my narration about anything?

I think this is a story of change and learning. I change, my life changes, and I learn. Yes, I think that change is the most general denominator in my existence. You would say that it is the story of us all. Yes, indeed it is. We change, things change, and we learn. I think I was nine, when I got scarlet fever, AKA scarlatina. Nasty stuff: I spent almost two months with a fever around 39 degrees Celsius (= 102 Fahrenheit), on huge doses of Erythromycin (which is nasty stuff in itself). I remember doctors just sighing and alluding, in conversations with my parents, that we are sailing further and further into the hardly charted at all seas of maybe-it-is-going-to-work medicine. I had cardiac damage, and most probably some brain damage. I am not quite sure of that last one: in 1977, in the communist Poland, it was not like you can go and have your kid’s brain CT scanned just like that. Still, after that scarlet fever, I started to stutter (which had been haunting me until quite recently) and I started having learning problems at school. School fixed itself after like 3 years, stuttering took another 38 years or so (still have some echo of that in me), and here I am, having consumed and hopefully owned that particular avenue of change.

I am (mildly) obsessed about the connection between the collective intelligence of human societies. Not just human, as a matter of fact; viruses become kind of trendy, recently. I am going to develop on the concept of mean-reversed price precisely in that spirit, i.e. the link between us, humans, being collectively smart, and the ways to use artificial intelligence so as to discover how exactly collectively smart we are. In my previous two updates, I outlined the logic of mean-reversed price as analytical tool for nailing down a workable strategy of investment in the stock market. See ‘Acceptably dumb proof. The method of mean-reversion’ (earlier, April 9th, 2020), and ‘Fast + slower = compound rhythm, the rhythm of life’ (later, April 11th, 2020). Now, I go out of the stock market, and about into commodities. I want to check my intuitions in a different transactional context, and I want my writing to be useful for students in the courses of International Trade, International Management, and Macroeconomics.

Here is a perfectly normal world, where the entire social activity is centred on making (mining, growing) and trading 4 commodities: pork meat (lean hogs), uranium, coffee, and cobalt. Perfectly normal, I say. We raise pigs, and eat them, we make a lot of nuclear bombs, and a lot of electronics, and, obviously, doing all those things requires big amounts of coffee. In that perfectly normal world, the logic of ‘Price * Quantity’ still holds (see: ): we, humans, do all kinds of crazy and wonderful things, doing those things makes us generate an aggregate amount Q of economic utility, we go about that utility in recurrently patterned deals of exchange (AKA transactions), and observing transactional prices in, respectively, pork meat (lean hogs), uranium, coffee, and cobalt, can be possibly informative about how’s life going for us. Here is the link to download the Excel file with prices: .

I learn by accumulating knowledge, which allows, in the first place, distinguishing the normal from the alarming. I go Gaussian about it, and thus I build my expectations as moving average of past prices, and I denominate my perception in units of just as moving a standard deviation. Once again, I am in the world of mean-reversion.

I allow different temporal perspectives in my learning, and I introduce one more fundamental distinction, namely between learning with full memory, and learning with imperfect recall. The ways of calculating mean-reverted prices, which I showed in ‘Acceptably dumb proof. The method of mean-reversion’, and ‘Fast + slower = compound rhythm, the rhythm of life’, are marked with imperfect recall. I remember over a limited window in time: 30 days, 7 days etc. If my window is 30 days, on the 32nd day I forget whatever I remembered from day 1; on day 33, it is day 2 that I forget etc. Economic sciences convey substantial evidence that most markets, and most societies, as a matter of fact, shake off their memories every now and then. Yes, it seems that we like forgetting collectively.

Still, I want to have an alternative of not forgetting, and I introduce slightly different a method of calculating mean-reverted price: my temporal window stretches as far into the past as my data reaches back. My ‘lag’ in the equation grows every day. On day 15, I mean-revert the actually observed price with an average of prices 14 days back, and a standard deviation with the same window. On day 20, I reach back 19 days; on day 300, it is 299 days into the past etc. I call it mean-reversed cumulative.   

Once again, what mathematically is called mean-reversion is a typical pattern of our human cognition. We learn in order to slow down learning. Now, let’s see if it really works in all cases. I encourage you to go and retrieve the Excel file with those prices of : pork meat (lean hogs), uranium, coffee, and cobalt (link HERE), and practice calculating the mean-reversed prices. You will notice something interesting: sometimes it does not work at all. If you do the operation in Excel, it will yield the ‘DIV/0!’ error, which means that you are trying to divide by zero, which just doesn’t do in decent mathematics. The denominator we are dividing by is standard deviation, and when the phenomena observed are rrreaallly stationary, their standard deviation is equal to zero. In human cognition, it corresponds to a situation when the observable gradient of change is too subtle to be perceived and processed. We need perceivable change in order to learn. No change, no experience to put in your belt, sorry bro’. In this perfectly normal world, where we focus our activity on lean hogs, uranium, cobalt and coffee, such impossible situation happens a lot with uranium and cobalt, whilst taking place much less frequently with pork meat and coffee. In the reality we are currently experiencing, there are phenomena variable enough to offer our brain some material for trying to look clever, and there are others, like undertows of what’s happening, too stationary to be noticed.

The capacity to perceive change depends on the time frame of change. Those ‘WTF!? Division by zero!’ situations happen more frequently with shorter temporal windows. When I compute my moving average and moving standard deviation over a period of 7 days, and I observe the prices of cobalt, ‘DIV/0!’ happens like half of the time. When I stretch my temporal reference up to 30 days, many of those embarrassing absences of judgement disappear, and when I just go for cumulative moving average (and standard deviation), it happens just once, on day one, and then Bob’s my uncle: I always have some change to learn from.

If you have ever wondered why we have memories of various temporal reach, this might be an interesting avenue to walk down in order to find some answers. When our brain suddenly pulls out into consciousness some old stuff from back when I was twelve, it probably needs to compare data, to find some standard deviation as base of new learning.

Now, I put the same data into a simple neural network, a multi-layer perceptron. My question is: what kind of learning can an intelligent structure make out of observing reality the Newtonian way, with a focus on change?  In layer 1, I put three neurons. Each of them computes a different mean-reversion of the actual price: cumulative (from the beginning of time), the 30-day-based one, and the short one, with just 7 days of reference. In layer 2, another set of 3 neurons standardizes the mean-reversed observations on a scale from 0 to 1. In layer 3, I put one neuron, which assigns random coefficients to standardized observations, each random coefficient ranging between 0 and 1. This neuron experiments. It is the ‘what-happens-if-I-change-my-priorities?’ experimentation. In layer 4, three neurons activate, each based on a different function of neural activation: there is one sigmoid-based, another one working with hyperbolic tangent, and the third one made with ArcSinH, or hyperbolic arcsine. I add that third one because it has the interesting property not to require any standardization of raw data. Sigmoid and hyperbolic tangent are like refined intellectuals, who do not accept any input without a cappuccino as accompaniment. Hyperbolic arcsine is like a child, who just accepts what happens for what it is. In layer 5 of my network, three neurons calculate the error that each of those neural activations make in estimating the output, i.e. the actual price as recorded in the market. Layer 6 contains one neuron, which selects the least error among those coming from layer 5 and feeds it forward to the next round of experimentation.       

If I want my neural network to work, I need to get rid of the ‘DIV/0!’ cases and replace them by some arbitrary value. If at least one observation yields ‘DIV/0!’, the neural network goes on strike and yields the same, i.e. structural error of dividing by zero. Looks like intelligent structures do it all the time: I cannot see change, so I pretend that nothing happened. If I don’t pretend that, I face so strong a cognitive dissonance that I just go to intellectual sleep. Openly admitting that some important information has slipped out of our attention is one of the hardest things to do, cognitively. It is always safer to assume that we know everything we need to know.

Perception of actual empirical values, such as typical neural networks are based on, are maybe more natural and less human. There are less filters. Perception based on mean-reverted values i.e. rooted in change rather than absolute states, is more human-like.

Below, you can see visualisations of prices, respectively in coffee and in cobalt. Each of those markets is shown under two angles. Actual prices, i.e. market closures on each trading day over the last year (blue lines on each graph) are put back to back with prices estimated through the neural network which I have just described (orange line).

Two observations sort of jump to the eye (or maybe it is just my eye?). Prices simulated by the piece of AI are consistently lower that the actual ones, for one. An intelligent structure based on the very human cognitive mechanism of habitual perception and assessment (mean-reversion) consistently underestimates the real magnitude of the phenomenon under scrutiny. Secondly, that underestimation is much more pronounced in the case of cobalt than regarding coffee.

As you might remember from your own calculations, which I encouraged you to perform with those prices, mean-reverted prices of cobalt are much more prone to the ‘DIV/0!’ error, fault of sufficient variance, than the prices of coffee. Cognitively, it means that habitual perception (i.e. based on mean-reversion) tends to underestimate the magnitude of mostly those phenomena, which offer really low variance to our direct perception. We really don’t see small change. This is why we need scales of measurement. We need a scale of temperature, and the corresponding measurements, to assess the local kinetic energy of particles. In our perception, the difference between 35 degrees Celsius and 37 degrees Celsius is not a big deal when it comes to the ambient exterior, but it makes a difference when applied to body temperature.

As you might remember, had you followed ‘Acceptably dumb proof. The method of mean-reversion’ and ‘Fast + slower = compound rhythm, the rhythm of life’, I am developing a strategic tool for investing in the stock market, on the grounds of mean-reversion. What I can already see is that approached from this angle, my strategy could be a shade conservative, consistently downplaying the likelihood of sudden spikes in price, susceptible to offer me big rewards. Have to work on this one.

Fast + slower = compound rhythm, the rhythm of life

My editorial on You Tube

I am continuing and expanding my so-far line of thinking and writing, into something both more scientific and more educational (we are still in full distance learning mode, at the university). I want to develop on that simple model I have recently presented in the update entitled ‘Acceptably dumb proof. The method of mean-reversion’. I am going to develop and generalize on its cognitive and behavioural implications. By the way, I have just used it (it is April 10th, 15:40 p.m.) to buy a bit into Asseco Business Solutions and to open a position on a company active in stem cells: PBKM. I spotted a moment, when their mean-reversed stock price was passing the 0 point and going up. According to this method, there is very likely to be an upcoming spike, with an opportunity to sell at a profit.

Good. The behavioural context. When I trade in the stock market, with my own money, emotions grow strong. After a few years of pause in investing, I had actually forgotten how strong those emotions can unfold. The first thing which I already know this method has given me is emotional step-back, and the capacity to calm down. This is the mark of a good strategy: it is simple (this model of mine is really simple, as financial forecasts come), thus workable, and it gives that special sort of calm flexibility in decisions.

The capacity to step back from the emotions of the moment, to get some perspective, and make more informed decisions is based on one essential assumption: the distinction between the normal and the alarming. There is a state of things, which I accept as ‘normal’, when I just can do something, but I don’t need to. By opposition, I define a state of things-which-consist-in-me-experiencing-reality, where my perception urges me to take action.

This is about my perception of reality, right? In the stock market, reality is made of numbers, right? I mean, there is much more in trade, there are people, for example, yet the reality which I am most of all supposed to pay attention to is made of numbers: the stock prices. Prices change. This is their normal way of being in the stock market. By the way, some of you might think that stationary a price, in a security, is the best way of being for a long-term investment. Not really. When you try and do some trade, one day, you will see that durably stationary prices can frighten the s**t out of you. It is like a frozen reality: scary. When prices swing, their ebb and flow gives information. When they stop moving, there is no more information. You are in a dark room.

Good, to the numbers that make my reality in the stock market – prices – change constantly and they’d better keep changing. What I observe, thus, is change in prices rather than prices themselves. Mathematically, I observe the values of a function (stock prices), and the values of its derivatives (change in prices, and coefficients calculated thereupon). It is the old intuition of Isaac Newton: what we really perceive is change and difference rather than absolute states of reality.

I define two classes in all the possible types of change I observe in reality. Class #1, the relax-bro type, covers normal change and allows me to sit back and watch what happens next. I can do some action, if I really feel like, yet it is all up to me. Class #2, the c’mon-do-something one, jumps into being when change becomes somehow abnormal, like highly stimulating. There is normal change and abnormal change, then, and I want to define these two states of reality with the toolbox of mathematics. From there on, it is highly subjective. Mathematics provide many ways of defining what’s normal. In my model, I go for a classic: the normal distribution. The normal state of change, seen through the lens of normal distribution, is acceptable oscillation around the expected value of price. The expected value is arithmetical average of prices observed over a given period of time. Seen under this angle, the average price is something like an immediate projection of my past experience: I expect to see, here and now, something aligned with the states of reality I have experienced so far.

The ‘so far’ part is subjective. Do I expect the current change in prices to be somehow in line with what has been happening over the last year, over the last 3 years, or maybe just over the last week? You can see a glimpse of that choice when you go and check stock prices online, with a graph. Most online utilities give you the choice between snapshotting the current day, the last 2 weeks, the last month etc. People have different temporal frames of reference as for what is normal to them. In my personal model, the one I hinted at in ‘Acceptably dumb proof. The method of mean-reversion’, I set my frame of reference at the last month, or, to me more specific, at the last 30 trading days, which actually makes a little more than a calendar month.

Subjectivity is scalable and measurable. I am going to focus on two ramifications of this principle. Firstly, I can make typical change my unit of measurement. Secondly, I can shift between different time frames and see what kind of change it brings in terms of strategic behaviour. Before I walk down these two paths, I am reminding the general mathematical frame of what I am talking about (see picture below).

What happens, mathematically, when I follow the old Newtonian intuition of observing change rather than stationary states of nature? Logically, a given magnitude of change becomes my unit of measurement. In basic statistics, i.e. as long as we stay in the safe realm of Gaussian distributions, standard deviation, i.e. mean expected deviation from the mean expected average, can be such a Sevres-meter of my perception. Let’s keep in mind it is deep in our human perception: there are differences and variations large enough for us to notice, and the remaining part of all the chaos happening in that stuff we call reality passes essentially unnoticed to us.

When standard deviation becomes my gauge, and it serves me to assess whether anything is worth my attention, I can interestingly decompose the basic equation of mean-reversion, as residual difference between the actual value observed (price, in this case) and denominated in its own standard deviation, and the expected average value, denominated in the same way. In other words, mean-reversed price is the residual difference between the locally observed deviation from what I call ‘normal and expected’, and the general variability of what I observe (average divided by standard deviation).  

There is a simply and technically useful aspect of that approach. When standard deviation becomes the unit of measurement, I can directly compare the actions I should take on many investment positions, when they are in very different price ranges. Let’s study it on two different cases in my portfolio: Airway Medix, and 11Bit. The former is market-priced at less than PLN 1 per share, the latter is currently around PLN 380. When I mean-reverse their prices, I drive them both to the same scale, like inside the interval -3 ≤ x < 3. The local magnitude of mean reversed prices is directly comparable between the two.  

As I talk about comparisons, let’s compare these two – Airway Medix and 11Bit – in different time frames. My basic one is the last 30 trading days, but what if I look differently at time and change? What if I take a shorter view over the timeline, or a longer one? In tables below, I show four alternative temporal perspectives on those two stocks: last 30 days, 7 days, 14 days, and finally the past 6 months of trade.

 Mean-reversed price of Airway Medix
Trading dayWindow 30 daysWindow 7 daysWindow 14 daysWindow 6 months
 Mean-reversed price of 11Bit
Trading dayWindow 30 daysWindow 7 daysWindow 14 daysWindow 6 months
01.04.2020(0,47)0,490,62         (0,90)
02.04.2020(0,42)0,300,57         (0,90)
03.04.2020(0,31)0,730,90         (0,82)
06.04.20200,522,513,01           0,06 
07.04.2020(0,23)(0,10)0,25         (0,83)
08.04.2020(0,04)0,210,61         (0,68)
09.04.20200,411,021,46         (0,31)
10.04.20200,440,791,27         (0,30)

As I study the two tables above, my first question is: what do I actually see? What the differences between those numbers are actually informative about? Positive numbers tell me that the current price is sort of high as compared to the moving average, and negative say the opposite. As I look at the last days of trade before Easter, 11Bit appears as being kind of moderately positive in the 30-day view, and it means: rather hold than sell, unless you strike a really good deal. A timeframe of 7 days tells me more or less the same. When I set my timeframe at 14 days, it says: definitely look for a good sell, the price is abnormally high. Still, when I take a really long step back and look at the whole thing from the perspective of a 6-month temporal horizon, it says: ‘no, you dumb f**k, don’ even think about selling; if you feel the urge to do something, go and buy some of these’.

You can see empirically that my subjective perception of what is a long time, as opposed to what is just a moment impinges directly on the strategy I am supposed to adopt. It is a deep, general principle of human action. Farmers look at life differently from stock market brokers: their time frames differ.

What if I apply the same logic, i.e. the logic of mean-reversion, to volumes traded, instead of prices? What the mean-reversed volume is informative about? Let’s see. Here below, you can see comparative graphs of Airway Medix with, respectively, stock price and volumes traded daily, both mean-reversed over a window of the last 30 days of trade. You can see that volumes swing much more frequently than prices. It is as if they were two musical tunes: volumes modulated at a faster pace, and prices going at a slower one. Familiar? No? It is rock’n roll. Fast + slower = compound rhythm. The rhythm of life.

How can I generalize into any market? You can go and watch my tutorial in economics, the one about prices and quantities. It connects interestingly: .