Roulette & the Stock Market, Part 3
Source code ready to run for this article is at: https://diffent.com/redeven2.html Use View Source in a browser to see it.
In this article, proceeding to minutely analyze beyond all realms of practicality the fixed-in-time and never changing game of roulette (will they have roulette on Mars?) —
except when they added that double zero, whew — wasn’t that a genius move? Much like the “Repeat.” instruction on shampoo bottles that follows “Lather. Rinse.”
— we continue with our analogy of how certain roulette wagers resemble some classes of bearish yet volatile stock market assets when we start to look at variance of expected values, in addition to the “textbook” roulette expected probability values themselves. Gaming experts can tell you the probabilities of winning when betting red or betting even, but they may not be able to quickly tell you what happens when you bet red and even at the same time* [this is typically a pencil and paper exercise that we went through in a prior article], and they won’t often or maybe even ever tell you the variance of this wager (this may be pencil and paper-able… but personally, the current author doesn’t know how to do it without a computer at the moment).
*Note that we are analyzing a two chip bet (one each) on red and even. Not red and black. Much along the lines of radio D.J. Thayrone’s advice of “never wear your baseball cap sideways,” never bet on red and black at the same time, because they are mutually exclusive. This is just a fancy way to say that a spin result isn’t going to be both red and black at the same time unless we are dealing with quantum roulette, which… all right, you got me there, that may be a fun game for the future. But seeing that we aren’t in that future… don’t ever bet on red and black at the same time [Note 2].
For those who want to be in-the-know, this all comes out of the idea of modeling stock prices via the “heat equation,” an idea that won some fine fellows a Nobel in the late 1990’s. I believe that the idea for it pre-dated that award by a couple of decades at least, the Nobel being a lagging indicator.
The graphic animated above (if your browser allows it) from the wiki shows some sharp-edged heat distribution that then diffuses out over time like a melting caramel.
All together now, in our best Homer Simpson voices: “Mmm, caramel.”
Side note: Do you say car-mul? Or care-a-mell? Let us know in the comments! We’ll tally the results using advanced statistical methods.
Ours is a simple numeric approximation — via monte carlo methods — to the diffusion, “melting,” or stretching out of the probability of “wins” over time (time units in this case being discrete spin increments) — rather than via any formal PDE (Partial Differential Equation). As to whether the latter exists for roulette, we leave to the theorists for now. It would likely need to be a quantized difference equation, since the chips that we wager are valued in integers (you can’t bet a fraction of a chip), and the casino cares not about the state of the roulette wheel in between incremental (integer) spin stops.
For this update to our little roulette analyzer web site which analyzes ranges (related to volatility) of possible wins and not just long term expected probability values — sans the dramas experienced by old Alexis (see our prior articles and the source text itself) — we modded our site so that the viewer can easily download the monte carlo simulation data for a slice through the red+even probability surface (see again our prior articles) at various spin steps forward (in increments of 5 spins) for further analysis, and we added a feature to allow the constant probability flowlines to be drawn at the 1st and 99th percentiles and the 25th and 75th percentiles, forward in time, in addition to the 95th and 5th percentiles where they were drawn before… as we demonstrated in our previous articles.
68% of the data points will fall within one standard deviation of the average, or mean, data point
Gaming probabilities are oft presented as hard numbers, often as ratios, that the player tends to over long time periods, with (I think) the implication that the longer you play, the more likely you are to approach the theoretical probability. But this is not the case, as we show in our prior articles on this topic, and as the heat diffusion theme of all this demonstrates… the win payoff probability distribution widens over time, it does not narrow, for this particular game and wager. It does not approach the theoretical (“expected value”) probability asymptotically.
See Figure D below… over time, the win/loss probability range widens, it does not approach or zoom in on any constant number. Still, the common advice remains valid: The house always wins, over many players and over time. Let’s not get too crazy here.
Rules of thumb
50/50 is a bit easier to comprehend and can be modeled by coin flips, versus the 68/32 split of standard deviation thumb rules: 68% of values fall within +-1 standard deviation of the mean, and 32% fall outside that range (often split into 2 equal-ish parts, one on the low side and one on the high). If data is approximately normal, this means that you get 16% in the low tail and 16% in the high tail. You can approximate 68/32 by 66/33 which is 2/1. This is useful especially considering that “+- 1 standard deviation ~= 68.2%” is only exact to a high number of digits of precision if our data is precisely normally distributed, for large sample counts. So if we are going to approximate non-normal data with a normally distributed Gaussian form, then why not approximate 68/32 by 66/33? Thumb rules can get you far. The 66/33 thumb rule is not that far off from 68/32, right? We should be so lucky to be wrong only 1% or 2% of the time, in a first guess, with no computer involved.
Details
Note: Download (save) seems to work only on some browsers. This is a math modeling study, not a browser coding article. Try Chrome.
And then since we allow the user to change these model settings, we have added a button to allow re-runs of the monte carlo trials after each setting change using the Run MC button.
There are some other small changes internally in the html file to experiment with other types of wagers instead of our red+even example here, but we are not quite ready to demonstrate those yet. As before, you can see the code for this model using View Source in your browser; it is not mangled, compressed, spindled, or mutilated, but is plain Vanilla Javascript… the way Marc Andreessen intended it to be?
The 50/50 business is notable because there is a 50% chance to be in between the 25%ile and 75%ile curves, and a 50% chance to be outside of those curves as we move forward in spin-time… coin flip probabilities (50/50 chance) being a useful mental model and all.
Back to the real market
Here is an example of the now popular Nvidia stock forecasted 5 days ahead over a rolling backtest window of 1 year in our MCarloRisk3D [Note 1] application. Without any particular tuning, the default model setup seems to capture the weekly variance fairly well.
In the stock market realm, we use the 25%/75% bands in the exhaustive Validate backtester of our MCarloRisk3D application as useful checkpoints for the backtest to assess how well the model does in the mid-range (two central quartiles, += 25%) of forecasted deviations. Though these bands that we draw in the app may resemble other time series plots such as “Bollinger bands,” they are not those at all. Take care to avoid confusing the two concepts. With these models, we are only estimating ranges and probabilities into the future; we aren’t trying to forecast directional tendencies, “resistance” or any such “technical analysis” concepts.
Side note: If the stock market gurus have a concept of resistance, do they also have a concept of conductance, or permittivity? Now that I think of it, what the stock market gurus describe as resistance seems to act more like electromagnetic permittivity (loosely: how easy an electric or magnetic flow can leak out of an electric or magnetic conductor into free space or the air), or some sort of marshmallowy spring-like forcing function acting to contain the price within some boundaries. However, this being a story about random walks where none of these analogies apply, we demure further analysis in this direction for now.
The graph above is a backtest, and we use it to assess our price/probability model quality versus historical data. This NVDA model here is based upon I.I.D. resampling of actual historical return data in a rolling one year window and does not attempt to say — when an asset price is near or crosses an extreme “band” — that the asset will “bounce” back off of it in the opposite direction.
The Bollinger discussion reminds of one discussion between Alexis Ivanovitch and (not his) Grandmother in The Gambler:
“But, Madame, zero has only this moment turned up,” I remonstrated; “wherefore, it may not do so again for ever so long. Wait a little, and you may then have a better chance.” [← spoken by Alexis]
“Rubbish! Stake, please.” [← spoken by the Grandmother]
While the Grandmother’s risk tolerance was high [“Stake, please.”] and she did not fully comprehend the game as far as we know (after all, she was a novice), her response [Rubbish!]— which seems to imply that the prior turning up of zero on the wheel has no relationship as to whether it will turn up next — is correct from a statistical perspective. At least our inference of her statement is. She may just be dismissing her minder’s advice because she felt like it; on a каприз (caprice or whim), so to speak. But we shall give her a benefit of this doubt. There is no doubt, however, that Alexis’s analysis is incorrect… though it is logical if his going-in position is that random implies fairly evenly distributed. However, random does not imply evenly distributed, as we point out in our earlier Medium articles. There is clumping in pure randomness… and, maybe we should add: especially for low density conditions. And, knock me over with a feather, there is even a name for it, and it has nothing to do with fish. Though fish do tend to travel in schools sometimes, so… French mnemonic?
https://en.wikipedia.org/wiki/Poisson_clumping
Whether zero has recently turned up or not does not affect the probability of zero turning up again in the next spin, and the burst of roulette zeros that the Grandmother noticed (and which influenced her wagering strategy) seems to be one of these Poisson bursts. But I preach to the choir here.
Hence we see that it is logical for someone to assume that zero is less likely to come up in roulette if it has come up recently, IF the reasoner has the assumption that “random” means “somewhat evenly distributed.” It is logical, but not correct, because in point of observation, “random” does not imply evenly distributed. One can be logical yet also incorrect, especially in data analysis.
Similarly in our pure I.I.D. market models, whether an asset went up or down yesterday will have no influence as to whether it goes up or down today. In essence, by that above noted statement, fictional Alexis is suggesting (without stating it as such) that roulette samples (spins) are not I.I.D.
Our app does allow modifications to this simple model that do take some history into account (and violate I.I.D. sampling). See our story on one of these concepts at:
https://medium.com/@nttp/fractional-empirical-motion-in-monte-carlo-forecasts-5fe573ec32b3
Now it may be that the Grandmother noted a recent run of zeros and analyzed that the zero came up with higher probability recently than it did/does in long term reality, due to her limited time window of observation, viz:
“Why thirty-five times [payout], when zero so often turns up? And if so, why do not more of these fools stake upon it?”
So perhaps she did not think that she was risking so much if her analysis of the probabilities was indeed based upon only a short sequence of events; perhaps she did have a limited risk tolerance, but did not think that she was taking such a large risk. If she had known the real probabilities, she may not have been as eager to “stake.” This limited window of analysis is the downfall of many a modern investor as well. Year 2006: “Real estate cannot go down! It is recession safe!”
Note the increase in volatility over the last half year or so of Nvidia in Figure N above. The rolling window nature of our model (taking in only the most recent rolling year of data for model generation) seems to capture this heteroskedasticity well. We might attribute this increase in volatility to the ongoing debates (positive and negative; hence, volatility) on how generative A.I. will affect the market, knowing that Nvidia is heavily involved in making hardware that is used for A.I. Is it great tech but too expensive for what it does, or not useful enough versus the cost? Will A.I. hit a wall in terms of functionality and come up against intractable problems so that even throwing ever more compute hardware at those problems won’t solve them in the near term [see also: self driving cars]… excepting some unforeseen theoretical break-through?
Roulette, on the other hand, has constant payoff probabilities over time for given wagers if we assume a fair wheel. Note that we do not claim that it has a constant payoff. Payoff is often all over the map, as demonstrated by the light grey random walk line sample in our web site… constrained probabilistically by the volatility surface that our modeler generates.
Request to readers
As always, let us know if you see any errors in the code.
Notes
[Note 1] MCarloRisk3D and MCarloRisk applications (and lite versions of them) can be found variously on macOS, iOS, Google Play, and store.microsoft.com app stores and on the web at mcr3d.diffent.com. Though Google is giving us some hassle about updating to Android version “whip cream epsilon lyrae” or whatever the latest is, and telling us that they may take our apps off the store soon… so get it while you can, Droid fans! Unfortunately, we don’t have the resources to chase after the whims of large companies immediately.
[Note 2] The articles in this series should not be taken as giving out gaming advice.