# 5.31: The Hyperbolic Secant Distribution

$$\newcommand{\R}{\mathbb{R}}$$ $$\newcommand{\N}{\mathbb{N}}$$ $$\newcommand{\Z}{\mathbb{Z}}$$ $$\newcommand{ \E}{\mathbb{E}}$$ $$\newcommand{\P}{\mathbb{P}}$$ $$\newcommand{\var}{\text{var}}$$ $$\newcommand{\sd}{\text{sd}}$$ $$\newcommand{\bs}{\boldsymbol}$$ $$\newcommand{\sgn}{\text{sgn}}$$ $$\newcommand{\skw}{\text{skew}}$$ $$\newcommand{\kur}{\text{kurt}}$$ $$\newcommand{\sech}{\text{sech}}$$

The hyperbolic secant distribution is a location-scale familty with a number of interesting parallels to the normal distribution. As the name suggests, the hyperbolic secant function plays an important role in the distribution, so we should first review some definitions

The hyperbolic trig functions sinh, cosh, tanh, and sech are defined as follows, for $$x \in \R$$ \begin{align} \sinh x & = \frac{1}{2}(e^x - e^{-x}) \\ \cosh x & = \frac{1}{2}(e^x + e^{-x}) \\ \tanh x & = \frac{\sinh x}{\cosh x} = \frac{e^x - e^{-x}}{e^x + e^{-x}} \\ \sech \, x & = \frac{1}{\cosh x} = \frac{2}{e^x + e^{-x}} \end{align}

## The Standard Hyperbolic Secant Distribution

### Distribution Functions

The standard hyperbolic secant distribution is a continuous distribution on $$\R$$ with probability density function $$g$$ given by $g(z) = \frac{1}{2} \sech\left(\frac{\pi}{2} z\right), \quad z \in \R$

1. $$g$$ is symmetric about 0.
2. $$g$$ increases and then decreases with mode $$z = 0$$.
3. $$g$$ is concave upward then downward then upward again, with inflection points at $$z = \pm \frac{2}{\pi} \ln\left(\sqrt{2} + 1\right) \approx \pm 0.561$$.
Proof

If we multiply numerator and denominator of $$\sech(x)$$ by $$e^x$$ and then use the simple substitution $$u = e^x$$ we see that $\int \sech(x) \, dx = \int 2 \frac{e^x}{e^{2x} + 1} \, dx = 2 \int \frac{1}{u^2 + 1} \, du = 2 \arctan(u) = 2 \arctan(e^x)$ It follows that $\int_{-\infty}^\infty g(z) \, dz = \frac{2}{\pi} \arctan\left(\frac{\pi}{2} e^z\right) \biggm|_{-\infty}^\infty = 1$ The properties of $$g$$ result follow from standard calculus. Recall that $$\sech^\prime = -\tanh \sech$$ and $$\tanh^\prime = \sech^2$$.

So $$g$$ has the classic unimodal shape. Recall that the inflection points in the standard normal probability density function are $$\pm 1$$. Compared to the standard normal distribution, the hyperbolic secant distribution is more peaked at the mode 0 but has fatter tails.

Open the special distribution simulator and select the hyperbolic secant distribtion. Keep the default parameter settings and note the shape and location of the probability density function. Run the simulation 1000 times and compare the empirical density function to the probability density function.

The distribution function $$G$$ of the standard hyperbolic secant distribution is given by $G(z) = \frac{2}{\pi} \arctan\left[\exp\left(\frac{\pi}{2} z\right)\right], \quad z \in \R$

Proof

Of course, $$G(z) = \int_{-\infty}^z g(x) \, dx$$. The form of $$G$$ follows from the same integration methods used for the PDF.

The quantile function $$G^{-1}$$ of the standard hyperbolic secant distribution is given by $G^{-1}(p) = \frac{2}{\pi} \ln\left[\tan\left(\frac{\pi}{2} p\right)\right], \quad p \in (0, 1)$

1. The first quartile is $$G^{-1}\left(\frac{1}{4}\right) = -\frac{2}{\pi} \ln\left(1 + \sqrt{2}\right) \approx -0.561$$
2. The median is $$G^{-1}\left(\frac{1}{2}\right) = 0$$
3. The third quartile is $$G^{-1}\left(\frac{3}{4}\right) = \frac{2}{\pi} \ln\left(1 + \sqrt{2}\right) \approx 0.561$$
Proof

The formula for $$G^{-1}$$ follows by solving $$G(z) = p$$ for $$z$$ in terms of $$p$$. For the quartiles, note that $$\tan(\pi/8) = \sqrt{2} - 1 = 1 / (\sqrt{2} + 1)$$ and $$\tan(3 \pi / 8) = \sqrt{2} + 1$$.

Of course, the fact that the median is 0 also follows from the symmetry of the distribution, as does the relationship between the first and third quartiles. In general, $$G^{-1}(1 - p) = - G^{-1}(p)$$ for $$p \in (0, 1)$$. Note that the first and third quartiles coincide with the inflection points, whereas in the normal distribution, the inflection points are at $$\pm 1$$ and coincide with the standard deviation.

Open the sepcial distribution calculator and select the hyperbolic secant distribution. Keep the default values of the parameters and note the shape of the distribution and probability density functions. Compute a few values of the distribution and quantile functions.

### Moments

Suppose that $$Z$$ has the standard hyperbolic secant distribution. The moments of $$Z$$ are easiest to compute from the generating functions.

The characteristic function $$\chi$$ of $$Z$$ is the hyperbolic secant function: $\chi(t) = \sech(t), \quad t \in \R$

Proof

The charateristic function is $\chi(t) = \E\left(e^{i t Z}\right) = \int_{-\infty}^\infty \frac{e^{i t z}}{e^{\pi z / 2} + e^{-\pi z / 2}} \, dz$ The evaluation of this integral to $$\sech(t)$$ is complicated, but the details can be found in the book Continuous Univariate Distributions by Johnson, Kotz, and Balakrishnan.

Note that the probability density function can be obtained from the characteristic function by a scale transformation: $$g(z) = \frac{1}{2} \chi\left(\frac{\pi}{2} z\right)$$ for $$z \in R$$. This is another curious simularity to the normal distribution: the probability density function $$\phi$$ and characteristic function $$\chi$$ of the standard normal distribution are related by $$\phi(z) = \frac{1}{\sqrt{2 \pi}} \chi(z)$$.

The moment generating function $$m$$ of $$Z$$ is the secant function: $m(t) = \E\left(e^{tZ}\right) = \sec(t), \quad t \in \left(-\frac{\pi}{2}, \frac{\pi}{2}\right)$

Proof

This follows from the characteristic function since $$m(t) = \chi(-i t)$$.

It follows that $$Z$$ has moments of all orders, and then by symmetry, that the odd order moments are all 0.

The mean and variance of $$Z$$ are

1. $$\E(Z) = 0$$
2. $$\var(Z) = 1$$
Proof

As noted, the mean is 0 by symmetry. Hence also $$\var(Z) = \E(Z^2) = m^{\prime\prime}(0)$$. But $$m^{\prime\prime}(t) = \sec(t) \tan^2(t) + \sec^3(t)$$, so $$\var(Z) = 1$$.

Thus, the standard hyperbolic secant distribution has mean 0 and variance 1, just like the standard normal distribution.

Open the special distribution simulator and select the hyperbolic secant distribution. Keep the default parameters and note the size and location of the mean $$\pm$$ standard deviation bar. Run the simulation 1000 times compare the empirical mean and standard deviation to the distribution mean and standard deviation.

The skewness and kurtosis of $$Z$$ are

1. $$\skw(Z) = 0$$
2. $$\kur(Z) = 5$$
Proof

The skewness is 0 by the symmetry of the distribution. Also, since the mean is 0 and the variance 1, $$\kur(Z) = \E\left(Z^4\right) = m^{(4)}(0)$$. But by standard calculus, $m^{(4)}(t) = \sec(t) \tan^4(t) + 18 \sec^3(t) \tan^2(t) + 5 \sec^5(t)$ and hence $$m^{(4)}(0) = 5$$.

Recall that the kurtosis of the standard normal distribution is 3, so the excess kurtosis of the standard hyperbolic secant distribution is $$\kur(Z) - 3 = 2$$. This distribution is more sharply peaked at the mean 0 and has fatter tails, compared with the normal.

### Related Distributions

The standard hyperbolic secant distribution has the usual connections with the standard uniform distribution by means of the distribution function and the quantile function computed above.

The standard hyperbolic secant distribution is related to the standard uniform distribution as follows:

1. If $$Z$$ has the standard hyperbolic secant distribution then $U = G(Z) = \frac{2}{\pi} \arctan\left[\exp\left(\frac{\pi}{2} Z\right)\right]$ has the standard uniform distribution.
2. If $$U$$ has the standard uniform distribution then $Z = G^{-1}(U) = \frac{2}{\pi} \ln\left[\tan\left(\frac{\pi}{2} U\right)\right]$ has the standard hyperbolic secant distribution.

Since the quantile function has a simple closed form, the standard hyperbolic secant distribution can be easily simulated by means of the random quantile method.

Open the random quantile experiment and select the hyperbolic secant distribution. Keep the default parameter values and note again the shape of the probability density and distribution functions. Run the experiment 1000 times and compare the empirical density function, mean, and standard deviation to their distributional counterparts.

## The General Hyperbolic Secant Distribution

The standard hyperbolic secant distribution is generalized by adding location and scale parameters.

Suppose that $$Z$$ has the standard hyperbolic secant distribution and that $$\mu \in \R$$ and $$\sigma \in (0, \infty)$$. Then $$X = \mu + \sigma Z$$ has the hyperbolic secant distribution with location parameter $$\mu$$ and scale parameter $$\sigma$$.

### Distribution Functions

Suppose that $$X$$ has the hyperbolic secant distribution with location parameter $$\mu \in \R$$ and scale parameter $$\sigma \in (0, \infty)$$.

The probability density function $$f$$ of $$X$$ is given by $f(x) = \frac{1}{2 \sigma} \sech\left[\frac{\pi}{2}\left(\frac{x - \mu}{\sigma}\right)\right], \quad x \in \R$

1. $$f$$ is symmetric about $$\mu$$.
2. $$f$$ increases and then decreases with mode $$x = \mu$$.
3. $$f$$ is concave upward then downward then upward again, with inflection points at $$x = \mu \pm \frac{2}{\pi} \ln\left(\sqrt{2} + 1\right) \sigma \approx \mu \pm 0.561 \sigma$$.
Proof

Recall that $$f(x) = \frac{1}{\sigma}g\left(\frac{x - \mu}{\sigma}\right)$$ for $$x \in \R$$ where $$g$$ is the standard hyperbolic secant PDF.

Open the special distribution simulator and select the hyperbolic secant distribution. Vary the parameters and note the shape and location of the probability density function. For selected values of the parameters, run the simulation 1000 times and compare the empirical density function to the probability density function.

The distribution function $$F$$ of $$X$$ is given by $F(x) = \frac{2}{\pi} \arctan\left\{\exp\left[\frac{\pi}{2}\left(\frac{x - \mu}{\sigma}\right)\right]\right\}, \quad x \in \R$

Proof

Recall that $$F(x) = G\left(\frac{x - \mu}{\sigma}\right)$$ for $$x \in \R$$ where $$G$$ is the standard hyperbolic secant CDF.

The quantile function $$F^{-1}$$ of $$X$$ is given by $F^{-1}(p) = \mu + \sigma \frac{2}{\pi} \ln\left[\tan\left(\frac{\pi}{2} p\right)\right], \quad p \in (0, 1)$

1. The first quartile is $$F^{-1}\left(\frac{1}{4}\right) = \mu - \frac{2}{\pi} \ln\left(1 + \sqrt{2}\right) \sigma \approx \mu -0.561 \sigma$$
2. The median is $$F^{-1}\left(\frac{1}{2}\right) = \mu$$
3. The third quartile is $$F^{-1}\left(\frac{3}{4}\right) = \mu + \frac{2}{\pi} \ln\left(1 + \sqrt{2}\right) \sigma \approx \mu + 0.561 \sigma$$
Proof

Recall that $$F^{-1}(p) = \mu + \sigma G^{-1}(p)$$ where $$G^{-1}$$ is the standard quantile function.

Open the sepcial distribution calculator and select the hyperbolic secant distribution. Vary the parameters and note the shape of the distribution and density functions. For various values of the parameters, compute a few values of the distribution and quantile functions.

### Moments

Suppose again that $$X$$ has the hyperbolic secant distribution with location parameter $$\mu \in \R$$ and scale parameter $$\sigma \in (0, \infty)$$.

The moment generating function $$M$$ of $$X$$ is given by $M(t) = e^{\mu t} \sec(\sigma t), \quad t \in \left(-\frac{\pi}{2 \sigma}, \frac{\pi}{2 \sigma}\right)$

Proof

Recall that $$M(t) = e^{\mu t} m(\sigma t)$$ where $$m$$ is the standard hyperbolic secant MGF.

Just as in the normal distribution, the location and scale parameters are the mean and standard deviation, respectively.

The mean and variance of $$X$$ are

1. $$\E(X) = \mu$$
2. $$\var(X) = \sigma^2$$
Proof

These results follow from the representation $$X = \mu + \sigma Z$$ where $$Z$$ has the standard hyperbolic secant distribution, basic properties of expected value and variance, and the mean and variance of $$Z$$:

1. $$\E(X) = \mu + \sigma \E(Z) = \mu$$
2. $$\var(X) = \sigma^2 \var(Z) = \sigma^2$$

Open the special distribution simulator and select the hyperbolic secant distribution. Vary the parameters and note the size and location of the mean $$\pm$$ standard deviation bar. For selected values of the parameters, run the simulation 1000 times and compare the empirical mean and standard deviation to the distribution mean and standard deviation.

The skewness and kurtosis of $$X$$ are

1. $$\skw(X) = 0$$
2. $$\kur(X) = 5$$
Proof

Recall that skewness and kurtosis are defined in terms of the standard score, and hence are invariant under location-scale transformations. Thus, the skewness and kurtosis of $$X$$ are the same as the skewness and kurtosis of the standard distribution.

Once again, the excess kurtosis is $$\kur(X) - 3 = 2$$

### Related Distributions

Since the hyperbolic secant distribution is a location-scale family, it is trivially closed under location-scale transformations.

Suppose that $$X$$ has the hyperbolic secant distribution with location parameter $$\mu \in \R$$ and scale parameter $$\sigma \in (0, \infty)$$, and that $$a \in \R$$ and $$b \in (0, \infty)$$. Then $$Y = a + b X$$ has the hyperbolic secant distribution with location parameter $$a + b \mu$$ and scale parameter $$b \sigma$$.

Proof

By definition, we can take $$X = \mu + \sigma Z$$ where $$Z$$ has the standard hyperbolic secant distribution. Hence $$Y = a + b X = (a + b \mu) + (b \sigma) Z$$.

The hyperbolic secant distribution has the usual connections with the standard uniform distribution by means of the distribution function and the quantile function computed above.

Suppose that $$\mu \in \R$$ and $$\sigma \in (0, \infty)$$.

1. If $$X$$ has the hyperbolic secant distribution with location parameter $$\mu$$ and scale parameter $$\sigma$$ then $U = F(X) = \frac{2}{\pi} \arctan\left\{\exp\left[\frac{\pi}{2}\left(\frac{X - \mu}{\sigma}\right)\right]\right\}$ has the standard uniform distribution.
2. If $$U$$ has the standard uniform distribution then $X = F^{-1}(U) = \mu + \sigma \frac{2}{\pi} \ln\left[\tan\left(\frac{\pi}{2} U\right)\right]$ has the hyperbolic secant distribution with location parameter $$\mu$$ and scale parameter $$\sigma$$.

Since the quantile function has a simple closed form, the hyperbolic secant distribution can be easily simulated by means of the random quantile method.

Open the random quantile experiment and select the hyperbolic secant distribution. Vary the parameters and note again the shape of the probability density and distribution functions. Run the experiment 1000 times and compare the empirical density function, mean, and standard deviation to their distributional counterparts.