public void initialForm(List <double> listDouble) { statistics sta = new statistics(listDouble.ToArray()); lblMean.Text = "均值= " + sta.mean().ToString("0.0"); lblValueMax.Text = "最大值= " + sta.max().ToString("0.0"); lblValueMin.Text = "最小值= " + sta.min().ToString("0.0"); this.lblDataNum.Text = "数据个数= " + sta.length().ToString("0"); this.lblSum.Text = "总和= " + listDouble.Sum().ToString("0.0"); this.lblQ2.Text = "Q2= " + sta.Q2().ToString("0.0"); this.lblVariance.Text = "方差= " + sta.var().ToString("0.0"); }
public static double cov(statistics s1, statistics s2) { try { if (s1.length() != s2.length()) { return(double.NaN); } int len = s1.length(); double sum_mul = 0; for (int i = 0; i <= len - 1; i++) { sum_mul += (s1.list[i] * s2.list[i]); } return((sum_mul - len * s1.mean() * s2.mean()) / (len - 1)); } catch (Exception) { return(double.NaN); } }
public double cov(statistics s) { try { if (this.length() != s.length()) { return(double.NaN); } int len = this.length(); double sum_mul = 0; for (int i = 0; i <= len - 1; i++) { sum_mul += (this.list[i] * s.list[i]); } return((sum_mul - len * this.mean() * s.mean()) / (len - 1)); } catch (Exception) { return(double.NaN); } }
public static double b(statistics design1, statistics design2) { return(design1.mean() - a(design1, design2) * design2.mean()); }
public double b(statistics design) { return(this.mean() - this.a(design) * design.mean()); }