SciPy

Hyperbolic Secant DistributionΒΆ

Related to the logistic distribution and used in lifetime analysis. Standard form is (defined over all \(x\) )

\[ \begin{eqnarray*} f\left(x\right) & = & \frac{1}{\pi}\mathrm{sech}\left(x\right)\\ F\left(x\right) & = & \frac{2}{\pi}\arctan\left(e^{x}\right)\\ G\left(q\right) & = & \log\left(\tan\left(\frac{\pi}{2}q\right)\right)\end{eqnarray*}\]
\[M\left(t\right)=\sec\left(\frac{\pi}{2}t\right)\]
\[ \begin{eqnarray*} \mu_{n}^{\prime} & = & \frac{1+\left(-1\right)^{n}}{2\pi2^{2n}}n!\left[\zeta\left(n+1,\frac{1}{4}\right)-\zeta\left(n+1,\frac{3}{4}\right)\right]\\ & = & \left\{ \begin{array}{cc} 0 & n\mathrm{ odd}\\ C_{n/2}\frac{\pi^{n}}{2^{n}} & n\mathrm{ even}\end{array}\right.\end{eqnarray*}\]

where \(C_{m}\) is an integer given by

\[ \begin{eqnarray*} C_{m} & = & \frac{\left(2m\right)!\left[\zeta\left(2m+1,\frac{1}{4}\right)-\zeta\left(2m+1,\frac{3}{4}\right)\right]}{\pi^{2m+1}2^{2m}}\\ & = & 4\left(-1\right)^{m-1}\frac{16^{m}}{2m+1}B_{2m+1}\left(\frac{1}{4}\right)\end{eqnarray*}\]

where \(B_{2m+1}\left(\frac{1}{4}\right)\) is the Bernoulli polynomial of order \(2m+1\) evaluated at \(1/4.\) Thus

\[\begin{split}\mu_{n}^{\prime}=\left\{ \begin{array}{cc} 0 & n\mathrm{ odd}\\ 4\left(-1\right)^{n/2-1}\frac{\left(2\pi\right)^{n}}{n+1}B_{n+1}\left(\frac{1}{4}\right) & n\mathrm{ even}\end{array}\right.\end{split}\]
\[ \begin{eqnarray*} m_{d}=m_{n}=\mu & = & 0\\ \mu_{2} & = & \frac{\pi^{2}}{4}\\ \gamma_{1} & = & 0\\ \gamma_{2} & = & 2\end{eqnarray*}\]
\[h\left[X\right]=\log\left(2\pi\right).\]

Implementation: scipy.stats.hypsecant