Question:How to properly invert and add scale and location parameters to a probability distribution from a built-in distribution?

Question:How to properly invert and add scale and location parameters to a probability distribution from a built-in distribution?

Maple 2023

Hello community,

Could I please get help on how to invert a probability distribution (reciprocal of) and add the location and scale parameters? The distribution in question is from the built-in (Statistics package) of ChiSquare(n) transformed into a scaled inverse Chi Square with location (shift) parameters.

I have tried the following which results in verified (correct) empirical (sampled) data, but have not been equally successful in the theoretical moments and its quantiles.

 >
 > restart; st:=time():
 > with(Statistics):
 >
 > InvChi2:=proc(a,b,n)         description "inverse chisquare distribution with a=location, b=scale, n=degrees of freedom";         local CHI := RandomVariable(ChiSquare(n)):                  Distribution(                 CDF = unapply(CDF(b*n/CHI+a,t),t),                 PDF = unapply(PDF(b*n/CHI+a,t),t),                 Mean = a+~Mean(b*n/CHI),                 Median = a+~Median(b*n/CHI),                 Variance = simplify(CentralMoment(a+b*n/CHI,2)),                 Skewness = simplify(CentralMoment(b*n/CHI, 3) / CentralMoment(b*n/CHI,2)^(3/2)),                 Kurtosis = simplify(CentralMoment(b*n/CHI, 4) / CentralMoment(b*n/CHI,2)^2),                 Conditions = [b > 0],                 RandomSample = proc(N::nonnegint)                                 a+~Sample(b*n/CHI,N)                         end proc                 );         end proc:
 >
 > T:= RandomVariable(InvChi2(2,4.32,3))
 >
 >
 (1)
 > evalf(Median(T))
 (2)
 > evalf(Mean(T))
 (3)
 > Variance(T)
 (4)
 > Skewness(T)
 (5)
 > Kurtosis(T)
 (6)
 > Quantile(T,.25)
 (7)
 > A:=Sample(T,10^5):
 > Median(A)
 (8)
 > Mean(A)
 (9)
 > Variance(A)
 (10)
 > Skewness(A)
 (11)
 > Quantile(A,.25)
 (12)
 > Quantile(A,.75)
 (13)
 > printf("Time to execute worksheet = %a seconds", time() - st)
 Time to execute worksheet = 2.813 seconds
 >

Thank you

﻿