/// <summary> /// Calculates value of residual parameter /// </summary> /// <param name="collection">Collection of objects</param> /// <returns>Residual parameter</returns> double GetValue(IComponentCollection collection) { AliasRegression reg = collection.GetObject <AliasRegression>(name); // Regression component for (int i = 0; i < number; i++) { reg.FullIterate(); // Iteration cylce } return(reg.SquareResidual); // returns residual parameter }
/// <summary> /// Updetes itself /// </summary> new protected void Update() { checkedListBox.Items.Clear(); items.Clear(); int n = collection.Count; for (int i = 0; i < n; i++) { AliasRegression ar = collection[i] as AliasRegression; string name = collection.GetRelativeName(ar) + "(" + ar.Dimension + ")"; checkedListBox.Items.Add(name); items[name] = ar; } }
private void Compare() { CheckedListBox.CheckedItemCollection ch = checkedListBox.CheckedItems; if (ch.Count != 2) { return; } List <AliasRegression> arl = new List <AliasRegression>(); foreach (string s in ch) { arl.Add(items[s]); } int n1 = arl[0].Dimension; int n2 = arl[1].Dimension; int k1 = n1; int k2 = n2; AliasRegression[] arr = null; if (n1 > n2) { arr = new AliasRegression[] { arl[0], arl[1] }; } else { arr = new AliasRegression[] { arl[1], arl[0] }; k1 = n2; k2 = n1; } double[] ss = new double[2]; int[] kk = new int[2]; for (int i = 0; i < ss.Length; i++) { AliasRegression aa = arr[i]; int dim = aa.DataDimension - aa.Dimension; ss[i] = aa.StandardDeviation / ((double)dim); kk[i] = dim; } double x = StatisticsFunctions.Fisher(kk[0], kk[1], ss[0] / ss[1], 1E-8); labelLevel.Text = x + ""; }
/// <summary> /// Costructor /// </summary> /// <param name="reg">Regression component</param> /// <param name="s">Selection</param> public RegressionSelectionUserControl(AliasRegression reg, IStructuredSelectionCollection s) : this() { this.s = s; this.reg = reg; IAssociatedObject ao = s as IAssociatedObject; IObjectLabel label = ao.Object as IObjectLabel; name = label.RootName;//NamedComponent.GetText(label); Control c = new UserControlObject(null, label); c.Left = 0; c.Top = 0; Controls.Add(c); int y = c.Height; for (int i = 0; i < s.Count; i++) { IStructuredSelection sel = s[i]; Label l = new Label(); l.Text = sel.Name; l.Top = y + 10; l.Left = 10; Controls.Add(l); y = l.Top + l.Height; NumericUpDown n = new NumericUpDown(); n.Minimum = -1; n.Value = -1; n.Left = 10; n.Top = y + 10; y = n.Top + n.Height + 20; Controls.Add(n); controls[n] = reg.GetRelativeName(s as IAssociatedObject) + "." + sel.Name; } Height = y; }