walk-z

3.0.1 • Public • Published

walk-z

approximation of a random walk where any point in time can be reached without recursion

IntroductionAPILicense

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

Package Sidebar

Install

npm i walk-z

Weekly Downloads

9

Version

3.0.1

License

MIT

Unpacked Size

7.22 kB

Total Files

9

Last publish

Collaborators

  • hugov