Chi-square goodness-of-fit test

`h = chi2gof(x)`

`h = chi2gof(x,Name,Value)`

```
[h,p] =
chi2gof(___)
```

```
[h,p,stats]
= chi2gof(___)
```

returns
a test decision for the null hypothesis that the data in vector `h`

= chi2gof(`x`

)`x`

comes
from a normal distribution with a mean and variance estimated from `x`

,
using the chi-square goodness-of-fit
test. The alternative hypothesis is that the data does not
come from such a distribution. The result `h`

is `1`

if
the test rejects the null hypothesis at the 5% significance level,
and `0`

otherwise.

returns
a test decision for the chi-square goodness-of-fit test with additional
options specified by one or more name-value pair arguments. For example,
you can test for a distribution other than normal, or change the significance
level of the test.`h`

= chi2gof(`x`

,`Name,Value`

)

`chi2gof`

compares the value of the test statistic
to a chi-square distribution with degrees of freedom equal to *nbins* -
1 - *nparams*, where *nbins* is
the number of bins used for the data pooling and *nparams* is
the number of estimated parameters used to determine the expected
counts. If there are not enough degrees of freedom to conduct the
test, `chi2gof`

returns the *p*-value
as `NaN`

.