public LinearRegression(List <double> _xData, List <double> _yData, double _alpha)
        {
            xData   = _xData;
            yData   = _yData;
            xavg    = StatCharacteristicModel.Average.GetAverage(xData);
            yavg    = StatCharacteristicModel.Average.GetAverage(yData);
            alpha   = _alpha;
            quantil = Quantiles.t_Student(1 - alpha / 2, N - 2);

            CalculateScores();
            DeterminationCoef = new DetermCoef(this, alpha);
        }
예제 #2
0
            public DependendAverageHomogeneition(List <double> firstSequence, List <double> secondSequence)
            {
                List <double> zSelection = firstSequence.Zip(secondSequence, (x, y) => x - y).ToList();

                var N     = zSelection.Count;
                var zAvg  = StatCharacteristicModel.Average.GetAverage(zSelection);
                var sigma = NormalDistribution.GetSigmaScore(zSelection);

                Statistic = zAvg * Math.Sqrt(N) / sigma;
                Statistic = double.IsNaN(Statistic) ? 0 : Statistic;

                Quantil = Quantiles.t_Student(1 - alpha / 2, N - 1);
            }
예제 #3
0
            public IndependendAverageHomogeneition(List <double> firstSequence, List <double> secondSequence)
            {
                int N1 = firstSequence.Count;
                int N2 = secondSequence.Count;

                double d1 = NormalDistribution.GetDispersion(firstSequence);
                double d2 = NormalDistribution.GetDispersion(secondSequence);

                double avg1 = StatCharacteristicModel.Average.GetAverage(firstSequence);
                double avg2 = StatCharacteristicModel.Average.GetAverage(secondSequence);

                Quantil = Quantiles.t_Student(1 - alpha / 2, N1 + N2 - 2);

                if (N1 + N2 > 25)
                {
                    Statistic = (avg1 - avg2) / Math.Sqrt(d1 / N1 + d2 / N2);
                }
                else
                {
                    Statistic = ((avg1 - avg2) / Math.Sqrt(((N1 - 1) * d1 + (N2 - 1) * d2) / N1 + N2 - 2)) * Math.Sqrt(N1 * N2 / (N1 + N2));
                }

                Statistic = double.IsNaN(Statistic) ? 0 : Statistic;
            }
예제 #4
0
 public override double GetQuantil()
 {
     return(Quantiles.t_Student(1 - alpha / 2, N - 2));
 }
예제 #5
0
        public ParabolicRegression(List <double> _xData, List <double> _yData, double _alpha)
        {
            alpha = _alpha;
            xData = _xData;
            xavg  = StatCharacteristicModel.Average.GetAverage(xData);

            yData = _yData;
            yavg  = StatCharacteristicModel.Average.GetAverage(yData);

            xDataPow2 = xData.Select(d => d * d).ToList();
            xPow2avg  = StatCharacteristicModel.Average.GetAverage(xDataPow2);

            xDataPow3 = xData.Select(d => d * d * d).ToList();
            xPow3avg  = StatCharacteristicModel.Average.GetAverage(xDataPow3);

            xDataDisp  = StatCharacteristicModel.StandartDeviationSkew.GetValue(xData);
            xDataDisp *= xDataDisp;

            phi0    = 1;
            quantil = Quantiles.t_Student(1 - alpha / 2, N - 3);

            var a = yavg;
            var b = GetB();
            var c = GetC();

            restDisp = RestDisp(a, b, c);

            A = new ParabolicalScoreA(restDisp, N)
            {
                Name = "a0", Value = a, Quantil = quantil
            };

            var xSd = StatCharacteristicModel.StandartDeviationSkew.GetValue(xData);

            B = new ParabolicalScoreB(restDisp, N, xSd)
            {
                Name = "a1", Value = b, Quantil = quantil
            };

            var phi2Pow2Sum = xData.Sum(x => Math.Pow(Phi2(x), 2));

            C = new ParabolicalScoreC(restDisp, N, phi2Pow2Sum)
            {
                Name = "a2", Value = c, Quantil = quantil
            };

            A.Dispersion = restDisp / N;
            B.Dispersion = restDisp / (N * xDataDisp);
            C.Dispersion = restDisp / phi2Pow2Sum;

            var regressionY = xData.Select(xi => Calculate(xi)).ToList();

            regressionYavg = StatCharacteristicModel.Average.GetAverage(regressionY);

            Scores = new List <RegressionScore>();
            Scores.Add(A);
            Scores.Add(B);
            Scores.Add(C);

            DeterminationCoef = new DetermCoef(this, alpha);
        }