## Posts

Showing posts from May, 2010

### Random walk oscillator

May 2017: This is from my other blog that's no longer online. The original comments are no longer available, but you are welcome to add more.Here's an experiment. Suppose I want to make a random walk that I can control, that doesn't wander aimlessly all over, but rather is attracted to zero. The attraction back to zero wouldn't act like a force that causes steps away from zero to become smaller in size; rather, steps toward zero are simply more probable further away from zero, regardless of the step size. I'll invent a random walk that does this. We generate random walk steps in a generalized way via some inverse cumulative distribution function (cdf), which could represent a gaussian, a black swan, binary ±1 steps, whatever. This inverse cdf, in turn, takes as an input a random probability p that's uniformly-distributed between 0 and 1. (If you want uniformly-distributed steps, the step size simply equals the input p, or a multiple of p.)We need to skew this u…

### Fake data part 3: Bypassing the central limit theorem

May 2017: This is from my other blog that's no longer online. The original comments are no longer available, but you are welcome to add more.Now that I have my black swan distribution, and I verified that it fits market returns remarkably well while being mathematically tractable, I want to use it to generate artificial market data. Generating a series of closing prices is easy. Select a starting price, take the logarithmSelect a mean μ and standard deviation σ of log returns ln(P0/P1) where P0 is the most recent price and P1 is the previous price.Generate a uniformly-distributed random probability p between 0 and 1. Plug it into the inverse black swan distribution (using a=1.6):
$$B^{-1}(p;\mu,s) = \mu - 2 s \, \sinh \left[\frac {\tanh^{-1}(1-2p)} {a} \right]$$Add the result to a running total.Go to step 3. Repeat as often as desired. Then simply calculate the antilog or exponential of the values in the running total to get prices.This works fine. But what if we want to generate …