papaya
Class OneWayAnova

java.lang.Object
  extended by papaya.OneWayAnova

public class OneWayAnova
extends Object

Computes the one-way ANOVA p-value to test the equality of two or more sample means by analyzing the sample variances using the test statistic F = variance between samples / variance within samples. Once initialized, the following values are computed and stored:

Preconditions:

This implementation is based on a description provided in Chapter 13 of the VassarStats online textbook Mean values are not computed directly in the algorithm as this tends to cause round-off error. Rather, we use the more stable SumOfSquares - Sum^2:

 Sum_(i=1 to n) (x_i - mean(x) )^2 = Sum_(i=1 to n)(x_i)^2 - (Sum_(i=1 to n) x_i)^2/n.
 


Constructor Summary
OneWayAnova(Collection<float[]> categoryData)
          Performs an Analysis of Variance (ANOVA) for a collection of float arrays.
 
Method Summary
 int dfbg()
          Returns the degrees of freedom between groups.
 int dfwg()
          Returns the degrees of freedom within each group.
 float etasqrd()
          Computes eta^2: a measure of the strength of the curvilinear relationship between the independent and dependent variable.
 float F()
          Returns the test statistic F.
 float pValue()
          Returns the significance, or "p-value" of the test statistic F().
 float ssbg()
          Returns the sum of squared deviates between each group.
 float sswg()
          Returns the sum of squared deviates of the data within each group.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneWayAnova

public OneWayAnova(Collection<float[]> categoryData)
Performs an Analysis of Variance (ANOVA) for a collection of float arrays.

Parameters:
categoryData - the data coresponding to the different groups
See Also:
Collection
Method Detail

etasqrd

public float etasqrd()
Computes eta^2: a measure of the strength of the curvilinear relationship between the independent and dependent variable. Useful in the context of one-way ANOVAs of independent samples. For example, the independent variable could be the amount of papaya consumed by 4 different groups (0, 1, 2, or 3 papayas/dar) and the dependent variable could be a measurement of their satisfaction with life.


dfbg

public int dfbg()
Returns the degrees of freedom between groups. That is, if there are k groups, dfbg = k-1;


dfwg

public int dfwg()
Returns the degrees of freedom within each group. That is, if there are k groups, and each have got n_i elements, dfwg = (n_1-1) + (n_2 -1) + ... + (n_k - 1);


F

public float F()
Returns the test statistic F. That is,
 
 F = (ssbg/dfbg) / (sswg/dfwg);
 


pValue

public float pValue()
Returns the significance, or "p-value" of the test statistic F(). That is,
 
 p = 1 - Probability.fcdf(F,dfbg,dfwg);
 


sswg

public float sswg()
Returns the sum of squared deviates of the data within each group. That is, if there are k groups, and each have got n_i elements,
 sswg = Sum_(i=1 to n1) (xi1-mean(x1))^2 + Sum_(i=1 to n2) (xi2-mean(xk))^2 + ... + Sum_(i=1 to nk) (xik-mean(xk))^2;
 


ssbg

public float ssbg()
Returns the sum of squared deviates between each group. That is, if there are k groups, each with mean value y_i, then
 ssbg = Sum_(i=1 to k) (y_i)-mean(y))
 



Processing library papaya by Adila Faruk. (C) 2014