org.statcato.statistics.inferential
Class TwoWayANOVA
- java.lang.Object
-
- org.statcato.statistics.inferential.TwoWayANOVA
-
public class TwoWayANOVA extends java.lang.ObjectTwo-way analysis of variance (two-factor ANOVA). Performs computations for two-way ANOVA given all the observations and their corresponding row and column indices.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor and Description TwoWayANOVA(int a, int b)Constructor, given the number of levels in factor A and B.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddObservation(int i, int j, double data)Adds the given data to row i and column j.doublecolSum(int j)Returns the column sum B_j = Sum_{i=1...a} {cell sum of y[i][j]}.intDOFA()Returns the degrees of freedom for factor A = a - 1.intDOFAB()Returns the degrees of freedom for interaction AB.intDOFB()Returns the degrees of freedom for factor B = b - 1.intDOFE()Returns the degrees of freedom for the error.intDOFTotal()Returns the total degrees of freedom.doubleFA()Returns the F test statistics for factor A.doubleFAB()Returns the F test statistics for interaction AB.doubleFB()Returns the F test statistics for factor B.voidfindCM()Computes the correction of the mean, (sum of all observations)^2 / N.booleanisValidData()Checks if the data is valid for two-way ANOVA.doubleMSA()Returns the mean of squares of factor A = SSA / DOFA.doubleMSAB()Returns the mean of squares of interaction AB = SSAB / DOFAB.doubleMSB()Returns the mean of squares of factor B = SSB / DOFB.doubleMSE()Returns the mean of squares of error = SSE / DOFE.doublePValueA()Returns the p-Value corresponding to the F test statistic for factor A.doublePValueAB()Returns the p-Value corresponding to the F test statistic for interaction AB.doublePValueB()Returns the p-Value corresponding to the F test statistic for factor B.doublerowSum(int i)Returns the row sum A_i = Sum_{j=1...b} {cell sum of y[i][j]}.doubleSSA()Returns the sum of squares for factor A, (Sum_{i=1..a} A_i^2) / (b*n) - CM.doubleSSAB()Returns the sum of squares for interaction AB, (Sum (cell sum)^2) / n - CM - SSA - SSB.doubleSSB()Returns the sum of squares for factor B, (Sum_{j=1..b} B_j^2) / (a*n) - CM.doubleSSE()Returns sum of squares of error, SSTotal - SSA - SSB - SSAB.doubleSSTotal()Returns the total sum of squares, Sum (observation)^2 - CM.java.lang.StringtoString()
-
-
-
Constructor Detail
-
TwoWayANOVA
public TwoWayANOVA(int a, int b)Constructor, given the number of levels in factor A and B.- Parameters:
a- number of levels in factor Ab- number of levels in factor B
-
-
Method Detail
-
addObservation
public void addObservation(int i, int j, double data)Adds the given data to row i and column j.- Parameters:
i- row indexj- column indexdata- double array
-
isValidData
public boolean isValidData()
Checks if the data is valid for two-way ANOVA. Sets the treatment group size and the total sample size. Computes the correction of the mean (CM).- Returns:
- boolean value of whether the data is valid
-
rowSum
public double rowSum(int i)
Returns the row sum A_i = Sum_{j=1...b} {cell sum of y[i][j]}.- Returns:
- row sum
-
colSum
public double colSum(int j)
Returns the column sum B_j = Sum_{i=1...a} {cell sum of y[i][j]}.- Returns:
- column sum
-
findCM
public void findCM()
Computes the correction of the mean, (sum of all observations)^2 / N. Should be called before calls to compute sum of squares.
-
SSA
public double SSA()
Returns the sum of squares for factor A, (Sum_{i=1..a} A_i^2) / (b*n) - CM.- Returns:
- sum of squares for factor A
-
SSB
public double SSB()
Returns the sum of squares for factor B, (Sum_{j=1..b} B_j^2) / (a*n) - CM.- Returns:
- sum of squares for factor B
-
SSAB
public double SSAB()
Returns the sum of squares for interaction AB, (Sum (cell sum)^2) / n - CM - SSA - SSB.- Returns:
- sum of squares for interaction AB
-
SSTotal
public double SSTotal()
Returns the total sum of squares, Sum (observation)^2 - CM.- Returns:
- total sum of squares
-
SSE
public double SSE()
Returns sum of squares of error, SSTotal - SSA - SSB - SSAB.- Returns:
- sum of squares of error
-
MSA
public double MSA()
Returns the mean of squares of factor A = SSA / DOFA.- Returns:
- mean of squares of factor A
-
MSB
public double MSB()
Returns the mean of squares of factor B = SSB / DOFB.- Returns:
- mean of squares of factor B
-
MSAB
public double MSAB()
Returns the mean of squares of interaction AB = SSAB / DOFAB.- Returns:
- mean of squares of interaction AB
-
MSE
public double MSE()
Returns the mean of squares of error = SSE / DOFE.- Returns:
- mean of squares of error
-
DOFA
public int DOFA()
Returns the degrees of freedom for factor A = a - 1.- Returns:
- degrees of freedom for A
-
DOFB
public int DOFB()
Returns the degrees of freedom for factor B = b - 1.- Returns:
- degrees of freedom for B
-
DOFAB
public int DOFAB()
Returns the degrees of freedom for interaction AB.- Returns:
- degrees of freedom for AB
-
DOFE
public int DOFE()
Returns the degrees of freedom for the error.- Returns:
- degrees of freedom for error
-
DOFTotal
public int DOFTotal()
Returns the total degrees of freedom.- Returns:
- total degrees of freedom
-
FA
public double FA()
Returns the F test statistics for factor A.- Returns:
- F for factor A
-
FB
public double FB()
Returns the F test statistics for factor B.- Returns:
- F for factor B
-
FAB
public double FAB()
Returns the F test statistics for interaction AB.- Returns:
- F for interaction AB
-
PValueA
public double PValueA()
Returns the p-Value corresponding to the F test statistic for factor A.- Returns:
- p-Value
-
PValueB
public double PValueB()
Returns the p-Value corresponding to the F test statistic for factor B.- Returns:
- p-Value
-
PValueAB
public double PValueAB()
Returns the p-Value corresponding to the F test statistic for interaction AB.- Returns:
- p-Value
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG