From: Gael Abgrall on
Hi,

I'm trying to perform a chi2test and I'm not able to
interpret the result of tis function.

Here is the console window (lat is my test distribution):

>> nf = normfit(lat);
>> [h,p, stats] = chi2gof(lat,'cdf',@(x) normcdf(x,nf),
'nbins', 30, 'nparams',2)

h = 0
p = NaN
stats =

chi2stat: 1.3047e+003
df: 0
edges: [189.5294 225.3531 547.7660]
O: [3104 1893]
E: [1.8685e+003 3.1285e+003]

------------------

I don't understand how p could be "NaN" when h is equal to 0
(hypothesis not rejected).

If someone could help me it will be great.

Thanks.

Gael.
From: Peter Perkins on
Gael Abgrall wrote:
> Hi,
>
> I'm trying to perform a chi2test and I'm not able to
> interpret the result of tis function.
>
> Here is the console window (lat is my test distribution):
>
>>> nf = normfit(lat);
>>> [h,p, stats] = chi2gof(lat,'cdf',@(x) normcdf(x,nf),
> 'nbins', 30, 'nparams',2)
>
> h = 0
> p = NaN
> stats =
>
> chi2stat: 1.3047e+003
> df: 0
> edges: [189.5294 225.3531 547.7660]
> O: [3104 1893]
> E: [1.8685e+003 3.1285e+003]
>
> ------------------
>
> I don't understand how p could be "NaN" when h is equal to 0
> (hypothesis not rejected).

Gael, what do your data look like? The d.f. of the test is calculated as zero,
and there are only two bins. It is probably due to this, as described in the
help: "Bins in either tail with an expected count less than 5 are pooled with
neighboring bins until the count in each extreme bin is at least 5." So
apparently, you have data that are not well suited for this kind of test. Why
30 bins?
From: Gael Abgrall on
Peter Perkins <Peter.PerkinsRemoveThis(a)mathworks.com> wrote
in message <g6n31t$ij$1(a)fred.mathworks.com>...

First thanks for your response.

> Gael, what do your data look like?

My data is a vector with 4998 values inside. But they are
not centered to zero.

> The d.f. of the test is calculated as zero,
> and there are only two bins. It is probably due to this,
as described in the
> help: "Bins in either tail with an expected count less
than 5 are pooled with
> neighboring bins until the count in each extreme bin is at
least 5." So
> apparently, you have data that are not well suited for
this kind of test.

> Why 30 bins?

I have shown an example with this value, I have tried other
value with the same result at the end.

Have you an idea of what kind of test could be the best for
this distribution ? (I have upload the hist graph here :
http://ga.abgrall.free.fr/img/hist_graph.png )

Thanks again.

Gael.

From: Peter Perkins on
Gael Abgrall wrote:

> Have you an idea of what kind of test could be the best for
> this distribution ? (I have upload the hist graph here :
> http://ga.abgrall.free.fr/img/hist_graph.png )

Gael, looking at this histogram, it is not obvious to me what the
problem might be, especially since I can't tell what the counts for each
histogram bar are. Can you post (as a mat file) the exact data that led
to the results in your original post?
From: Gael Abgrall on
> Can you post (as a mat file) the exact data that led
> to the results in your original post?

Here is a mat file with the data (it is not exactly the same
but it produces the same result) :

http://ga.abgrall.free.fr/mat/dist.mat

Thanks again for helping me.

Gael.
 |  Next  |  Last
Pages: 1 2
Prev: 64-bit mex problems
Next: Symbolic toolbox in r2007b