# Stats

Want to know your global? Who nemesises you? Various other statistics?

A global is the time you expect to get (also known as the expected value). Why compute ao100s?

The central limit theorem states that for samples from an arbitrary distribution as the sample size approaches infinity the distribution of the sample means has to be Gaussian. Then, maximum likelihood estimation (MLE) can be applied. Suppose $$X \sim \mathcal{N}(\mu, \, \sigma^{2})$$ independently and identically. The probably density function (PDF) of a Gaussian is $$f(x) = \frac{1}{\sqrt{2\pi}} e^{-\frac{(x - \mu)^2}{2\sigma^2}}$$. Suppose our sample $$X$$ has $$n$$ elements, indexed by $$i$$. Then, the probability of our particular sample is the multiplication of the probability of each value in our sample, or $$\prod_{i=1}^{n} f(x_i) = \prod_{i=1}^{n} \frac{1}{\sqrt{2\pi}} e^{-\frac{(x_i - \mu)^2}{2\sigma^2}}$$.

MLE attempts to maximize the chance that a particular sample occurs. As $$\ln{x}$$ is monotonically increasing, maximizing $$\ln{x}$$ is the same as maximizing $$x$$. Taking the natural log of the probability yields $$\sum_{i = 1}^n -\frac{(x_i - \mu)^2}{2\sigma^2}$$ plus $$\ln{\frac{1}{\sqrt{2\pi}}}$$. Calling this $$P(x)$$, we maximize $$P(x)$$ by differentiating with respect to $$\mu$$ and assume $$\sigma$$ is constant. $$\frac{\partial P}{\partial \mu} = \sum_{i = 1}^n \frac{-2(x_i - \mu) \cdot -1 }{2\sigma^2} = \sum_{i = 1}^n \frac{x_i - \mu}{\sigma^2} = 0$$. Therefore, $$\sum_{i = 1}^n (x_i) - n \mu = 0$$ so $$\mu = \frac{\sum_{i = 1}^n x_i}{n}$$, which is equivalent to the sample mean $$\bar{x}$$.

A similar argument exists for $$\sigma$$, however the definition of $$\sigma$$ depends on $$\mu$$, making the derivation significantly more nontrivial. As such, it is left as an exercise for the reader. In conclusion, doing mo10ao5s is basically applying MLE on the ao5 solve distribution and hoping it's Gaussian.