function factory( k ) {
	if ( isnan( k ) || k < 0.0 ) {
		return constantFunction( NaN );
	}
	return mgf;

	/**
	* Evaluates the moment-generating function (MGF) for a chi-squared distribution.
	*
	* @private
	* @param {number} t - input value
	* @returns {number} evaluated MGF
	*
	* @example
	* var y = mgf( 0.5 );
	* // returns <number>
	*/
	function mgf( t ) {
		if ( isnan( t ) || t >= 0.5 ) {
			return NaN;
		}
		return pow( 1-(2*t), -k/2 );
	}
}
Returns a function for evaluating the moment-generating function (MGF) of a chi-squared distribution with degrees of freedom `k`.

@param {NonNegativeNumber} k - degrees of freedom
@returns {Function} MGF

@example
var mgf = factory( 1.0 );

var y = mgf( 0.2 );
// returns ~1.291

y = mgf( 0.4 );
// returns ~2.236