Create a standard normal probability distribution object.
Generate a data vector `x`

using random numbers from
the distribution.

Test the null hypothesis that the data in `x`

comes
from a population with a normal distribution.

The returned value `h = 0`

indicates that `chi2gof`

does
not reject the null hypothesis at the default 5% significance level.

Create a standard normal probability distribution object.
Generate a data vector `x`

using random numbers from
the distribution.

Test the null hypothesis that the data in `x`

comes
from a population with a normal distribution at the 1% significance
level.

The returned value `h = 0`

indicates that `chi2gof`

does
not reject the null hypothesis at the 1% significance level.

Navigate to the appropriate folder and load the lightbulb
lifetime sample data.

Create a vector from the first column of the data matrix,
which contains the lifetime in hours of the lightbulbs.

Test the null hypothesis that the data in `x`

comes
from a population with a Weibull distribution. Use `fitdist`

to
create a probability distribution object with `A`

and `B`

parameters
estimated from the data.

The returned value `h = 1`

indicates that `chi2gof`

rejects
the null hypothesis at the default 5% significance level.

Create six bins, numbered 0 through 5, to use for data
pooling.

Create a vector containing the observed counts for each
bin and compute the total number of observations.

Fit a Poisson probability distribution object to the data
and compute the expected count for each bin. Use the transpose operator `.'`

to
transform `bins`

and `obsCounts`

from
row vectors to column vectors.

Test the null hypothesis that the data in `obsCounts`

comes
from a Poisson distribution with a lambda parameter equal to `lambdaHat`

.

h =
0
p =
0.4654
st =
chi2stat: 2.5550
df: 3
edges: [1x6 double]
O: [6 16 10 12 6]
E: [7.0429 13.8041 13.5280 8.8383 6.0284]

The returned value `h = 0`

indicates that `chi2gof`

does
not reject the null hypothesis at the default 5% significance level.
The vector `E`

contains the expected counts for each
bin under the null hypothesis, and `O`

contains the
observed counts for each bin.