Example #1
0
        public static double Predict(List <Double> values, int accuracy)
        {
            double epsilon = Normal.Sample(0.0, values.StandardDeviation());
            double X       = epsilon + MAPredictor.Predict(values, accuracy) + ARModel(values, 2);

            return(X);
        }
Example #2
0
        public static List <Double> PredictList(List <Double> values, int accuracy)
        {
            List <Double> result    = new List <Double>();
            int           parameter = 2;

            double[]      coefficients = GetCoefficients(values, parameter);
            List <Double> maModel      = MAPredictor.PredictList(values, accuracy);

            for (int i = 0; i < values.Count; i++)
            {
                double epsilon = Normal.Sample(0.0, values.StandardDeviation());
                double sum     = 0;
                for (int j = 0; j < parameter; j++)
                {
                    if (i >= parameter)
                    {
                        sum += values[i - j] * coefficients[parameter - j - 1];
                        sum += sum == 0 ? 0 : 490;
                    }
                    else
                    {
                        sum = values[i];
                        break;
                    }
                }
                result.Add(epsilon + (sum + maModel[i]) / 2.0);
            }

            return(result);
        }
Example #3
0
        public double?PredictValue(List <Double> values, int accuracy)
        {
            double?predictedValue = null;

            switch (Type)
            {
            case (PredictorTypes.MA):
                predictedValue = MAPredictor.Predict(values, accuracy);
                break;

            case (PredictorTypes.ARMA):
                predictedValue = ARMAPredictor.Predict(values, accuracy);
                break;

            case (PredictorTypes.SSA):
                predictedValue = SSAPredictor.Predict(values, accuracy);
                break;
            }

            return(predictedValue);
        }