You can use the \(\text{ChiSquaredVariate}\) function to calculate one or more random variates in a Chi-Squared distribution.

You can use the \chisquaredv backslash command to insert this function.

The following variants of this function are available:

  • \(\text{real } \text{ChiSquaredVariate} \left ( \text{<k>} \right )\)

  • \(\text{real matrix } \text{ChiSquaredVariate} \left ( \text{<number rows>}, \text{<number columns>}, \text{<k>} \right )\)

Where \(k \in \mathbb{Z}\) and \(k > 0\) represents the degrees of freedom.

The three parameter version, which includes \(\text{<number rows>}\) and \(\text{<number columns>}\) fields, returns an integer matrix returning random deviates. The single parameter version returns a single real value.

The function relies on the fact that the chi-squared distribution is a special case of the gamma function to calculate random variates.

Figure 119 shows the basic use of the \(\text{ChiSquaredVariate}\) function.


Figure 119 Example Use Of the ChiSquaredVariate Function