예제 #1
0
        public int[] DropoutErrorsStud(double alphaMin, double alphaMax)
        {
            if (alphaMin == -1)
            {
                alphaMin = 0.001f;
            }
            if (alphaMax == -1)
            {
                alphaMax = 0.05f;
            }
            ArrayList listX           = new ArrayList(arrX);
            ArrayList listIndexIgnore = new ArrayList();

            while (true)
            {
                double min = double.MaxValue, max = double.MinValue;
                double sum = 0, sumXPow2 = 0;
                int    indexMin = -1, indexMax = -1;
                for (int i = 0; i < listX.Count; i++)
                {
                    if (listIndexIgnore.BinarySearch(i) >= 0)
                    {
                        continue;
                    }
                    double x = (double)listX[i];
                    if (x < min)
                    {
                        min      = x;
                        indexMin = i;
                    }
                    if (x > max)
                    {
                        max      = x;
                        indexMax = i;
                    }
                    sum      += x;
                    sumXPow2 += x * x;
                }
                int    n = listX.Count - listIndexIgnore.Count;
                double average = sum / n;
                double devStd = sumXPow2 / (n - 1) - (sum / (n - 1)) * (sum / (n - 1));
                double sigmaStd = (double)Math.Sqrt(devStd);
                double tauXMin, tauXMax;
                tauXMin = (double)Math.Abs(min - average) / sigmaStd;
                tauXMax = (double)Math.Abs(max - average) / sigmaStd;
                int    index;
                double tauMax;
                if (tauXMin >= tauXMax)
                {
                    index  = indexMin;
                    tauMax = tauXMin;
                }
                else
                {
                    index  = indexMax;
                    tauMax = tauXMax;
                }

                double tMin    = StatTables.GetStudDistrInv(listX.Count - 2, alphaMin);
                double tMax    = StatTables.GetStudDistrInv(listX.Count - 2, alphaMax);
                double critMin = tMin * (double)Math.Sqrt(listX.Count - 1) /
                                 (double)Math.Sqrt(listX.Count - 2 + tMin * tMin);
                double critMax = tMax * (double)Math.Sqrt(listX.Count - 1) /
                                 (double)Math.Sqrt(listX.Count - 2 + tMin * tMin);
                if (tauMax > critMin)
                {
                    listIndexIgnore.Add(index);
                    listIndexIgnore.Sort();
                }
                else
                {
                    break;
                }
            }
            return((int[])listIndexIgnore.ToArray(typeof(int)));
        }
예제 #2
0
        public void CheckHypothesises(double alpha)
        {
            // знач. регр.
            fishRegrTheor = StatTables.GetFishDistrInv(n - 1, n - p - 1, alpha);
            if (fishRegr > fishRegrTheor)
            {
                isRegrRepr = true;
            }
            else
            {
                isRegrRepr = false;
            }

            // знач. коэф. регр.
            studBTheor = StatTables.GetStudDistrInv(n - p - 1, alpha);
            arrIsBRepr = new bool[p + 1];
            for (int i = 0; i < arrIsBRepr.Length; i++)
            {
                if (arrStudB[i] > studBTheor)
                {
                    arrIsBRepr[i] = true;
                }
                else
                {
                    arrIsBRepr[i] = false;
                }
            }

            // знач. коэф. кор.
            studRxyTheor = StatTables.GetStudDistrInv(n - 2, alpha);
            arrIsRxyRepr = new bool[p];
            for (int i = 0; i < arrIsRxyRepr.Length; i++)
            {
                if (arrStudRxy[i] > studRxyTheor)
                {
                    arrIsRxyRepr[i] = true;
                }
                else
                {
                    arrIsRxyRepr[i] = false;
                }
            }

            // знач. множ. коэф. кор.
            studRTheor = StatTables.GetStudDistrInv(n - p - 1, alpha);
            if (studR > studRTheor)
            {
                isRReprStud = true;
            }
            else
            {
                isRReprStud = false;
            }

            fishRTheor = StatTables.GetFishDistrInv(n - p - 1, p, alpha);
            if (fishR > fishRTheor)
            {
                isRReprFish = true;
            }
            else
            {
                isRReprFish = false;
            }
        }