private void StartTest() { // Calculate probability double probability = double.Parse(this.comboBox2.Text); probability = 1.0 - probability / 100.0; // Make FTest AnovaResult result = chart1.DataManipulator.Statistics.Anova(probability, "Group1,Group2,Group3"); // Fill labels with results this.label9.Text = result.SumOfSquaresBetweenGroups.ToString("G3"); this.label12.Text = result.SumOfSquaresWithinGroups.ToString("G3"); this.label15.Text = result.SumOfSquaresTotal.ToString("G3"); this.label10.Text = result.DegreeOfFreedomBetweenGroups.ToString("G3"); this.label13.Text = result.DegreeOfFreedomWithinGroups.ToString("G3"); this.label16.Text = result.DegreeOfFreedomTotal.ToString("G3"); this.label11.Text = result.MeanSquareVarianceBetweenGroups.ToString("G3"); this.label14.Text = result.MeanSquareVarianceWithinGroups.ToString("G3"); this.label19.Text = result.FRatio.ToString("G3"); this.label20.Text = result.FCriticalValue.ToString("G3"); // Refresh Chart chart1.Invalidate(); }
public void AnovaTest() { AnovaResult anova = BasicStatisticalFormulas.Anova(0.05, new ChartSeries[] { this.AssociatedObject.series1, this.AssociatedObject.series2 }); this.AssociatedObject.result.Text = "F Ratio = " + anova.FRatio + "\n" + "F Critical Value =" + anova.FCriticalValue + "\n" + "Degree of Freedom Between Groups = " + anova.DegreeOfFreedomBetweenGroups + "\n" + "Degree of Freedom within Groups = " + anova.DegreeOfFreedomWithinGroups + "\n" + "Degree of Freedom total = " + anova.DegreeOfFreedomTotal + "\n" + "Mean square variance beteeen groups = " + anova.MeanSquareVarianceBetweenGroups + "\n" + "Mean square variance within groups = " + anova.MeanSquareVarianceWithinGroups + "\n" + "Sum of square between groups = " + anova.SumOfSquaresBetweenGroups + "\n"; }
public void Constructor() { AnovaResult ar = new AnovaResult(); Assert.AreEqual(0, ar.DegreeOfFreedomBetweenGroups, "A1"); Assert.AreEqual(0, ar.DegreeOfFreedomTotal, "A2"); Assert.AreEqual(0, ar.DegreeOfFreedomWithinGroups, "A3"); Assert.AreEqual(0, ar.FCriticalValue, "A4"); Assert.AreEqual(0, ar.FRatio, "A5"); Assert.AreEqual(0, ar.MeanSquareVarianceBetweenGroups, "A6"); Assert.AreEqual(0, ar.MeanSquareVarianceWithinGroups, "A7"); Assert.AreEqual(0, ar.SumOfSquaresBetweenGroups, "A8"); Assert.AreEqual(0, ar.SumOfSquaresTotal, "A9"); Assert.AreEqual(0, ar.SumOfSquaresWithinGroups, "A10"); }
public AnovaResult Anova(double probability) { if (probability > 1 || probability < 0) { throw new Exception("Probability must be between 1 and 0"); } //Verify if all groups have the same number of datapoints List <int> noValues = ClassValues.Select(a => a.Value.Count).Distinct().ToList(); if (noValues.Count != 1) { Console.WriteLine(Locus + " does not present quantitation values for all replicates"); throw new Exception("Number of values in all classes must be the same for anova test"); } string allGroups = string.Join(",", MyChart.Series.Select(a => a.Name).ToList()); AnovaResult result = MyChart.DataManipulator.Statistics.Anova(probability, allGroups); return(result); }
private void StartTest() { // Calculate probability double probability = double.Parse(DropDownListProbability.SelectedItem.Text); probability = 1.0 - probability / 100.0; // Make Anova function call AnovaResult result = Chart1.DataManipulator.Statistics.Anova(probability, "Group1,Group2,Group3"); // Fill labels with results TableResults.Rows[1].Cells[1].Text = result.SumOfSquaresBetweenGroups.ToString("G3"); TableResults.Rows[1].Cells[2].Text = result.DegreeOfFreedomBetweenGroups.ToString("G3"); TableResults.Rows[1].Cells[3].Text = result.MeanSquareVarianceBetweenGroups.ToString("G3"); TableResults.Rows[2].Cells[1].Text = result.SumOfSquaresWithinGroups.ToString("G3"); TableResults.Rows[2].Cells[2].Text = result.DegreeOfFreedomWithinGroups.ToString("G3"); TableResults.Rows[2].Cells[3].Text = result.MeanSquareVarianceWithinGroups.ToString("G3"); TableResults.Rows[3].Cells[1].Text = result.SumOfSquaresTotal.ToString("G3"); TableResults.Rows[3].Cells[2].Text = result.DegreeOfFreedomTotal.ToString("G3"); TableFValues.Rows[0].Cells[1].Text = result.FRatio.ToString("G3");; TableFValues.Rows[1].Cells[1].Text = result.FCriticalValue.ToString("G3"); }