//this method hides buttons, plots etc. private void hide() { ARCHdgv.Hide(); ARCHmodels.Hide(); ARCHmodelsdgv.Hide(); ARCHwhitenoise.Hide(); ARCHarimadgv.Hide(); ARCHarchdgv.Hide(); ARCHsavebt.Hide(); ARCHarimalbl.Hide(); label1.Hide(); label2.Hide(); label3.Hide(); }
//method to populate the Fitted ARIMA Models datagridview private void populatedatagridview() { bs1.DataSource = Modellist; ARCHdgv.Show(); ARCHarimalbl.Show(); ARCHmodels.Show(); ARCHdgv.DataSource = bs1; ARCHdgv.AllowUserToAddRows = false; ARCHdgv.AutoGenerateColumns = false; DataGridViewColumn col1 = new DataGridViewTextBoxColumn(); col1.DataPropertyName = "Type"; col1.HeaderText = "Alg"; col1.Name = "Blah"; col1.Width = 50; ARCHdgv.Columns.Add(col1); DataGridViewColumn col2 = new DataGridViewTextBoxColumn(); col2.DataPropertyName = "P"; col2.HeaderText = "AR"; col2.Name = "AR Params"; col2.Width = 50; ARCHdgv.Columns.Add(col2); DataGridViewColumn col3 = new DataGridViewTextBoxColumn(); col3.DataPropertyName = "Q"; col3.HeaderText = "MA"; col3.Name = "MA Params"; col3.Width = 50; ARCHdgv.Columns.Add(col3); DataGridViewColumn col4 = new DataGridViewTextBoxColumn(); col4.DataPropertyName = "D"; col4.HeaderText = "Diff"; col4.Name = "Diff"; col4.Width = 50; ARCHdgv.Columns.Add(col4); DataGridViewColumn col5 = new DataGridViewTextBoxColumn(); col5.DataPropertyName = "Variance"; col5.HeaderText = "Var"; col5.Name = "Var"; col5.Width = 50; ARCHdgv.Columns.Add(col5); col5.DefaultCellStyle.Format = "n4"; DataGridViewColumn col6 = new DataGridViewTextBoxColumn(); col6.DataPropertyName = "Sumsquaredresiduals"; col6.HeaderText = "SS resid"; col6.Name = "SS resid"; col6.Width = 60; ARCHdgv.Columns.Add(col6); col6.DefaultCellStyle.Format = "n2"; DataGridViewColumn col7 = new DataGridViewTextBoxColumn(); col7.DataPropertyName = "Transformtype"; col7.HeaderText = "Transform"; col7.Name = "Transform"; col7.Width = 60; ARCHdgv.Columns.Add(col7); DataGridViewColumn col8 = new DataGridViewTextBoxColumn(); col8.DataPropertyName = "Transformshape"; col8.HeaderText = "Shape"; col8.Name = "Shape"; col8.Width = 60; col8.DefaultCellStyle.Format = "n2"; ARCHdgv.Columns.Add(col8); DataGridViewColumn col9 = new DataGridViewTextBoxColumn(); col9.DataPropertyName = "Transformscale"; col9.HeaderText = "Scale"; col9.Name = "Scale"; col9.Width = 60; col9.DefaultCellStyle.Format = "n2"; ARCHdgv.Columns.Add(col9); ARCHdgv.Columns["P"].Visible = false; ARCHdgv.Columns["Q"].Visible = false; ARCHdgv.Columns["Aic"].Visible = false; ARCHdgv.Columns["Bic"].Visible = false; ARCHdgv.Columns["Type"].Visible = false; ARCHdgv.Columns["Variance"].Visible = false; ARCHdgv.Columns["D"].Visible = false; ARCHdgv.Columns["Sumsquaredresiduals"].Visible = false; ARCHdgv.Columns["Transformtype"].Visible = false; ARCHdgv.Columns["Transformshape"].Visible = false; ARCHdgv.Columns["Transformscale"].Visible = false; ARCHdgv.Columns["archP"].Visible = false; ARCHdgv.Columns["archQ"].Visible = false; ARCHdgv.Columns["archAic"].Visible = false; ARCHdgv.Columns["Subtractmean"].Visible = false; //now we will determine which of the models has the lowest residual sum of squares int msize = modellist.Count(); int[] position = new int[msize]; double[] residss = new double[msize]; int minposition = 0; double minresidss = 100000000; for (int i = 0; i < msize; i++) { position[i] = i; residss[i] = modellist[i].Sumsquaredresiduals; if (residss[i] < minresidss) { minresidss = residss[i]; minposition = i; } } ARCHdgv.Rows[minposition].DefaultCellStyle.BackColor = Color.LightBlue; ARCHdgv.FirstDisplayedScrollingRowIndex = minposition; ARCHdgv.Rows[minposition].Cells[1].Selected = true; }