# $\mathbb{E}(\log(X_{max}/X_{min}) )$ of Weibull(alpha, 1)

I'm trying to find the expectation of log(max/min) from n samples of Weibull(alpha, 1).

But I keep failing. Can anybody give some hints?

I tried:

$\mathbb{E}(\log(X_{max}/X_{min}) ) = \int_0^{\infty} P(\log(X_{max}/X_{min}) > y)dy$

• Looks like this needs the self-study tag. – StubbornAtom Jul 16 '18 at 4:29
• Why do you say that? – wolfies Jul 16 '18 at 4:50
• @wolfies Because presumably OP is 'self-studying'. Whatever that means here. – StubbornAtom Jul 16 '18 at 6:19
• By that broad defn, all questions on Stack exchange would be self-study, and the tag would have no purpose. My understanding is that the tag 'self-study' is a euphemism for doing homework, and this is not a homework problem, unless one again takes a very broad definition of that term, and the OP is presently at home while working on it ;) – wolfies Jul 16 '18 at 6:28
• @wolfies You are right. Maybe I need to get better at identifying 'self-study' questions. It's just that I had tagged a lot of my own posts with that tag and none of them were my 'homework' or some kind of assignment to be done. – StubbornAtom Jul 16 '18 at 6:49

Simplifying the problem: The Weibull distribution with unit shape is the exponential distribution, so your specified sampling mechanism is equivalent to $X_1, ..., X_n \sim \text{IID Exp}(\text{Scale} = \alpha)$. For all arguments $x \geqslant 0$ you have the density and distribution functions:

$$f_X(x) = \frac{1}{\alpha} \cdot \exp \Big( - \frac{x}{\alpha} \Big) \quad \quad \quad \quad F_X(x) = 1-\exp \Big( - \frac{x}{\alpha} \Big) .$$

Now, write the order statistics in standard notation as $X_{(1)} \leqslant \cdots \leqslant X_{(n)}$. Since the logarithmic transformation is an increasing function, the order of the original $X$ values is preserved under the transformation. Hence, using the properties of the logarithm, and the linearity property of the expectation operator, you have:

$$\mathbb{E}(\ln (X_{\max}/X_{\min})) = \mathbb{E}(\ln X_{(n)} - \ln X_{(1)}) = \mathbb{E}(\ln X_{(n)}) - \mathbb{E}(\ln X_{(1)}).$$

This means that your problem reduces to one of finding the moments of transformed order statistics. This can be solved using standard methods for dealing with order statistics.

Finding the distribution of the order statistics: Using standard formulae for the distribution of the order statistics we have:

\begin{aligned} f_{X_{(1)}}(x) &= n (1-F_X(x))^{n-1} f_X(x) \\[6pt] &= \frac{n}{\alpha} \cdot \exp \Big( - \frac{nx}{\alpha} \Big), \\[10pt] f_{X_{(n)}}(x) &= n F_X(x)^{n-1} f_X(x) \\[6pt] &= \frac{n}{\alpha} \cdot \exp \Big( - \frac{x}{\alpha} \Big) \Big( 1 - \exp \Big( - \frac{x}{\alpha} \Big) \Big)^{n-1} \\[6pt] &= \frac{n}{\alpha} \cdot \exp \Big( - \frac{x}{\alpha} \Big) \sum_{k=0}^{n-1} {n-1 \choose k} (-1)^k \exp \Big( - \frac{kx}{\alpha} \Big) \\[6pt] &= \frac{n}{\alpha} \sum_{k=1}^{n} {n-1 \choose k-1} (-1)^{k-1} \exp \Big( - \frac{kx}{\alpha} \Big) \\[6pt] &= \sum_{k=1}^{n} {n \choose k} (-1)^{k-1} \cdot \frac{k}{\alpha} \cdot \exp \Big( - \frac{kx}{\alpha} \Big). \end{aligned}

Finding the moments: Using the change of variable $r = nx/\alpha$ we have:

\begin{aligned} \mathbb{E}(\ln X_{(1)}) &= \int \limits_0^\infty \ln(x) f_{X_{(1)}}(x) dx \\[6pt] &= \frac{n}{\alpha} \int \limits_0^\infty \ln(x) \exp \Big( - \frac{nx}{\alpha} \Big) dx \\[6pt] &= \int \limits_0^\infty \ln \Big( \frac{\alpha r}{n} \Big) \exp (-r) dr \\[6pt] &= \int \limits_0^\infty \ln (r) \exp (-r) dr - \ln \Big( \frac{n}{\alpha} \Big) \int \limits_0^\infty \exp (-r) dr \\[6pt] &= - \gamma + \ln \alpha - \ln n, \\[6pt] \end{aligned}

where $\gamma$ is the Euler-Mascheroni constant. Applying this same integral result we then have:

\begin{aligned} \mathbb{E}(\ln X_{(n)}) &= \int \limits_0^\infty \ln(x) f_{X_{(n)}}(x) dx \\[6pt] &= \sum_{k=1}^{n} {n \choose k} (-1)^{k-1} \cdot \frac{k}{\alpha} \int \limits_0^\infty \ln(x) \exp \Big( - \frac{kx}{\alpha} \Big) dx \\[6pt] &= \sum_{k=1}^{n} {n \choose k} (-1)^{k-1} \Big[ -\gamma + \ln \alpha - \ln k \Big] \\[6pt] &= (-\gamma + \ln \alpha) \sum_{k=1}^{n} {n \choose k} (-1)^{k-1} - \sum_{k=1}^{n} {n \choose k} (-1)^{k-1} \ln k \\[6pt] &= (-\gamma + \ln \alpha) \times 1 + \sum_{k=1}^{n} {n \choose k} (-1)^k \ln k \\[6pt] &= -\gamma + \ln \alpha + \sum_{k=1}^{n} {n \choose k} (-1)^k \ln k. \\[6pt] \end{aligned}

Putting this together we obtain the function:

\begin{aligned} E(n) &\equiv \mathbb{E}(\ln (X_{\max}/X_{\min})) \\[6pt] &= \mathbb{E}(\ln X_{(n)}) - \mathbb{E}(\ln X_{(1)}) \\[6pt] &= \ln n + \sum_{k=1}^{n} {n \choose k} (-1)^k \ln k \\[6pt] &= {n \choose 2} \ln 2 - {n \choose 3} \ln 3 + {n \choose 4} \ln 4 - \cdots + (-1)^n \ln n + \ln n. \\[6pt] \end{aligned}

This is a finite sum that can be easily evaluated for a given value of $n \in \mathbb{N}$. There does not appear to be any simpler form for this expression. It is interesting to note that this function does not depend on the scale parameter $\alpha$, so this parameter has no effect on the expected value of the log-ratio of the maximum-to-minimum value. This is unsurprising, in view of the fact that the log-ratio of those values is invariant to changes in scale.

Plotting the function in R: This expected value function can be plotted for different input values of $n$ to get a visual sense of how the number of data points in the sample affects the expected log-ratio of the maximum-to-minimum value. To plot the function we use the following R code:

#Create function to calculate expected value

EXP <- function(n) { if(n%%1 != 0)   { stop("Error: Input is not a positive integer") }
else if(n < 1)  { stop("Error: Input is not a positive integer") }
else if(n == 1) { 0 }
else            { log(n) + sum(choose(n,2:n)*(-1)^(2:n)*log(2:n)) } };

#Plot expected value function

N      <- 20;
NNN    <- (1:N);
EEE    <- rep(0, N);  for(n in 1:N) { EEE[n] <- EXP(n) };
DATA   <- data.frame(n = NNN, Expectation = EEE);
SPLINE <- as.data.frame(spline(NNN, EEE));

library(ggplot2);
ggplot(data = DATA, aes(x = n, y = Expectation)) +
geom_point(colour = "DarkBlue") +
geom_line(data = SPLINE, aes(x = x, y = y), colour = "Blue") +
scale_x_continuous(name = "Number of Data Points", labels = (1:N), breaks = (1:N)) +
ggtitle("Expected value of log-ratio of maximum-to-minimum") +
labs(subtitle = "(Data from an exponential distribution)") +
xlab("Number of Data Points") + ylab("Expected Value");


This generates the following plot of the function:

• I think there is a small typo in $E[\log[X_{(1)}]$ .........where $\gamma + \ln(\alpha) - \ln(n)$ should be $-\gamma + \ln(\alpha) - \ln(n)$ – wolfies Jul 16 '18 at 5:21
• @wolfies: Nicely spotted - I have edited to fix that error (overall answer remains the same). – Reinstate Monica Jul 16 '18 at 5:43