Beispiel #1
0
        /// <summary>
        /// Prosedur untuk menghitung dekomposisi dengan metode aditif
        /// </summary>
        private void Additive()
        {
            //menghitung seasonal index
            ssnl = new SeasonalIndex(this.y, this.seasonalLength, false);
            //mendefinisikan data seasonal
            int index = 0;

            for (int i = 0; i < this.n; i++)
            {
                this.seasonal[i] = ssnl.SEASONAL[index];
                index++;
                if (index == this.seasonalLength)
                {
                    index = 0;
                }
            }

            //Melakukan penghitungan nilai deseasonal
            for (int i = 0; i < this.n; i++)
            {
                this.deseasonal[i] = this.y[i] - this.seasonal[i];
            }

            //Menghitung nilai tren
            this.ComponentTrend();

            //Melakukan penghitungan nilai detrend, deseasonal, cyclical and irregular, predicted, and residual
            for (int i = 0; i < this.n; ++i)
            {
                this.detrend[i]   = this.y[i] - this.trend[i];
                this.predicted[i] = this.trend[i] + this.seasonal[i];
                this.residual[i]  = this.y[i] - this.predicted[i];
            }
        }
Beispiel #2
0
        /// <summary>
        /// Prosedur untuk menghitung dekomposisi dengan metode multiplikatif
        /// </summary>
        private void Multiplicative()
        {
            //menghitung nilai seasonal index dengan rasio pada rata-rata bergerak
            ssnl = new SeasonalIndex(this.y, this.seasonalLength, true);
            //mendefinisikan nilai seasonal setiap data
            int index = 0;

            for (int i = 0; i < this.n; i++)
            {
                this.seasonal[i] = ssnl.SEASONAL[index];
                index++;
                if (index == this.seasonalLength)
                {
                    index = 0;
                }
            }

            //Melakukan penghitungan nilai deseasonal
            for (int i = 0; i < this.n; i++)
            {
                try
                {
                    this.deseasonal[i] = this.y[i] / this.seasonal[i];
                }
                catch
                {
                    this.deseasonal[i] = 0;
                }
            }

            this.ComponentTrend();

            //Melakukan penghitungan nilai detrend, predicted, and residual
            for (int i = 0; i < this.n; ++i)
            {
                try { this.detrend[i] = this.y[i] / this.trend[i]; }
                catch { this.detrend[i] = 0; }
                this.predicted[i] = this.trend[i] * this.seasonal[i];
                this.residual[i]  = this.y[i] - this.predicted[i];
            }
        }
        /// <summary>
        /// Prosedur untuk menghitung dekomposisi dengan metode multiplikatif
        /// </summary>
        private void Multiplicative()
        {
            //menghitung nilai seasonal index dengan rasio pada rata-rata bergerak
            ssnl = new SeasonalIndex(this.y, this.seasonalLength, true);
            //mendefinisikan nilai seasonal setiap data
            int index = 0;
            for (int i = 0; i < this.n; i++)
            {
                this.seasonal[i] = ssnl.SEASONAL[index];
                index++;
                if (index == this.seasonalLength)
                    index = 0;
            }

            //Melakukan penghitungan nilai deseasonal
            for (int i = 0; i < this.n; i++)
            {
                try
                {
                    this.deseasonal[i] = this.y[i] / this.seasonal[i];
                }
                catch
                {
                    this.deseasonal[i] = 0;
                }
            }

            this.ComponentTrend();

            //Melakukan penghitungan nilai detrend, predicted, and residual
            for (int i = 0; i < this.n; ++i)
            {
                try { this.detrend[i] = this.y[i] / this.trend[i]; }
                catch { this.detrend[i] = 0; }
                this.predicted[i] = this.trend[i] * this.seasonal[i];
                this.residual[i] = this.y[i] - this.predicted[i];
            }
        }
        /// <summary>
        /// Prosedur untuk menghitung dekomposisi dengan metode aditif
        /// </summary>
        private void Additive()
        {
            //menghitung seasonal index
            ssnl = new SeasonalIndex(this.y, this.seasonalLength, false);
            //mendefinisikan data seasonal
            int index = 0;
            for (int i = 0; i < this.n; i++)
            {
                this.seasonal[i] = ssnl.SEASONAL[index];
                index++;
                if (index == this.seasonalLength)
                    index = 0;
            }

            //Melakukan penghitungan nilai deseasonal
            for (int i = 0; i < this.n; i++)
            {
                this.deseasonal[i] = this.y[i] - this.seasonal[i];
            }

            //Menghitung nilai tren
            this.ComponentTrend();

            //Melakukan penghitungan nilai detrend, deseasonal, cyclical and irregular, predicted, and residual
            for (int i = 0; i < this.n; ++i)
            {
                this.detrend[i] = this.y[i] - this.trend[i];
                this.predicted[i] = this.trend[i] + this.seasonal[i];
                this.residual[i] = this.y[i] - this.predicted[i];
            }
        }