anchor.diff:          // invariant: all values in deque are strictly ascending (min) or descending (max)
           i := !i + 1        
           match v with
  -        | Some x -> 
  -          // get rid of all obs that fell out of moving window
  +        | OptionalValue.Present x -> 
  +          // remove from front any values that fell out of moving window
             while q.Count > 0 && !i >= fst q.[0] do q.RemoveFront() |> ignore
  -          // remove any values >= current obs
  +          // remove from back any values >= (min) or <= (max) compared to current obs
             while q.Count > 0 && (cmp (snd q.[q.Count - 1]) x) do q.RemoveBack() |> ignore
  -          // append new obs
  +          // append new obs to back
             q.AddBack( (!i + winSz, x) )
  -          // return min value
  +          // return min/max value at front
             snd q.[0]
  -        | None -> 
  +        | OptionalValue.Missing -> 
             if q.IsEmpty then nan else snd q.[0] }
   
     // moving window functions
   
     let movingCount winSz (series:Series<'K, float>) : Series<'K, float> =
  -    applyMovingStatsTransform 0 winSz (fun s -> s.nobs) series
  +    applyMovingSumsTransform 0 winSz (fun s -> s.nobs) series
   
     let movingSum winSz (series:Series<'K, float>) : Series<'K, float> =
  -    applyMovingStatsTransform 1 winSz (fun s -> s.sum) series
  +    applyMovingSumsTransform 1 winSz (fun s -> s.sum) series
   
     let movingMean winSz (series:Series<'K, float>) : Series<'K, float> =
  -    applyMovingStatsTransform 1 winSz (fun s -> s.sum / s.nobs) series
  +    applyMovingSumsTransform 1 winSz (fun s -> s.sum / s.nobs) series
   
     let movingVariance winSz (series:Series<'K, float>) : Series<'K, float> =
  -    applyMovingStatsTransform 2 winSz variance series
  +    applyMovingSumsTransform 2 winSz variance series
   
     let movingStdDev winSz (series:Series<'K, float>) : Series<'K, float> =
  -    applyMovingStatsTransform 2 winSz (variance >> sqrt) series
  +    applyMovingSumsTransform 2 winSz (variance >> sqrt) series
   
     let movingSkew winSz (series:Series<'K, float>) : Series<'K, float> =
  -    applyMovingStatsTransform 3 winSz skew series
  +    applyMovingSumsTransform 3 winSz skew series
   
     let movingKurt winSz (series:Series<'K, float>) : Series<'K, float> =
  -    applyMovingStatsTransform 4 winSz kurt series 
  +    applyMovingSumsTransform 4 winSz kurt series 
   
     let movingMin winSz (series:Series<'K, float>) : Series<'K, float> =
       applySeriesProj (movingMinMaxHelper winSz (>=)) series
  
positive.code:       if w.nobs < 3.0 then nan else
          let adjust = (sqrt (w.nobs * (w.nobs - 1.0))) / (w.nobs - 2.0)
          adjust * (sqrt w.nobs) * w.M3 / (w.M2 ** 1.5) 
      applyExpandingStatsTransform toEstSkew series
  
    let expandingKurt (series:Series<'K, float>) : Series<'K, float> =
      // population -> sample estimate
  
negative.code:   // expanding window functions
  
    let expandingCount (series:Series<'K, float>) : Series<'K, float> =
      applyExpandingMomentsTransform (fun w -> w.nobs) series
  
    let expandingSum (series:Series<'K, float>) : Series<'K, float> =
      applyExpandingMomentsTransform (fun w -> w.sum) series
  
    let expandingMean (series:Series<'K, float>) : Series<'K, float> =
      applyExpandingMomentsTransform (fun w -> w.M1) series
  
    let expandingVariance (series:Series<'K, float>) : Series<'K, float> =
      let toVar w = w.M2 / (w.nobs - 1.0)
      applyExpandingMomentsTransform toVar series
  
    let expandingStdDev (series:Series<'K, float>) : Series<'K, float> =
      let toStdDev w = w.M2 / (w.nobs - 1.0) |> sqrt
      applyExpandingMomentsTransform toStdDev series
  
    let expandingSkew (series:Series<'K, float>) : Series<'K, float> =
      // population -> sample estimate    
  