This project has moved and is read-only. For the latest updates, please go here.

ANOVA

Jan 21, 2014 at 11:51 PM
Does OneWayAnovaResult contain F critical value?

If not, can it be calculated from the results?

Thanks
Jan 22, 2014 at 10:08 PM
In a moment I'll show you how to get what you want, but first let me try to convince you not to want it. :-)

If you do a statistical test by quoting a critical value for your preferred confidence interval and then reporting your test statistic value, the reader just gets a binary piece of information: whether the test statistic exceeded the critical value for the confidence interval you chose. ("The test statistic exceeded the P=0.05 critical value.") If instead you report the actual probability of the test statistic value, the reader gets a quantitative measure of just how unlikely your result is, and can impose his own confidence interval. ("The probability of obtaining this large a test statistic value under the null hypothesis is P=0.02.")

Meta.Numerics lets you do either one, though:
  // Take some samples.
  Sample a = new Sample(1.0, 2.0, 3.0, 4.0);
  Sample b = new Sample(3.0, 4.0, 5.0, 6.0);
  Sample c = new Sample(4.0, 5.0, 6.0, 7.0);

  // Do an ANOVA on them and get the test result
  OneWayAnovaResult anova = Sample.OneWayAnovaTest(a, b, c);
  TestResult result = anova.Result;

  // Write out the test statistic and its tail probability.
  Console.WriteLine("F = {0}", result.Statistic);
  Console.WriteLine("P = {0}", result.RightProbability);

  // That's enough to determine if your result is significant, but if you
  // want to determine a critical value, you're welcome to do that too.
  Console.WriteLine("F_c = {0}", result.Distribution.InverseRightProbability(0.05));