/// <summary> /// Computes the rescaled range. /// </summary> public double Compute() { double rescaledRange = 0; if (_valueCollection.Count > 0) { BasicStat devStat = new BasicStat(); Interval cumulRange = new Interval(); double mean = _sum / _valueCollection.Count; double cumulDeviation = 0; for (int i = 0; i < _valueCollection.Count; i++) { devStat.AddSample(_valueCollection[i] - mean); cumulDeviation += _valueCollection[i] - mean; cumulRange.Adjust(cumulDeviation); } if (devStat.StdDev != 0) { rescaledRange = cumulRange.Span / devStat.StdDev; } } return(rescaledRange); }