walk-z
v3.0.1
Published
approximation of a random walk time serie
Downloads
20
Maintainers
Readme
walk-z
approximation of a random walk where any point in time can be reached without recursion
• Introduction • API • License •
Introduction
Made for when a full time-serie is required for a given simulation. Past values are retained to provide new random values that are consistent with previously returned pasts and futures.
This is not a true random walk but a simulation for simulations. You probably don't need this. Use with caution.
Like a random walk:
E( y(t) ) = 0
V( y(t) ) = t
Cov( y(t), y(t+1) ) = 1
Shift and scale the results as required
API
The factory function usually takes no parameters and returns a random time serie.
var WalkZ = require('walk-z')
var walker = WalkZ()
var positionAtTime100 = walker(100)
var positionAtTime200 = walker(200)
var positionAtTime2 = walker(2)
For testing or for generating correlated curves, an option normal unit distribution seed ( -inf < x < +inf) can be provided:
var WalkZ = require('walk-z')
var walker = WalkZ()
//randomZ is a function that takes no parameter and returns a unit normal distribution
var positionAtTime3 = walker(3, randomZ())
License
Released under the MIT License