|
JMSLTM Numerical Library 4.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.imsl.stat.ANOVAFactorial
Analyzes a balanced factorial design with fixed effects.
Class ANOVAFactorial performs an analysis for an
n-way classification design with balanced data. For balanced data,
there must be an equal number of responses in each cell of the n-way
layout. The effects are assumed to be fixed effects. The model is an
extension of the two-way model to include n factors. The interactions
(two-way, three-way, up to n-way) can be included in the model, or
some of the higher-way interactions can be pooled into error.
setModelOrder specifies the number of factors to be included
in the highest-way interaction. For example, if three-way and higher-way
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 n-way 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.
| Field Summary | |
static int |
POOL_INTERACTIONS
Indicates factor nSubscripts is not error. |
static int |
PURE_ERROR
Indicates factor nSubscripts is error. |
| Constructor Summary | |
ANOVAFactorial(int nSubscripts,
int[] nLevels,
double[] y)
Constructor for ANOVAFactorial. |
|
| Method Summary | |
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 highest-way interaction in the model. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int POOL_INTERACTIONS
nSubscripts is not error.
public static final int PURE_ERROR
nSubscripts is error.
| Constructor Detail |
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[nSubscripts-1] is the number
of observations per cell.y - a double array of length
nLevels[0] * nLevels[1] * ... *
nLevels[nSubscripts-1] 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 consistent| Method Detail |
public final double compute()
double scalar containing the p-value
for the overall F testpublic double[] getANOVATable()
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 F-statistic |
| 9 | p-value |
| 10 | |
| 11 | adjusted |
| 12 | estimate of the standard deviation |
| 13 | overall mean of y |
| 14 | coefficient of variation (in percent) |
public double[] getMeans()
double array containing the subgroup meanspublic double[][] getTestEffects()
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 NEF-1 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 | F-statistic |
| 3 | p-value |
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 higher-way
interactions. ANOVAFactorial.POOL_INTERACTIONS
indicates factor nSubscripts is not
error. Only (modelOrder + 1)-way and
higher-way 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 highest-way
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 two-way interactions will be included
in the model. Default: modelOrder =
nSubscripts - 1
|
JMSLTM Numerical Library 4.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||