# Variance of Logistic Distribution

Jump to navigation Jump to search

## Theorem

Let $X$ be a continuous random variable which satisfies the logistic distribution:

$X \sim \map {\operatorname {Logistic} } {\mu, s}$

The variance of $X$ is given by:

$\var X = \dfrac {s^2 \pi^2} 3$

### Lemma 1

$\ds \int_{\to 0}^{\to 1} \map {\ln^2} {1 - u} \rd u = 2$

### Lemma 2

$\ds \int_{\to 0}^{\to 1} \map {\ln^2} u \rd u = 2$

### Lemma 3

$\ds \int_{\to 0}^{\to 1} \map \ln u \map \ln {1 - u} \rd u = 2 - \dfrac {\pi^2} 6$

### Lemma 4

$\ds \int_{\to 0}^{\to 1} \map {\ln^2} {\dfrac {1 - u} u} \rd u = \dfrac {\pi^2} 3$

## Proof 1

From the definition of the logistic distribution, $X$ has probability density function:

$\map {f_X} x = \dfrac {\map \exp {-\dfrac {\paren {x - \mu} } s} } {s \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2}$
$\ds \var X = \int_{-\infty}^\infty x^2 \, \map {f_X} x \rd x - \paren {\expect X}^2$

So:

$\ds \var X = \frac 1 s \int_{-\infty}^\infty \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x - \mu^2$

let:

 $\ds u$ $=$ $\ds \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^{-1}$ Integration by Substitution $\ds \leadsto \ \$ $\ds \frac {\d u} {\d x}$ $=$ $\ds -\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^{-2} \paren {-\frac 1 s \map \exp {-\dfrac {\paren {x - \mu} } s} }$ Power Rule for Derivatives, Chain Rule for Derivatives and Derivative of Exponential Function: Corollary 1 $\ds \leadsto \ \$ $\ds \dfrac 1 u - 1$ $=$ $\ds \paren {\map \exp {-\dfrac {\paren {x - \mu} } s} }$ $\ds \leadsto \ \$ $\ds \map \ln {\dfrac 1 u - 1}$ $=$ $\ds -\dfrac {\paren {x - \mu} } s$ $\ds \leadsto \ \$ $\ds -s \map \ln {\dfrac {1 - u} u} + \mu$ $=$ $\ds x$ $\ds \leadsto \ \$ $\ds \mu^2 -2 s \mu \map \ln {\dfrac {1 - u} u} + s^2 \map {\ln^2} {\dfrac {1 - u} u}$ $=$ $\ds x^2$

and also:

 $\ds \lim_{x \mathop \to -\infty} \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^{-1}$ $=$ $\ds 0$ $\ds \lim_{x \mathop \to \infty} \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^{-1}$ $=$ $\ds 1$

Then:

 $\ds \var X$ $=$ $\ds \int_{\to 0}^{\to 1} \paren {\mu^2 - 2 s \mu \map \ln {\dfrac {1 - u} u} + s^2 \map {\ln^2} {\dfrac {1 - u} u} } \rd u - \mu^2$ $\ds$ $=$ $\ds \mu^2 \int_{\to 0}^{\to 1} \rd u - 2 s \mu \int_{\to 0}^{\to 1} \map \ln {\dfrac {1 - u} u} \rd u + s^2 \int_{\to 0}^{\to 1} \map {\ln^2} {\dfrac {1 - u} u} \rd u - \mu^2$ $\ds$ $=$ $\ds \mu^2 - 2 s \mu \paren {\int_{\to 0}^{\to 1} \map \ln {1 - u} \rd u - \int_{\to 0}^{\to 1} \map \ln u \rd u } + s^2 \paren {\int_{\to 0}^{\to 1} \map {\ln^2} {1 - u} \rd u - 2 \int_{\to 0}^{\to 1} \map \ln {1 - u} \map \ln u \rd u + \int_{\to 0}^{\to 1} \map {\ln^2} u \rd u } - \mu^2$ Definite Integral of Constant and Difference of Logarithms $\ds$ $=$ $\ds \mu^2 - 2 s \mu \paren {\paren {-1} - \paren {-1} } + s^2 \paren {2 - 2 \paren {2 - \dfrac {\pi^2} 6 } + 2 } - \mu^2$ Expectation of Logistic Distribution:Lemma 1, Expectation of Logistic Distribution:Lemma 2, Lemma 1, Lemma 2 and Lemma 3 $\ds$ $=$ $\ds \dfrac {s^2 \pi^2} 3$

$\blacksquare$

## Proof 2

By Moment Generating Function of Logistic Distribution, the moment generating function of $X$ is given by:

$\ds \map {M_X} t = \map \exp {\mu t} \int_{\to 0}^{\to 1} \paren {\dfrac {1 - u} u}^{-s t} \rd u$

for $\size t < \dfrac 1 s$.

$\ds \var X = \expect {X^2} - \paren {\expect X}^2$

From Expectation of Logistic Distribution, we have:

$\expect X = \mu$
$\ds \map { {M_X}''} t = \map \exp {\mu t} \paren {\mu^2 \int_{\to 0}^{\to 1} \paren {\dfrac {1 - u} u}^{-s t} \rd u - 2 s \mu \int_{\to 0}^{\to 1} \map \ln {\dfrac {1 - u} u} \paren {\dfrac {1 - u} u}^{-s t} \rd u + s^2 \int_{\to 0}^{\to 1} \map {\ln^2} {\dfrac {1 - u} u} \paren {\dfrac {1 - u} u}^{-s t} \rd u}$

Hence setting $t = 0$:

 $\ds \map { {M_X}''} 0$ $=$ $\ds \mu^2 \int_{\to 0}^{\to 1} \rd u - 2 s \mu \int_{\to 0}^{\to 1} \map \ln {\dfrac {1 - u} u} \rd u + s^2 \int_{\to 0}^{\to 1} \map {\ln^2} {\dfrac {1 - u} u} \rd u$ $\ds$ $=$ $\ds \mu^2 - 2 s \mu \paren {0 } + s^2 \paren {\dfrac {\pi^2} 3}$ Definite Integral of Constant, Expectation of Logistic Distribution/Lemma 3 and Lemma 4 $\ds$ $=$ $\ds \mu^2 + \dfrac {s^2 \pi^2} 3$

So:

 $\ds \var X$ $=$ $\ds \mu^2 + \dfrac {s^2 \pi^2} 3 - \mu^2$ $\ds$ $=$ $\ds \dfrac {s^2 \pi^2} 3$

$\blacksquare$

## Proof 3

From the definition of the logistic distribution, $X$ has probability density function:

$\map {f_X} x = \dfrac {\map \exp {-\dfrac {\paren {x - \mu} } s} } {s \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2}$
$\ds \var X = \int_{-\infty}^\infty x^2 \, \map {f_X} x \rd x - \paren {\expect X}^2$

So:

 $\ds \var X$ $=$ $\ds \frac 1 s \int_{-\infty}^\infty \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x - \mu^2$ $\ds$ $=$ $\ds \frac 1 s \paren {\int_{-\infty}^\mu \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x + \int_\mu^\infty \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x} - \mu^2$ Sum of Integrals on Adjacent Intervals for Integrable Functions $\ds$ $=$ $\ds \frac 1 s \paren {\int_\mu^\infty \dfrac {x^2 \map \exp {\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {\dfrac {\paren {x - \mu} } s} }^2} \rd x + \int_\mu^\infty \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x} - \mu^2$ rewriting the first integral $\ds$ $=$ $\ds \frac 1 s \paren {\int_\mu^\infty \dfrac {x^2 \map \exp {\dfrac {\paren {x - \mu} } s} } {\map \exp {\dfrac {2 \paren {x - \mu} } s} \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x + \int_\mu^\infty \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x} - \mu^2$ extracting $\map \exp {\dfrac {2 \paren {x - \mu} } s}$ from the denominator of the first integral $\ds$ $=$ $\ds \frac 2 s \paren {\int_\mu^\infty \dfrac {x^2 \map \exp {-\dfrac {\paren {x - \mu} } s} } {\paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2} \rd x} - \mu^2$ simplifying

From Sum of Infinite Geometric Sequence, for $x > \mu$, we have:

$\ds \sum_{n \mathop = 0}^\infty \paren {-1}^n \map \exp {-\dfrac {\paren {x - \mu} } s}^n = \dfrac 1 {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }$

Taking the derivative of both sides, we have:

 $\ds \sum_{n \mathop = 0}^\infty \paren {-\dfrac n s} \paren {-1}^n \map \exp {-\dfrac {\paren {x - \mu} } s}^n$ $=$ $\ds \dfrac { \map \exp {-\dfrac {\paren {x - \mu} } s} } {s \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2}$ $\ds \dfrac 1 s \sum_{n \mathop = 1}^\infty n \paren {-1}^{n + 1} \map \exp {-\dfrac {\paren {x - \mu} } s}^n$ $=$ $\ds \dfrac { \map \exp {-\dfrac {\paren {x - \mu} } s} } {s \paren {1 + \map \exp {-\dfrac {\paren {x - \mu} } s} }^2}$ simplifying

Therefore:

 $\ds \var X$ $=$ $\ds \frac 2 s \paren {\int_\mu^\infty x^2 \sum_{n \mathop = 1}^\infty n \paren {-1}^{n + 1} \map \exp {-\dfrac {\paren {x - \mu} } s}^n \rd x} - \mu^2$ substitution from above $\ds$ $=$ $\ds \frac 2 s \paren {\sum_{n \mathop = 1}^\infty n \paren {-1}^{n + 1} \map \exp {\dfrac {n \mu} s} \int_\mu^\infty x^2 \map \exp {-\dfrac {n x } s} \rd x} - \mu^2$ Fubini's Theorem $\ds$ $=$ $\ds \frac 2 s \paren {\sum_{n \mathop = 1}^\infty n \paren {-1}^{n + 1} \map \exp {\dfrac {n \mu} s} \bigintlimits {-\dfrac s n \map \exp {-\dfrac {n x } s} \paren {x^2 + \frac {2 x s} n + \frac {2 s^2} {n^2} } } \mu \infty } - \mu^2$ Primitive of x squared by Exponential of a x $\ds$ $=$ $\ds \frac 2 s \paren {\sum_{n \mathop = 1}^\infty n \paren {-1}^{n + 1} \map \exp {\dfrac {n \mu} s} \paren {0 + \dfrac s n \map \exp {-\dfrac {n \mu } s} \paren {\mu^2 + \frac {2 \mu s} n + \frac {2 s^2} {n^2} } } } - \mu^2$ $\ds$ $=$ $\ds 2 \paren {\sum_{n \mathop = 1}^\infty \paren {-1}^{n + 1} \paren {\mu^2 + \frac {2 \mu s} n + \frac {2 s^2} {n^2} } } - \mu^2$ $\ds$ $=$ $\ds 2 \mu^2 \paren {\sum_{n \mathop = 1}^\infty \paren {-1}^{n + 1} } + 4 \mu s \paren {\sum_{n \mathop = 1}^\infty \paren {-1}^{n + 1} \dfrac 1 n } + 4 s^2 \paren {\sum_{n \mathop = 1}^\infty \paren {-1}^{n + 1} \dfrac 1 {n^2} } - \mu^2$ $\ds$ $=$ $\ds 2 \mu^2 \paren {\dfrac 1 2 } + 4 \mu s \paren {\ln 2} + 4 s^2 \paren {\dfrac {\pi^2} {12} } - \mu^2$ Sum of Reciprocals of Squares Alternating in Sign and Definition of Mercator's Constant $\ds$ $=$ $\ds 4 \mu s \ln 2 + \dfrac {s^2 \pi^2} 3$

$\blacksquare$