|
SSJ V. 2.6. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.gof.GofStat.OutcomeCategoriesChi2
public static class GofStat.OutcomeCategoriesChi2
This class helps managing the partitions of possible outcomes
into categories for applying chi-square tests.
It permits one to automatically regroup categories to make sure that
the expected number of observations in each category is large enough.
To use this facility, one must first construct an
OutcomeCategoriesChi2 object by passing to the constructor
the expected number of observations for each original category.
Then, calling the method regroupCategories
will regroup
categories in a way that the expected number of observations in each
category reaches a given threshold minExp.
Experts in statistics recommend that minExp be always larger
than or equal to 5 for the chi-square test to be valid. Thus,
minExp = 10 is a safe value to use.
After the call, nbExp gives the expected numbers in the new
categories and loc[i] gives the relocation of category i,
for each i. That is, loc[i] = j means that category i has
been merged with category j because its original expected number was
too small, and nbExp[i] has been added to nbExp[j]
and then set to zero.
In this case, all observations that previously belonged
to category i are redirected to category j.
The variable nbCategories gives the final number of categories,
smin contains the new index of the lowest category,
and smax the new index of the highest category.
Field Summary | |
---|---|
int[] |
loc
loc[i] gives the relocation of the category i in the nbExp array. |
int |
nbCategories
Total number of categories. |
double[] |
nbExp
Expected number of observations for each category. |
int |
smax
Maximum index for valid expected numbers in the array nbExp. |
int |
smin
Minimum index for valid expected numbers in the array nbExp. |
Constructor Summary | |
---|---|
GofStat.OutcomeCategoriesChi2(double[] nbExp)
Constructs an OutcomeCategoriesChi2 object using the array nbExp for the number of expected observations in each category. |
|
GofStat.OutcomeCategoriesChi2(double[] nbExp,
int[] loc,
int smin,
int smax,
int nbCat)
Constructs an OutcomeCategoriesChi2 object. |
|
GofStat.OutcomeCategoriesChi2(double[] nbExp,
int smin,
int smax)
Constructs an OutcomeCategoriesChi2 object using the given nbExp expected observations array. |
Method Summary | |
---|---|
void |
regroupCategories(double minExp)
Regroup categories as explained earlier, so that the expected number of observations in each category is at least minExp. |
String |
toString()
Provides a report on the categories. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int nbCategories
public int smin
public int smax
public double[] nbExp
public int[] loc
Constructor Detail |
---|
public GofStat.OutcomeCategoriesChi2(double[] nbExp)
nbExp
- array of expected observations for each categorypublic GofStat.OutcomeCategoriesChi2(double[] nbExp, int smin, int smax)
nbExp
- array of expected observations for each categorysmin
- Minimum index for valid expected number of observationssmax
- Maximum index for valid expected number of observationspublic GofStat.OutcomeCategoriesChi2(double[] nbExp, int[] loc, int smin, int smax, int nbCat)
nbExp
- array of expected observations for each categorysmin
- Minimum index for valid expected number of observationssmax
- Maximum index for valid expected number of observationsloc
- array for which loc[i] gives the relocation of the category iMethod Detail |
---|
public void regroupCategories(double minExp)
minExp
- mininum number of expected observations in each categorypublic String toString()
toString
in class Object
|
SSJ V. 2.6. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |