public class ANOVAFactorial extends Object implements Serializable, Cloneable
Class ANOVAFactorial
performs an analysis for an
nway classification design with balanced data. For balanced data,
there must be an equal number of responses in each cell of the nway
layout. The effects are assumed to be fixed effects. The model is an
extension of the twoway model to include n factors. The interactions
(twoway, threeway, up to nway) can be included in the model, or
some of the higherway interactions can be pooled into error.
setModelOrder
specifies the number of factors to be included
in the highestway interaction. For example, if threeway and higherway
interactions are to be pooled into error, specify
modelOrder = 2
. (By default,
modelOrder = nSubscripts  1
with the last subscript being the
error subscript.) PURE_ERROR
indicates there are repeated
responses within the nway cell; POOL_INTERACTIONS
indicates otherwise.
Class ANOVAFactorial
requires the responses as input into a
single vector y
in lexicographical order, so that the response
subscript associated with the first factor varies least rapidly, followed by
the subscript associated with the second factor, and so forth. Hemmerle
(1967, Chapter 5) discusses the computational method.
Modifier and Type  Field and Description 

static int 
POOL_INTERACTIONS
Indicates factor
nSubscripts is not error. 
static int 
PURE_ERROR
Indicates factor
nSubscripts is error. 
Constructor and Description 

ANOVAFactorial(int nSubscripts,
int[] nLevels,
double[] y)
Constructor for
ANOVAFactorial . 
Modifier and Type  Method and Description 

double 
compute()
Analyzes a balanced factorial design with fixed effects.

double[] 
getANOVATable()
Returns the analysis of variance table.

double[] 
getMeans()
Returns the subgroup means.

double[][] 
getTestEffects()
Returns statistics relating to the sums of squares for the effects in the
model.

void 
setErrorIncludeType(int type)
Sets error included type.

void 
setModelOrder(int modelOrder)
Sets the number of factors to be included in the highestway interaction
in the model.

public static final int POOL_INTERACTIONS
nSubscripts
is not error.public static final int PURE_ERROR
nSubscripts
is error.public ANOVAFactorial(int nSubscripts, int[] nLevels, double[] y)
ANOVAFactorial
.nSubscripts
 an int
scalar containing the number of
subscripts. Number of factors in the model + 1 (for
the error term).nLevels
 an int
array of length
nSubscripts
containing the number of
levels for each of the factors for the first
nSubscripts
1 elements.
nLevels[nSubscripts1]
is the number
of observations per cell.y
 a double
array of length
nLevels[0] * nLevels[1] * ... *
nLevels[nSubscripts1]
containing the
responses. y
must not contain NaN for
any of its elements, i.e., missing values are not
allowed.IllegalArgumentException
 is thrown if nLevels.length
,
and y.length
are not consistentpublic final double compute()
double
scalar containing the pvalue
for the overall F testpublic double[] getANOVATable()
compute
method must be invoked first before invoking this method. Otherwise,
the method throws a NullPointerException
exception.double
array containing the analysis of variance
table. The analysis of variance statistics are given as follows:
Element  Analysis of Variance Statistics 
0  degrees of freedom for the model 
1  degrees of freedom for error 
2  total (corrected) degrees of freedom 
3  sum of squares for the model 
4  sum of squares for error 
5  total (corrected) sum of squares 
6  model mean square 
7  error mean square 
8  overall Fstatistic 
9  pvalue 
10  (in percent) 
11  adjusted (in percent) 
12  estimate of the standard deviation 
13  overall mean of y 
14  coefficient of variation (in percent) 
public double[] getMeans()
compute
method
must be invoked first before invoking this method. Otherwise, the
method throws a NullPointerException
exception.double
array containing the subgroup meanspublic double[][] getTestEffects()
compute
method must be invoked first
before invoking this method. Otherwise, the method throws a
NullPointerException
exception.double
matrix containing statistics relating to
the sums of squares for the effects in the model. Here,
where n
is given by nSubscripts
if
ANOVAFactorial.POOL_INTERACTIONS
is specified;
otherwise, nSubscripts  1
. Suppose the factors are
A, B, C, and error. With modelOrder = 3
, rows 0
through NEF1 would correspond to A, B, C, AB, AC, BC, and ABC,
respectively.
The columns of the output matrix are as follows:
Column  Description 
0  degrees of freedom 
1  sum of squares 
2  Fstatistic 
3  pvalue 
public void setErrorIncludeType(int type)
type
 an int
scalar.
ANOVAFactorial.PURE_ERROR
, the default
option, indicates factor nSubscripts
is
error. Its main effect and all its interaction effects
are pooled into the error with the other
(modelOrder + 1
)way and higherway
interactions. ANOVAFactorial.POOL_INTERACTIONS
indicates factor nSubscripts
is not
error. Only (modelOrder + 1
)way and
higherway interactions are included in the error.public void setModelOrder(int modelOrder)
modelOrder
 an int
scalar containing the number of
factors to be included in the highestway
interaction in the model. modelOrder
must be in the interval [1, nSubscripts  1
]. For example, a modelOrder
of
1 indicates that a main effect model will be
analyzed, and a modelOrder
of 2
indicates that twoway interactions will be included
in the model. Default: modelOrder =
nSubscripts  1
Copyright © 19702015 Rogue Wave Software
Built October 13 2015.