Available on all platforms
This function pushes onto the stack a kernel smoothing mapper using a triweight kernel.
The mapper applies the Nadaraya-Watson kernel-weighted average algorithm.
The function expects on top of the stack a bandwidth expressed as an odd number of ticks and below it a step expressed in time units. The step parameter is used to determine the distance of a tick from the tick being computed to feed it into the kernel. The bandwidth in time units is the bandwidth in ticks times the step.
NEWGTS 'random walk' RENAME
0.0 'i' STORE
1 1000 <% NaN NaN NaN $i RAND 0.5 - + DUP 'i' STORE ADDVALUE %> FOR
// Pseudo radius of the kernel (the kernel really has a diameter of 2 * radius + 1 steps)
8 'radius' STORE
// Number of time units per radius unit
1 'step' STORE
[ SWAP $step $radius 2 * 1 + mapper.kernel.triweight $radius $radius 0 ] MAP 0 GET