Ejemplo n.º 1
0
        private double GetR(IIrtRegression regression, bool includeOutliers)
        {
            var r = IrtRegression.R(regression);

            if (!double.IsNaN(r))
            {
                return(r);
            }
            var pointSet = !includeOutliers?RegularPoints.ToArray() : RegularPoints.Concat(OutlierPoints).ToArray();

            var statsX = new Statistics(pointSet.Select(point => point.X));
            var statsY = new Statistics(pointSet.Select(point => point.Y));

            return(statsY.R(statsX));
        }
Ejemplo n.º 2
0
        public void getAllPoints()
        {
            if (!Initialized)
            {
                return;
            }
            List <float>           x = getVectorByName(TS_anomalyFlight, Selected);
            List <float>           y = getVectorByName(TS_anomalyFlight, Correlated[Selected]);
            Tuple <string, string> p = new Tuple <string, string>(Selected, Correlated[Selected]);
            float x_min = x.Min();
            float x_max = x.Max();

            if (currentLinePlaying % 300 == 0 && currentLinePlaying != 0)
            {
                this.regularPoint.Clear();
                this.AnomalyPoints.Clear();
                for (int i = currentLinePlaying - 300; i < currentLinePlaying; i++)
                {
                    KeyValuePair <float, float> point = new KeyValuePair <float, float>(x[i], y[i]);
                    if (Anomalys.ContainsKey(p) && Anomalys[p].Contains(i))
                    {
                        AnomalyPoints.Add(point);
                    }
                    else
                    {
                        RegularPoints.Add(point);
                    }
                }
            }
            // add linear reg line:
            if (!Switched)
            {
                linearReg.Clear();
                if (lin_reg_eq.ContainsKey(p))
                {
                    Tuple <float, float> current = lin_reg_eq[p];
                    float a     = current.Item1;
                    float b     = current.Item2;
                    float y_min = a * x_min + b;
                    float y_max = a * x_max + b;
                    linearReg.Add(new KeyValuePair <float, float>(x_min, y_min));
                    linearReg.Add(new KeyValuePair <float, float>(x_max, y_max));
                }
            }
        }