Exemplo n.º 1
0
        public double _Mizes(double[] v, Distribution _fun)
        {
            int N = v.Length;
            double[] F = new double[N];
            double Coef=0;
            for (int i = 0; i < N; i++)
            {
                Coef+=Math.Pow(((i-0.5)/N)-_fun.Function(v[i]),2);
            }   

            Coef+=1.0/(12*N);


            if (Coef < 0.3473)
                return 0.1;
            else if (Coef < 0.4614)
                return 0.95;
            else if (Coef < 0.7435)
                return 0.99;
            else if (Coef < 0.8694)
                return 0.995;
            else if (Coef < 1.1679)
                return 0.999;
            else
                return 0;
        }
Exemplo n.º 2
0
        public double _Pirson(double[] v, Distribution _fun)
        {
            int N = v.Length, _n = (int)((N > 100) ? 4 * Math.Log(N) : Math.Sqrt(N));

            int w = N / _n;
            double _p = 1.0 / w;
            double _EmpericalHi2 = 0;
            double Ai = y_b, Bi;

            for (int i = 0; i < _n; i++)
            {
                Bi = (double)(v[(int)(w * i)] + v[(int)(w * i) + 1]) / 2;
                double pi = _fun.Function(Bi) - _fun.Function(Ai);
                _EmpericalHi2 += Math.Pow((_p - pi), 2) / pi;
                Ai = Bi;
            }
            _EmpericalHi2 *= N;

            int j = hi2.Length - 1;
            while ((j != -1) && (hi2[j] < _EmpericalHi2))
                j--;
            if (j == -1)
                return 0;
            else
                return alphaHi2[j];
        }
Exemplo n.º 3
0
        public double _Colmogorov(double[] v,  Distribution _fun)
        {
            int N = v.Length;



            double[] F = new double[N];
            for (int i = 0; i < N; i++)
            {
                int w = 0;
                for (int j = 0; j < N; j++)
                    if (v[i] == v[j]) w++;

                F[i] = (double)w / N;
                if (i > 0) F[i] += F[i - 1];
            }



            double max=Math.Abs(_fun.Function(v[0])-F[0]), Bi;


            int k = 0;
            for (int i = 1; i < N; i++)
            {
                if (Math.Abs(_fun.Function(v[i]) - F[i])>max)
                {
                    max = Math.Abs(_fun.Function(v[i]) - F[i]);
                    //k = i;
                }
            }


            if (max < 0.248)
                return 0.95;
            else if (max < 0.2972)
                return 0.99;
            else
                return 0;
            




            
        }