public static class GofStat.OutcomeCategoriesChi2
extends java.lang.Object
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.| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
void |
regroupCategories(double minExp)
Regroup categories as explained earlier, so that the expected
number of observations in each category is at least minExp.
|
java.lang.String |
toString()
Provides a report on the categories.
|
public int nbCategories
public int smin
public int smax
public double[] nbExp
public int[] loc
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 ipublic void regroupCategories(double minExp)
minExp - mininum number of expected observations in each categorypublic java.lang.String toString()
toString in class java.lang.ObjectTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.