Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One way to calculate the distribution of the maximum value's location in a Gaussian vector is to use the Gumbel distribution. The Gumbel distribution is a type of extreme value distribution that describes the distribution of the maximum or minimum of a large number of independent, identically distributed random variables.

In Python, you can use the SciPy library to calculate the Gumbel distribution. Here's an example:

import numpy as np
from scipy.stats import gumbel_r

# Generate a random Gaussian vector
mu, sigma = 0, 1
n = 1000
x = np.random.normal(mu, sigma, n)

# Find the index of the maximum value in the vector
max_index = np.argmax(x)

# Calculate the Gumbel distribution of the maximum value's index
loc = np.log(n) - np.euler_gamma
scale = np.pi / np.sqrt(6)
gumbel_dist = gumbel_r(loc=loc, scale=scale)
prob = gumbel_dist.cdf(max_index)

print("The probability of the maximum value being at index", 
      max_index, "is {:.2f}%".format(prob*100))

In this example, we first generate a random Gaussian vector with mean 0 and standard deviation 1. We then find the index of the maximum value in the vector using the argmax function. Finally, we calculate the Gumbel distribution of the maximum value's index using the gumbel_r function from the SciPy stats module. We set the location parameter to log(n) - Euler's constant, where n is the length of the vector, and the scale parameter to pi/sqrt(6). We then use the cdf method of the Gumbel distribution to calculate the probability that the maximum value is at the index we found.