Fisher \(z\) distribution#
- class ctx.dist_fisher_z(m, n)#
where
ctxisfpm,mpm,ipm,dec,gmporapm.The Fisher \(z\)-distribution is a continuous probability distribution with \(m > 0\) and \(n > 0\) degrees of freedom, and the support interval \((-\infty, +\infty)\). A random variable \(X\) follows a Fisher \(z\)-distribution with \(m\) and \(n\) degrees of freedom if it is defined as \(X = \tfrac{1}{2}\) log(Y), where \(Y\) follows a Fisher \(F\)-distribution with \(m\) and \(n\) degrees of freedom. The Fisher \(z\)-distribution is always unimodal, asymmetrical if \(m \ne n\), and symmetrical if \(m=n\). Interchanging \(m\) and \(n\) is the same as replacing \(z\) with \(-z\). The mode is at \(0\).
See also Wikipedia [1243], MathWorld [872], BoostMath [62], Witkovský [1617], R (Statistical System) [549], Abramowitz and Stegun. [3], Butler and Paolella [173], Chattamvelli and Jones [182], Witkovský [1611].
A Study of R. A. Fisher’s z Distribution and the Related F Distribution. Leo A. Aroian. Ann. Math. Statist. 12(4): 429-448 (December, 1941). DOI: 10.1214/aoms/1177731681
- dist_fisher_z.pdf(x)#
Returns \(\text{pdf}_X(x)\), the probability density function (pdf) of a random variable \(X\), following a Fisher \(z\) distribution:
\[\text{pdf}_X(x) = 2 e^{2x} f_{\text{FisherF}}(e^{2x}; m,n),\]where \(f_{\text{FisherF}}(\cdot, m,n)\) is the pdf of the Fisher \(F\)-distribution with \(m\) and \(n\) degrees of freedom.
>>> from mpfunlab import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; x = 3; >>> print ("pdf: ", fisher_f(mu, sigma).pdf(x)) 6.3563523462564525615615615614561356E-20
- dist_fisher_z.cdf(x)#
Returns \(\text{cdf}_X(x)\), the cumulative distribution function (cdf) of a random variable \(X\), following a Fisher \(z\) distribution:
\[\text{cdf}_X(x) = F_{\text{FisherF}}(e^{2x}; m,n),\]where \(F_{\text{FisherF}}(\cdot, m,n)\) is the cdf of the Fisher \(F\)-distribution with \(m\) and \(n\) degrees of freedom.
>>> from mpfunlab import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; x = 3; >>> print ("cdf: ", fisher_f(mu, sigma).pdf(x)) 6.3563523462564525615615615614561356E-20
- dist_fisher_z.sf(x)#
Returns \(\text{sf}_X(x)\), the survival function (sf) of a random variable \(X\), following a Fisher \(z\) distribution:
\[\text{sf}_X(x) = F_{\text{FisherF}}(e^{-2x}; n,m),\]where \(F_{\text{FisherF}}(\cdot, n,m)\) is the cdf of the Fisher \(F\)-distribution with \(n\) and \(m\) degrees of freedom.
>>> from mpfunlab import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; x = 3; >>> print (" sf: ", fisher_f(mu, sigma).pdf(x)) sf: 6.3563523462564525615615615614561356E-20
- dist_fisher_z.qtf(q)#
Returns \(\text{qtf}_X(q)\), the quantile function (qtf) of a random variable \(X\), following a Fisher \(z\) distribution:
\[\text{qtf}_X(q) = \tfrac{1}{2} \log \left( F^{-1}_{\text{FisherF}}(q; m,n) \right),\]where \(F^{-1}_{\text{FisherF}}(\cdot, m,n)\) is the qtf of the Fisher \(F\)-distribution with \(m\) and \(n\) degrees of freedom.
>>> from mpfunlab import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; q = 0.3; >>> print ("qtf: ", fisher_f(mu, sigma).qtf(q)) qtf: 6.3563523462564525615615615614561356E+00
- dist_fisher_z.isf(q)#
Returns \(\text{isf}_X(q)\), the inverse survival function (isf) of a random variable \(X\), following a Fisher \(z\) distribution:
\[\text{isf}_X(q) = -\tfrac{1}{2} \log \left( F^{-1}_{\text{FisherF}}(q; n,m) \right),\]where \(F^{-1}_{\text{FisherF}}(\cdot, n,m)\) is the qtf of the Fisher \(F\)-distribution with \(n\) and \(m\) degrees of freedom.
>>> from mpfunlab import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; q = 0.3; >>> print ("isf: ", fisher_f(mu, sigma).isf(q)) 6.3563523462564525615615615614561356E+00
- dist_fisher_z.c_x(t)#
Returns \(C_X(t)\), the characteristic function of a random variable \(X\), following a Fisher \(z\) distribution:
\[C_X(t) = \left(\frac{n}{m}\right)^{it/2} \frac{\Gamma\left(\tfrac{1}{2}(n-it)\right) \Gamma\left(\tfrac{1}{2}(m+it)\right)}{\Gamma\left(\tfrac{1}{2}n\right) \Gamma\left(\tfrac{1}{2}m\right)}\]>>> from mpfunlab import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; q = 0.3; >>> print ("isf: ", fisher_f(mu, sigma).isf(q)) 6.3563523462564525615615615614561356E+00
- dist_fisher_z.m_x(t)#
Returns the moment generating function of a random variable \(X\), following a Fisher \(z\) distribution.
\[M_X(t) = \left(\frac{n}{m}\right)^{t/2} \frac{\Gamma\left(\tfrac{1}{2}(n-t)\right) \Gamma\left(\tfrac{1}{2}(m+t)\right)}{\Gamma\left(\tfrac{1}{2}n\right) \Gamma\left(\tfrac{1}{2}m\right)}\]>>> from mpfunlab import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; q = 0.3; >>> print ("isf: ", fisher_f(mu, sigma).isf(q)) 6.3563523462564525615615615614561356E+00
- dist_fisher_z.k_x(t, k=0)#
Returns \(K_X(t)\), the cumulant generating function, and its \(j^{\text{th}}\) derivatives, \(K_X^{(j)}(t), j = 1 \ldots k\), of a random variable \(X\), following a Fisher \(z\) distribution.
\[K_X(t) = \log \left(\Gamma\left(\tfrac{1}{2}(n-t)\right)\right) + \log \left(\Gamma\left(\tfrac{1}{2}(m+t)\right)\right) + \tfrac{1}{2}t \left(\log(n)-\log(m)\right) -\log\left(\Gamma\left(\tfrac{1}{2}n\right)\right) -\log\left(\Gamma\left(\tfrac{1}{2}m\right)\right).\]\[K^{(1)}_X(t) = \tfrac{1}{2} \left(-\psi^{(0)} \left(\tfrac{1}{2}n-t\right) + \psi^{(0)} \left(\tfrac{1}{2}m+t\right) \right) + \tfrac{1}{2} \left(\log(n) - \log(m)\right),\]\[K^{(j)}_X(t) = 2^{-j} \left((-1)^j \psi^{(j-1)} \left(\tfrac{1}{2}n-t\right) + \psi^{(j-1)} \left(\tfrac{1}{2}m+t\right) \right), \quad j \ge 2,\]where \(\psi^{(r)}(\cdot)\) is the polygamma function of order \(r\).
>>> from mpfunlab import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; q = 0.3; >>> print ("isf: ", fisher_f(mu, sigma).isf(q)) 6.3563523462564525615615615614561356E+00
- dist_fisher_z.moments(k)#
Returns the first \(j\) raw moments, \(\mu_j, j = 1 \ldots k\), of a random variable \(X\), following a Fisher \(z\) distribution. The moments are calculated from the cumulants.
>>> from mpfunlab import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; q = 0.3; >>> print ("isf: ", fisher_f(mu, sigma).isf(q)) 6.3563523462564525615615615614561356E+00
- dist_fisher_z.cumulants(k)#
Returns the first \(j\) cumulants, \(\kappa_j, j = 1 \ldots k\), of a random variable \(X\), following a Fisher \(z\) distribution.
\[\kappa_1 = \tfrac{1}{2} \left(-\psi^{(0)} \left(\tfrac{1}{2}n\right) + \psi^{(0)} \left(\tfrac{1}{2}m\right) \right) + \tfrac{1}{2} \left(\log(n) - \log(m)\right),\]\[\kappa_r = 2^{-r} \left((-1)^r \psi^{(r-1)} \left(\tfrac{1}{2}n\right) + \psi^{(r-1)} \left(\tfrac{1}{2}m\right) \right), \quad r \ge 2,\]where \(\psi^{(r)}(\cdot)\) is the polygamma function of order \(r\).
>>> from mpfunlab import * >>> mp.dps = 30 >>> mu = 0; sigma = 1; q = 0.3; >>> print ("isf: ", fisher_f(mu, sigma).isf(q)) 6.3563523462564525615615615614561356E+00
Aroian gives the following approximations for the cumulants, for \(n \ge 2, m \ge 2\):
\[\kappa_1 \approx \frac{1}{2}\left(\frac{1}{n}-\frac{1}{m}\right) + \frac{1}{6}\left(\frac{1}{n^2}-\frac{1}{m^2}\right) - \frac{1}{15}\left(\frac{1}{n^4}-\frac{1}{m^4}\right) + \frac{8}{63}\left(\frac{1}{n^6}-\frac{1}{m^6}\right),\]\[\kappa_r \approx \frac{(r-2)!}{2}\left(\frac{n+r-1}{n^r} + (-1)^r\frac{m+r-1}{m^r}\right) + \frac{r!}{6}\left(\frac{1}{n^{r+1}} + \frac{(-1)^r}{m^{r+1}}\right) - \frac{(r+2)!}{90}\left(\frac{1}{n^{r+3}} + \frac{(-1)^r}{m^{r+3}}\right), \quad r \ge 2.\]
Approximations
- ctx.fisher_z_ecf(x, m, n, results='cdf')#
where
ctxisipm,dec,mpm, orgmp.Calculates the Edgeworth approximation to the pdf, cdf and sf.
- ctx.fisher_z_ecf_inv(q, m, n, results='qtf')#
where
ctxisipm,dec,mpm, orgmp.Calculates the Cornish-Fisher approximation to the qtf and isf.
- ctx.fisher_z_spa(x, n, results='c')#
where
ctxisfpm,mpm,ipm,dec,gmporapm.Calculates the Luggannini-Rice saddlepoint approximation of the pdf, cdf and sf.
- ctx.fisher_z_spa_inv(x, n, results='qtf')#
where
ctxisfpm,mpm,ipm,dec,gmporapm.Calculates the inverse Jensen saddlepoint approximation of the qtf and isf.