Class FTest

java.lang.Object
smile.stat.hypothesis.FTest

public class FTest extends Object
F test of the hypothesis that two independent samples come from normal distributions with the same variance, against the alternative that they come from normal distributions with different variances. Note that the F-test is extremely non-robust to non-normality. That is, even if the data displays only modest departures from the normal distribution, the test is unreliable and should not be used.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    The degree of freedom of F-statistic.
    final int
    The degree of freedom of F-statistic.
    final double
    F-statistic.
    final double
    p-value.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FTest(double f, int df1, int df2, double pvalue)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static FTest
    test(double[] x, double[] y)
    Test if the arrays x and y have significantly different variances.
    static FTest
    test(int[] x, double[] y)
    One-way analysis of variance (ANOVA) between a categorical independent variable (with two or more categories) and a normally distributed interval dependent variable to test for differences in the means of the dependent variable broken down by the levels of the independent variable.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • df1

      public final int df1
      The degree of freedom of F-statistic.
    • df2

      public final int df2
      The degree of freedom of F-statistic.
    • f

      public final double f
      F-statistic.
    • pvalue

      public final double pvalue
      p-value.
  • Constructor Details

    • FTest

      public FTest(double f, int df1, int df2, double pvalue)
      Constructor.
      Parameters:
      f - the F-statistic.
      df1 - the first degree of freedom of F-statistic.
      df2 - the second degree of freedom of F-statistic.
      pvalue - the p-value.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • test

      public static FTest test(double[] x, double[] y)
      Test if the arrays x and y have significantly different variances. Small values of p-value indicate that the two arrays have significantly different variances.
      Parameters:
      x - the sample values.
      y - the sample values.
      Returns:
      the test results.
    • test

      public static FTest test(int[] x, double[] y)
      One-way analysis of variance (ANOVA) between a categorical independent variable (with two or more categories) and a normally distributed interval dependent variable to test for differences in the means of the dependent variable broken down by the levels of the independent variable. Treat the variances in the samples as equal.
      Parameters:
      x - the categorical independent variable.
      y - the normally distributed interval dependent variable.
      Returns:
      the test results.