Exemplo n.º 1
0
        public double Correlate(RangeStats range)
        {
            double r = 0;

            for (int i = 0; i < _range.Length; i++)
            {
                r += (_range[i] - Mean) * (range._range[i] - range.Mean);
            }

            r /= (_range.Length * QDx * range.QDx);

            return(r);
        }
Exemplo n.º 2
0
        public double SpearmansRankCorrelation(RangeStats range)
        {
            double res = 0;

            long n = _range.Length;

            for (int i = 0; i < n; i++)
            {
                int _r = _sortedRange.GetIndex(_range[i]);
                int r  = range._sortedRange.GetIndex(range._range[i]);
                res += Math.Pow(_r - r, 2);
            }



            return(1 - ((6 * res) / (n * (Math.Pow(n, 2) - 1))));
        }
Exemplo n.º 3
0
        public double CorrelatePirson(RangeStats range)
        {
            double r  = 0;
            double sx = 0;
            double sy = 0;

            for (int i = 0; i < _range.Length; i++)
            {
                var dx = _range[i] - Mean;
                var dy = range._range[i] - range.Mean;
                r  += dx * dy;
                sx += dx * dx;
                sy += dy * dy;
            }

            r /= (Math.Sqrt(sx * sy));

            return(r);
        }