public void SetData(SeriesData data, SeriesVariable variable, ExponentialSmoothingForm.ESSpecification esProperties)
 {
     this.data = data;
     this.variable = variable;
     this.esProperties = esProperties;
     this.lblVariable.Text = variable.VariableName;
     this.update();
 }
Esempio n. 2
0
        public void ExponentialSmoothing()
        {
            SelectAnalyzedVariable dlg = new SelectAnalyzedVariable(this.data.SeriesVariables);
            dlg.ShowDialog();
            if (dlg.DialogResult == DialogResult.OK)
            {
                ExponentialSmoothingForm esForm = new ExponentialSmoothingForm();
                esForm.SetVariable(dlg.SelectedVariable);
                esForm.ShowDialog();
                if (esForm.DialogResult == DialogResult.Yes)
                {

                    if (esForm.IsStoreSmoothed)
                    {
                        SeriesVariable var = new SeriesVariable(esForm.SmoothedName, "Smoothed Value of exponential smoothing of variable '"
                            + dlg.SelectedVariable.VariableName + "'");
                        int lag = dlg.SelectedVariable.SeriesValues.Count - esForm.EsTable.predicted.Length;
                        var.InitializeItem(dlg.SelectedVariable.SeriesValues.Count);
                        for (int i = 0; i < lag; i++) var[i] = double.NaN;
                        for (int i = 0; i < esForm.EsTable.smoothed.Length; i++) var[i + lag] = esForm.EsTable.smoothed[i];
                        this.data.SeriesVariables.Add(var);
                        this.seriesDataList.Refresh();
                    }

                    if (esForm.IsStorePredicted)
                    {
                        SeriesVariable var = new SeriesVariable(esForm.PredictedName, "Predicted Value of exponential smoothing of variable '"
                            + dlg.SelectedVariable.VariableName + "'");
                        int lag = dlg.SelectedVariable.SeriesValues.Count - esForm.EsTable.predicted.Length;
                        var.InitializeItem(dlg.SelectedVariable.SeriesValues.Count);
                        for (int i = 0; i < lag; i++) var[i] = double.NaN;
                        for (int i = 0; i < esForm.EsTable.predicted.Length; i++) var[i + lag] = esForm.EsTable.predicted[i];
                        this.data.SeriesVariables.Add(var);
                        this.seriesDataList.Refresh();
                    }

                    if (esForm.IsStoreResidual)
                    {
                        SeriesVariable var = new SeriesVariable(esForm.ResidualName, "Residual Value of exponential smoothing of variable '"
                            + dlg.SelectedVariable.VariableName + "'");
                        int lag = dlg.SelectedVariable.SeriesValues.Count - esForm.EsTable.residual.Length;
                        var.InitializeItem(dlg.SelectedVariable.SeriesValues.Count);
                        for (int i = 0; i < lag; i++) var[i] = double.NaN;
                        for (int i = 0; i < esForm.EsTable.residual.Length; i++) var[i + lag] = esForm.EsTable.residual[i];
                        this.data.SeriesVariables.Add(var);
                        this.seriesDataList.Refresh();
                    }

                    ESResultTabPage esTabPage = new ESResultTabPage();

                    if (esForm.EsProperties.initialModel == 1)
                        esTabPage.Title = "Single ES : '" + dlg.SelectedVariable.VariableName + "'";
                    if (esForm.EsProperties.initialModel == 2)
                        esTabPage.Title = "Double ES (Brown) : '" + dlg.SelectedVariable.VariableName + "'";
                    if (esForm.EsProperties.initialModel == 3)
                        esTabPage.Title = "Double ES (Holt) : '" + dlg.SelectedVariable.VariableName + "'";
                    if (esForm.EsProperties.initialModel == 4)
                        esTabPage.Title = "Triple ES (Winter) : '" + dlg.SelectedVariable.VariableName + "'";

                    if (esForm.IsForecastedDataGridChecked)
                    {
                        if (esForm.EsProperties.initialModel == 1)
                        {
                            esTabPage.SetData(this.data, dlg.SelectedVariable, esForm.EsProperties,
                                esForm.EsTable, esForm.SesForecast(esForm.ForecastingStep));
                        }
                        if (esForm.EsProperties.initialModel == 2)
                        {
                            esTabPage.SetData(this.data, dlg.SelectedVariable, esForm.EsProperties,
                                esForm.EsTable, esForm.BrownForecast(esForm.ForecastingStep));
                        }
                        if (esForm.EsProperties.initialModel == 3)
                        {
                            esTabPage.SetData(this.data, dlg.SelectedVariable, esForm.EsProperties,
                                esForm.EsTable, esForm.HoltForecast(esForm.ForecastingStep));
                        }
                        if (esForm.EsProperties.initialModel == 4)
                        {
                            esTabPage.SetData(this.data, dlg.SelectedVariable, esForm.EsProperties,
                                esForm.EsTable, esForm.WinterForecast(esForm.ForecastingStep));
                        }
                    }

                    else
                    {
                        esTabPage.SetData(this.data, dlg.SelectedVariable, esForm.EsProperties,
                            esForm.EsTable, null);
                    }
                    esTabPage.IsEsModelSummaryVisible = esForm.IsEsModelSummaryChecked;

                    esTabPage.IsExponentialSmoothingDataGridVisible = esForm.IsExponentialSmoothingDataGridChecked;
                    esTabPage.IsSmoothingVisible = esForm.IsSmoothingChecked;
                    esTabPage.IsTrendVisible = esForm.IsTrendChecked;
                    esTabPage.IsSeasonalVisible = esForm.IsSeasonalChecked;
                    esTabPage.IsForecastedDataGridVisible = esForm.IsForecastedDataGridChecked;
                    esTabPage.IsActualAndPredictedGraphVisible = esForm.IsActualAndPredictedGraphChecked;
                    esTabPage.IsActualAndSmoothedGraphVisible = esForm.IsActualAndSmoothedGraphChecked;
                    esTabPage.IsActualAndForecastedGraphVisible = esForm.IsActualAndForecastedGraphChecked;
                    esTabPage.IsActualVsPredictedGraphVisible = esForm.IsActualVsPredictedGraphChecked;
                    esTabPage.IsResidualGraphVisible = esForm.IsResidualGraphChecked;
                    esTabPage.IsResidualVsActualGraphVisible = esForm.IsResidualVsActualGraphChecked;
                    esTabPage.IsResidualVsPredictedGraphVisible = esForm.IsResidualVsPredictedGraphChecked;

                    esTabPage.DrawControl();

                    esTabPage.IsDrawn = true;
                    this.tabControlResult.AddTab(esTabPage);
                    this.tabControlResult.SelectedItem = esTabPage;

                    this.tabControlData.SelectedTab = this.tabPageResult;

                }
            }
        }
 public void SetData(SeriesData data, SeriesVariable variable,
     ExponentialSmoothingForm.ESSpecification esProperties,
     ExponentialSmoothingForm.ESComponent esTable, double[] forecasted)
 {
     this.data = data;
     this.variable = variable;
     this.esProperties = esProperties;
     this.esTable = esTable;
     this.forecasted = forecasted;
 }