Simulation of a Chi-Square Random Variable

We will generate a random sample of size 1000 from the chi-square distribution with five degrees of freedom.

We start by creating a JMP data table with 1000 rows.

Create six columns in it as follows:

The Z columns are random samples of size 1000 from a standard normal distribution. For example, the Z1 columns was obtained as follows:

The X column was created as follows:

To approximate the density of this chi-square distribution we create a histogram of the X column using JMP's Distribution platform:

We will fit a Gamma distribution which is a generalization of the Chi-Square as follows:

One sees below that the Gamma distribution fits the data well: