예제 #1
0
        /// <summary>
        /// Computes the statistics of the differences of the data in the window.
        /// </summary>
        /// <param name="reqNumOfSamples">The requiered mumber of samples (-1 means all).</param>
        public BasicStat GetDataDiffStat(int reqNumOfSamples = -1)
        {
            int numOfSamplesToBeProcessed = reqNumOfSamples == -1 ? _dataQueue.Count : reqNumOfSamples;

            CheckReadyness(numOfSamplesToBeProcessed);
            BasicStat stat = new BasicStat();

            for (int i = numOfSamplesToBeProcessed - 2; i >= 0; i--)
            {
                stat.AddSample(_dataQueue.GetElementAt(i, true) - _dataQueue.GetElementAt(i + 1, true));
            }
            return(stat);
        }
예제 #2
0
        /// <summary>
        /// Computes the error statistics of Y values (computedY - sampleY).
        /// </summary>
        public BasicStat ComputeRegressionErrStat()
        {
            ComputeRegression();
            BasicStat errStat = new BasicStat();

            if (_pointCollection.Count > 0)
            {
                foreach (FnPoint point in _pointCollection)
                {
                    double regrY = _a * point.X + _b;
                    errStat.AddSample(Math.Abs(regrY - point.Y));
                }
            }
            return(errStat);
        }