*
* %InvChiSqrParms(mean,sd)
* returns a 2-vector (degrees of freedom and scale in that order) with
* the two parameters for an inverse scaled chi-squared distribution with the
* given mean and standard deviation.
*
* If the s.d. is %NA (infinite), degrees of freedom if 4, which is the
* largest value for which the variance is undefined.
*
* Example:
*
*   source invchisqrparms.src
*   compute icparms=%invchisqrparms(2.0,1.0)
*   set test 1 10000 = (icparms(2)*icparms(1))/%ranchisqr(icparms(1))
*   stats test
*
* will create a series named TEST with inverse chi-squareds with (population)
* mean 2 and standard deviation 1.
*
* Revision Schedule:
*  12/2015 Written by Tom Doan, Estima.
*
function %InvChisqrParms mean sd
type vect[real] %InvChiSqrParms
type real mean
type real sd
*
local real a
compute a=%if(%valid(sd),2.0*(mean/sd)^2+4,4.0)
compute %InvChisqrParms=||a,mean*(a-2)/a||
end
