コード例 #1
0
ファイル: ACFModel.cs プロジェクト: lulzzz/ARIMA
        public virtual DistributionSummary GetCurrentPredictor(DateTime futureTime)
        {
            var ds = new DistributionSummary {
                Mean = realTimePredictor.CurrentPredictor, Variance = realTimePredictor.CurrentMSPE
            };

            return(ds);
        }
コード例 #2
0
ファイル: ACFModel.cs プロジェクト: lulzzz/ARIMA
        ///<summary>
        /// This function computes predictive means (one-step, two-step, ...)
        /// along with the predictive mean-squared error.  It
        /// assumes that data is regularly spaced in time.
        ///</summary>
        ///<param name="startData">existing data that we assume comes from the model</param>
        ///<param name="futureTimes">times in the future</param>
        ///<returns></returns>
        private TimeSeriesBase <DistributionSummary> GetForecasts(TimeSeries startData, IList <DateTime> futureTimes)
        {
            // now do forecasting, using the standard Durbin-Levison Algorithm
            int nobs    = startData.Count;
            int horizon = futureTimes.Count;

            // Numerically stable approach: use innovations algorithm if possible
            double[] nus;
            double[] forecs;
            ComputeSpecialResiduals(startData, out nus, horizon, out forecs);

            //// now compute MSEs of 1...horizon step predictors
            //// compute psis in causal expansion,
            //// by phi(B) (1-B)^d psi(B) = theta(B) and match coefficients
            // Vector psis = ComputePsiCoefficients(horizon);
            var psis = Vector <double> .Build.Dense(horizon + 1);

            // Use approximation (B&D eqn (5.3.24)) as before to get predictive variances
            var localFmse = Vector <double> .Build.Dense(horizon);

            localFmse[0] = 1.0;
            for (int i = 1; i < horizon; ++i)
            {
                localFmse[i] = localFmse[i - 1] + psis[i] * psis[i];
            }
            localFmse = localFmse * Sigma * Sigma;

            var predictors = new TimeSeriesBase <DistributionSummary>();

            for (int i = 0; i < horizon; ++i)
            {
                var dn = new DistributionSummary();
                dn.Mean     = forecs[i];
                dn.Variance = localFmse[i];
                // dn.FillGaussianQuantiles(0.04);
                predictors.Add(futureTimes[i], dn, false);
            }
            return(predictors);
        }
コード例 #3
0
ファイル: ARMAXModel.cs プロジェクト: lulzzz/ARIMA
 public override DistributionSummary GetCurrentPredictor(DateTime futureTime)
 {
     var ds = new DistributionSummary {Mean = realTimePredictor, Variance = realTimePredictiveVar};
     // ds.FillGaussianQuantiles(0.01);
     return ds;
 }
コード例 #4
0
 public DistributionSummary ConvoluteWith(DistributionSummary other)
 {
     return(null);
 }