# The Naked Scientists Forum

### Author Topic: How do we forecast the stock market and water cycles?  (Read 2167 times)

#### Chondrally

• Jr. Member
• Posts: 36
##### How do we forecast the stock market and water cycles?
« on: 31/12/2014 20:45:57 »

Stock Forecasting and American Option pricing compared to Black- Scholes(BS) using Bayesian Markov Monte Carlo Simulation and Wavelet or Fourier or Neural Network Extrapolation with Indicators.

Author

Richard Belshaw

URL:  http://Mitochondrally.org [nofollow]

Revision date

2014-11-21

Description

All the relevant indicators are displayed for a timely and a long or short term investment decision based on the probability of success both in terms of the most probable path into the future and in terms of all paths into the future. In that sense this is a path integration technique that employs Bayesian and Markov thinking with a multi path Monte Carlo simulation. Alternatively Wavelet Extrapolation or Fourier Extrapolation or Neural Network training and extrapolation are also employed. Novelly, the Nets use no backpropagation and when they work they find the phase, amplitude and frequency of the main cycles more accurately than backpropagation (they find a better global minimum solution). They work about 90% of the time, and need to be rerun until the output makes sense. You will generally get slightly varying local minima each time so expect the answer to be a bit different each time from the neural nets. The probable answer and confidence limits are always unequivocal for the monte carlo simulation (the blue path and red confidence limits). The Wavelet and Fourier extropolations are also unequivocal. To Train the nets set optionflag=1 and the program will save the weights in OutOptions2.txt in the directory of your choice. To run the program once the weights are trained for different spot prices and expiry dates or different inflation or interest rates or dividend rates, set optionflag=0. If you do not wish to use the neural nets set optionflag= negative one=-1 for just the Bayesian Markov Monte Carlo Simulation or set optionflag =2 for the path Simulation and Fourier Extrapolation. If optionflag=3, the default ,the most accurate representation is with a wavelet extrapolation and discretewavelettransform using Biorthogonalsplinewavelet[4,2] as the default. The simulation is also carried out for comparison purposes and full statistical analysis of all paths. If you wish to see the progress of the evaluation set debugflag=1. Alternatively set debugflag=0 which is the default and runs slightly faster. Without the neural nets the program evaluates in 2-3 minutes depending on the length of time to expiration of the option, the lookback period and the time to expiry of the option. With the neural nets it runs in under 11 minutes on a modern PC. 3GHz intel 7 processor with 4 cores. If catastropheflag =1, a multi hour computation is carried out on an ETF or index like the "SP500" to determine the daily probability of level crossing into the future. The levels are the ratio of the next day to the previous day price. and the images are the probability of crossing the level per day with ratios of.4,.5,.6,.7,.8,.9 and also 1.1,1.2,1.3,1.4,1.5,1.6 this can take up to a 9 hours to compute. Normally catastropheflag must be set to zero for normal stock analysis. It can be run on a supercomputer to really speed things up.The simulation can be parallized if that is wished but would take a bit of work. the key routines involved would be generateMagPhase , calculateFutureValues and CalculateConfLevels and NeuralNet1. Because of the different and varied results offered by the neural nets and that they fail some of the time, no evaluation of the option price is based on them. The unequivocal answers of the Monte Carlo simulation and the confidence limits of between 1000 and 4096 or more paths into the future are calculated and the results are reliable. Also so are the Wavelet and Fourier extrapolation (optionflag =3 and optionflag=2 respectively). and option values are calculated on the wavelet and fourier results aswell. These can be compared with the Black-Scholes calculation shown at the bottom of each output panel. Periodicities in the time series are not well predicted by the Monte Carlo Simulation, however theWavelet Extrapolation and Fourier Extrapolation and Neural Nets do a good job of predicting the lows and the highs. The nets are reliable enough to be included for the expert to evaluate and the Wavelet and Fourier results are yielded everytime. The expert can make a rational judgment about the nature of the periodicities (phase, amplitude and frequency) of the cycles in the time series. To get Wavelet extrapolation, Fourier Extrapolation Neural Nets and Bayesian Markov Path integration use OptionsHospitality3Alpha11.nb you will need the Wavelet module available in Mathematica for this. To use the program without wavelet module, but with fourier extrapolation and neural nets aswell as the Bayesian Markov Monte Carlo Path Integration, use OptionsHospitality3alpha9.nb OTHER AUTHORS: Michael Kelly helped debug the intial code. The idea and concept and design are the original authors. Algorithms adapted from 'Interpolation and Extraplotion Using High-Resolution DFT' by Saachi et al. and input from Sornette et al were used in evaluating the extreme values of a distribution with fat tails.

http://library.wolfram.com/infocenter/MathSource/9086/ [nofollow]

http://www.mathworks.com/matlabcentral/fileexchange/56352-bayesian-markov-stochastic-monte-carlo-path-integral-american-option-pricing-with-kelly-criterion [nofollow]

http://www.mathworks.com/matlabcentral/fileexchange/56446-bayesian-markov-stochastic-monte-carlo-valuation-of-integrated-price-volume-action-with-kelly-crit [nofollow]
« Last Edit: 19/04/2016 22:59:07 by Chondrally »

#### alancalverd

• Global Moderator
• Neilep Level Member
• Posts: 4721
• Thanked: 155 times
• life is too short to drink instant coffee
##### Re: How do we forecast the stock market and water cycles?
« Reply #1 on: 01/01/2015 00:00:24 »
So?

#### Chondrally

• Jr. Member
• Posts: 36
##### Re: How do we forecast the stock market and water cycles?
« Reply #2 on: 01/01/2015 00:23:23 »
Water cycles in the atmosphere are notoriously difficult if not impossible to predict.  So is the stock market.
I have developed a mathematical toolkit that allows both to be described and forecast.  Especially the Bayesian Markov Monte Carlo Simulation and path integration for water cycles and confidence limits so that long term water trends can be forecast in the atmosphere.  I believe up until now,  the toolkit has been inadequate and old fashioned and not reliable or accurate enough to get the long term trends or averages.

#### alancalverd

• Global Moderator
• Neilep Level Member
• Posts: 4721
• Thanked: 155 times
• life is too short to drink instant coffee
##### Re: How do we forecast the stock market and water cycles?
« Reply #3 on: 01/01/2015 10:10:36 »
Great! Never mind trends and averages:

Does your water cycle toolkit suggest the historic sharp rise and slow fall of temperature on a 500,000 year cycle? It's fairly easy to establish a short-term fourier synthesis of the inherent nonlinearity of atmospheric water content under constant insolation, but I haven't been able to account for phase changes, or model their persistence, with a simple spreadsheet.

The historic outcome is a bounded, chaotic sawtooth. If you can obtain that with reasonable input assumptions, you may well have explained climate change and hopefully derived its boundaries.

#### Chondrally

• Jr. Member
• Posts: 36
##### Re: How do we forecast the stock market and water cycles?
« Reply #4 on: 11/08/2015 21:17:28 »
Because of Chaos Theory and Nonlinear Dynamical Systems Theory,  the lyapunov exponents of a phase change in effectively an infinite amount of water molecules at effectively infinitely different temperatures and pressures and densities, makes the quantum wavefunction impossible to calculate and hence predict.  Small changes in initial conditions can lead to beneficial avalanches or collapses of the wavefunction,  and so whatever phase change occurred globally 500,000 years ago that we can not get direct measurements of and quantum mechanics only allows the uncertainty principle in measurements anyway, and there is General Relativity and all of pharticle physics,  that posits that spontaneous appearance of matter and energy from the void are possible at any region of spacetime in history recorded or not.  Asking if we can predict all of climate change is too tall an order. The Black Swan and Black Dog and a bad day at Black Rock exist  and the black swan proves that thick tailed distributions exist and may not be known apriori because the events are too rare to build up knowledge of the thick probability distribution tail; Why mathematics cannot predict a dust devil in its reality, even today?

Fluid Companionship

From the window up on high, the edge of the wind wafts past in wave fronts of rain
like wind in the long grass, flowing, alternating shades of green
like sand collapsing to consume itself or so it seems.
like water coursing, etching patterns never to be seen.
like dust devils , coalescing, dancing, darting, dispersing.
like a campfire, shifting, shining, reaching for the sky.
from the window, warm and protected,
like dreams.

Sound Overture
From up in the tree, open space, breathing

each leafs sway heard amidst the others

water droplets sploshing in the rain barrel from the eavestrough

fire logs popping and sap fizzing and spitting

sand slithering and swooshing, tripping over itself

wind howling and whistling and rustling the grass

a cacophony of insects, buzz, whir and bump

in the garden, open, vulnerable and aware

of the river gurgling and chortling past gently, mesmerizingly

like a mid-summer afternoon's overture

completely transcending white noise

WARM IMAGES ENTWINED

How the forest must cry upon her skirts
as the night shadows efface here glimmerings of truth.
How she must yearn to bask once more her silken
boughs amidst the breeze of beauty
rather than huddle and quiver in the darks
wrenching and jelling torrents of wind.

At last the moment of the sun inundates and melts away
forever the glacial consolidation of frightened branches
frozen statuesquely in mock pity of one the other;
now, fluid like,  they untangle and entwine themselves as lovers
in a mutual embrace to discover they have loved one another.

Staring in mirrored shock,  the revelation exalts anew
and shatters timelessly the hatred lurking within,
letting it dissipate.  For love brings rebirth,
prying open the shutters to a new world and warm images.

Tony Hancock,Sid James and Bill Kerr , BBC's Hancock's Half Hour on Youtube:The Poetry Society,Carry on Singing
Sometimes you just have to p in a corner!
« Last Edit: 17/08/2015 18:22:36 by Chondrally »

#### PmbPhy

• Neilep Level Member
• Posts: 2762
• Thanked: 38 times
##### Re: How do we forecast the stock market and water cycles?
« Reply #5 on: 12/08/2015 04:24:08 »
Chondrally - The only thing those things do is calculate probabilities, and not very well at that.

#### alancalverd

• Global Moderator
• Neilep Level Member
• Posts: 4721
• Thanked: 155 times
• life is too short to drink instant coffee
##### Re: How do we forecast the stock market and water cycles?
« Reply #6 on: 12/08/2015 07:45:06 »
How do we forecast the stock market and water cycles?

I think the phrase you are looking for is "we can't".

#### PmbPhy

• Neilep Level Member
• Posts: 2762
• Thanked: 38 times
##### Re: How do we forecast the stock market and water cycles?
« Reply #7 on: 12/08/2015 16:14:30 »
Quote from: alancalverd
I think the phrase you are looking for is "we can't".
Not really. The term forecast means to indicate as likely to occur and we can certainly do that. That's why I said that it's all probability. We forecast the weather and when we do that we're talking about what's likely to happen, not what "will" happen.

#### The Naked Scientists Forum

##### Re: How do we forecast the stock market and water cycles?
« Reply #7 on: 12/08/2015 16:14:30 »