private void createRegChart() { Forms.Stats.frmChart hist = (Forms.Stats.frmChart)ModelHelper.generateProbabilityGraphic(IndependentFieldNames); System.Windows.Forms.ComboBox cmbPrimary = (System.Windows.Forms.ComboBox)hist.Controls["cmbPrimary"]; cmbPrimary.SelectedValueChanged += new EventHandler(cmbPrimary_SelectedValueChanged); System.Windows.Forms.TrackBar tb = (System.Windows.Forms.TrackBar)hist.Controls["tbQ"]; tb.Scroll += new EventHandler(tb_RegionChanged); hist.chrHistogram.Show(); cmbPrimary.SelectedItem = IndependentFieldNames[0]; hist.Show(); }
public void updateFormValues(Forms.Stats.frmChart hist) { System.Windows.Forms.ComboBox cmbPrimary = (System.Windows.Forms.ComboBox)hist.Controls["cmbPrimary"]; System.Windows.Forms.TrackBar tb = (System.Windows.Forms.TrackBar)hist.Controls["tbQ"]; System.Windows.Forms.DataVisualization.Charting.Chart ch = hist.chrHistogram; ch.Series.Clear(); string cmbTxt = cmbPrimary.Text; int tbVl = tb.Value; double oVl = tbVl / 10d; int cmbInd = System.Array.IndexOf(IndependentFieldNames, cmbTxt); double[] meanArray = new double[sumValues.Length]; for (int i = 0; i < meanArray.Length; i++) { double mV = minValues[i]; meanArray[i] = mV + ((maxValues[i] - mV) * oVl); } double mVl = minValues[cmbInd]; double rng = maxValues[cmbInd] - mVl; double stp = rng / 10; double[] xVlArr = new double[10]; for (int i = 0; i < 10; i++) { xVlArr[i] = (i * stp) + mVl; } for (int i = 0; i < Categories.Length; i++) { System.Windows.Forms.DataVisualization.Charting.Series s = ch.Series.Add(Categories[i]); s.BorderWidth = 3; s.LegendText = Categories[i]; s.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Int32; s.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; s.ChartArea = "Probs"; } for (int j = 0; j < xVlArr.Length; j++) { meanArray[cmbInd] = xVlArr[j]; double pVl = computNew(meanArray); double pVl2 = 1 - pVl; double[] probArr = { pVl2, pVl }; for (int k = 0; k < probArr.Length; k++) { System.Windows.Forms.DataVisualization.Charting.Series s = ch.Series[k]; s.Points.AddXY(xVlArr[j], probArr[k]); } } }
private void cmbPrimary_SelectedValueChanged(object sender, EventArgs e) { System.Windows.Forms.Control cmb = (System.Windows.Forms.Control)sender; Forms.Stats.frmChart frm = (Forms.Stats.frmChart)cmb.Parent; updateFormValues(frm); }
void tb_RegionChanged(object sender, EventArgs e) { System.Windows.Forms.Control cmb = (System.Windows.Forms.Control)sender; Forms.Stats.frmChart frm = (Forms.Stats.frmChart)cmb.Parent; updateFormValues(frm); }
private void createRegChart() { if (glm == null) { Accord.Statistics.Links.ILinkFunction lFunc = new Accord.Statistics.Links.IdentityLinkFunction(); switch (Link) { case LinkFunction.Absolute: lFunc = new Accord.Statistics.Links.AbsoluteLinkFunction(); break; case LinkFunction.Cauchit: lFunc = new Accord.Statistics.Links.CauchitLinkFunction(); break; case LinkFunction.Inverse: lFunc = new Accord.Statistics.Links.InverseLinkFunction(); break; case LinkFunction.InverseSquared: lFunc = new Accord.Statistics.Links.InverseSquaredLinkFunction(); break; case LinkFunction.Logit: lFunc = new Accord.Statistics.Links.LogitLinkFunction(); break; case LinkFunction.Log: lFunc = new Accord.Statistics.Links.LogLinkFunction(); break; case LinkFunction.LogLog: lFunc = new Accord.Statistics.Links.LogLogLinkFunction(); break; case LinkFunction.Probit: lFunc = new Accord.Statistics.Links.ProbitLinkFunction(); break; case LinkFunction.Sin: lFunc = new Accord.Statistics.Links.SinLinkFunction(); break; case LinkFunction.Threshold: lFunc = new Accord.Statistics.Links.ThresholdLinkFunction(); break; default: break; } glm = new Accord.Statistics.Models.Regression.GeneralizedLinearRegression(lFunc, coefficients, stdError); } Forms.Stats.frmChart hist = (Forms.Stats.frmChart)ModelHelper.generateRegressionGraphic(IndependentFieldNames); System.Windows.Forms.ComboBox cmbPrimary = (System.Windows.Forms.ComboBox)hist.Controls["cmbPrimary"]; cmbPrimary.SelectedValueChanged += new EventHandler(cmbPrimary_SelectedValueChanged); System.Windows.Forms.TrackBar tb = (System.Windows.Forms.TrackBar)hist.Controls["tbQ"]; tb.Scroll += new EventHandler(tb_RegionChanged); hist.chrHistogram.Show(); cmbPrimary.SelectedItem = IndependentFieldNames[0]; hist.Show(); }