Exemplo n.º 1
0
        public static ClimatData FDistribution(ClimatData data)
        {
            int n1 = data.Y1.Count;
            int n2 = data.Y2.Count;

            float closest = Table2_C.Aggregate((x, y) => Math.Abs(x - data.Asymmetry) < Math.Abs(y - data.Asymmetry) ? x : y);
            float g       = 0;

            for (int i = 0; i < Table2_C.Count; i++)
            {
                if (Table2_C[i] == closest)
                {
                    g = Table2_G[i];
                }
            }

            data.FDistribution1 = (n1 * g)
                                  / ((1 + (2 * (float)Math.Pow(data.Asymmetry, 2)) * (1 - (float)Math.Pow(data.Asymmetry, 2)))
                                     * (1 - (1 - (float)Math.Pow(data.Asymmetry, 2 * n1)) / (n1 * (1 - (float)Math.Pow(data.Asymmetry, 2)))));
            data.FDistribution2 = (n2 * g)
                                  / ((1 + (2 * (float)Math.Pow(data.Asymmetry, 2)) * (1 - (float)Math.Pow(data.Asymmetry, 2)))
                                     * (1 - (1 - (float)Math.Pow(data.Asymmetry, 2 * n2)) / (n2 * (1 - (float)Math.Pow(data.Asymmetry, 2)))));

            return(data);
        }
Exemplo n.º 2
0
        public static ClimatData TDistribution(ClimatData data)
        {
            int n = data.Y.Count;

            data.TDistribution = data.Autocorrelation * (float)Math.Sqrt(n - 2) / (float)Math.Sqrt(1 - (float)Math.Pow(data.Autocorrelation, 2));

            return(data);
        }
Exemplo n.º 3
0
        public static ClimatData Grubbs(ClimatData data)
        {
            int n = data.Y.Count - 1;

            data.GrubbsN = (data.Y[n] - data.Y.Average()) / data.Deviation;
            data.Grubbs1 = (data.Y.Average() - data.Y[0]) / data.Deviation;

            return(data);
        }
Exemplo n.º 4
0
        public static ClimatData Student(ClimatData data)
        {
            int n1 = data.Y1.Count;
            int n2 = data.Y2.Count;

            data.Student = (data.Y1.Average() - data.Y2.Average()) / (float)Math.Sqrt(n1 * data.Variance1 + n2 * data.Variance2)
                           * (float)Math.Sqrt((n1 * n2 * (n1 + n2 - 2)) / (n1 + n2));

            return(data);
        }
Exemplo n.º 5
0
        public static ClimatData Dixon(ClimatData data)
        {
            int n = data.Y.Count - 1;

            data.DixonN.Add((data.Y[n] - data.Y[n - 1]) / (data.Y[n] - data.Y[0]));
            data.DixonN.Add((data.Y[n] - data.Y[n - 1]) / (data.Y[n] - data.Y[1]));
            data.DixonN.Add((data.Y[n] - data.Y[n - 2]) / (data.Y[n] - data.Y[1]));
            data.DixonN.Add((data.Y[n] - data.Y[n - 2]) / (data.Y[n] - data.Y[2]));
            data.DixonN.Add((data.Y[n] - data.Y[n - 2]) / (data.Y[n] - data.Y[0]));

            data.Dixon1.Add((data.Y[0] - data.Y[1]) / (data.Y[0] - data.Y[n]));
            data.Dixon1.Add((data.Y[0] - data.Y[1]) / (data.Y[0] - data.Y[n - 1]));
            data.Dixon1.Add((data.Y[0] - data.Y[2]) / (data.Y[0] - data.Y[n - 1]));
            data.Dixon1.Add((data.Y[0] - data.Y[2]) / (data.Y[0] - data.Y[n - 2]));
            data.Dixon1.Add((data.Y[0] - data.Y[2]) / (data.Y[0] - data.Y[n]));

            return(data);
        }
Exemplo n.º 6
0
        public static ClimatData Asymmetry(ClimatData data)
        {
            int n = data.Y.Count;

            data.Asymmetry = 0;

            for (int i = 0; i < n; i++)
            {
                //data.Asymmetry += (float)Math.Pow((data.Y[i] / data.Y.Average()) - 1, 3);
                data.Asymmetry += (float)Math.Pow(data.Y[i] - data.Y.Average(), 3);
            }

            data.Asymmetry /= n * (float)Math.Pow(data.Deviation, 3);

            //data.Asymmetry *= n;

            //data.Asymmetry /= (float)Math.Pow(data.Deviation / data.Y.Average(), 3) * (n - 1) * (n - 2);

            return(data);
        }
Exemplo n.º 7
0
        public static ClimatData Deviation(ClimatData data)
        {
            int n = data.Y.Count;

            data.Variance = 0;

            for (int i = 0; i < n; i++)
            {
                data.Variance += (float)Math.Pow(data.Y[i] - data.Y.Average(), 2);
            }

            data.Variance /= n - 1;

            data.Deviation = (float)Math.Sqrt(data.Variance);

            int n1 = data.Y1.Count;
            int n2 = data.Y2.Count;

            data.Variance1 = 0;
            data.Variance2 = 0;

            for (int i = 0; i < n1; i++)
            {
                data.Variance1 += (float)Math.Pow(data.Y1[i] - data.Y1.Average(), 2);
            }

            data.Variance1 /= n1 - 1;

            for (int i = 0; i < n2; i++)
            {
                data.Variance2 += (float)Math.Pow(data.Y2[i] - data.Y2.Average(), 2);
            }

            data.Variance2 /= n2 - 1;

            data.Deviation1 = (float)Math.Sqrt(data.Variance1);
            data.Deviation2 = (float)Math.Sqrt(data.Variance2);

            return(data);
        }
Exemplo n.º 8
0
        public static ClimatData Autocorrelation(ClimatData data)
        {
            int n = data.Y.Count;

            float Y_Average1 = 0, Y_Average2 = 0;

            for (int i = 0; i < n - 1; i++)
            {
                Y_Average1 += data.Y[i] / (n - 1);
                Y_Average2 += data.Y[i + 1] / (n - 1);
            }

            float Deviation1 = 0, Deviation2 = 0;

            for (int i = 0; i < n - 1; i++)
            {
                Deviation1 += (float)Math.Pow(data.Y[i] - data.Y.Average(), 2);
                Deviation2 += (float)Math.Pow(data.Y[i + 1] - data.Y.Average(), 2);
            }

            Deviation1 /= n - 2;
            Deviation2 /= n - 2;
            Deviation1  = (float)Math.Sqrt(Deviation1);
            Deviation2  = (float)Math.Sqrt(Deviation2);

            data.Autocorrelation = 0;

            for (int i = 0; i < n - 1; i++)
            {
                data.Autocorrelation += (data.Y[i] - Y_Average1) * (data.Y[i + 1] - Y_Average2);
            }

            data.Autocorrelation /= n * Deviation1 * Deviation2;

            return(data);
        }
Exemplo n.º 9
0
        public static ClimatData Fisher(ClimatData data)
        {
            data.Fisher = data.Variance1 / data.Variance2;

            return(data);
        }