# Data analysis over geometric distribution sample with R (statistics pack)

Problem :

The following observations are the number of tries $21$ football players had to make until they succeeded in scoring a penalty kick. Consider that all players have equal skills.

$$3 \quad 2 \quad 1 \quad 3 \quad 2 \quad 1 \quad 1 \quad 2 \quad 3 \quad 4 \quad 2 \quad 2 \quad 2 \quad 5 \quad 3 \quad 4 \quad 1 \quad 2 \quad 5 \quad 2 \quad 3$$

(i) Find analytically the Maximum Likelihood Estimator of the success rate of each player regarding the penalty kicks.

(ii) Find graphically the Maximum Likelihood Estimator of the success rateo f each player regarding the penalty kicks, with the help of $\mathbf{R}$ (statistics pack-language)

Attempt :

(ii) One can easily see that the case of the specific problem leads to the conclusion that the observations follow the Geometric Distribution as it follows exactly by its definition (the number of trials $x$ needed until the first success). Thus, the Maximum Likelihood Estimator can be found us (Loglikelihood) :

Let $X_1, X_2, \dots, X_n$ with p.d.f. $f(x;p)=(1-p)^{x_1}p, \; x=1,2,\dots$ .The likelihood function is given by : $$L\left(p \right)={\left(1-p \right)}^{{x}_{1}-1}p {\left(1-p \right)}^{{x}_{2}-1}p...{\left(1-p \right)}^{{x}_{n}-1}p ={p}^{n}{\left(1-p \right)}^{\sum_{1}^{n}{x}_{i}-n}$$ By applying the natural logarithm, we get : $$\ln L\left(p \right)= n\ln{p}+\left(\sum_{1}^{n}{x}_{i}-n \right)\ln{\left(1-p \right)}$$ Following differentiation and equaling to zero, we yield : $$\frac{d\left[\ln L\left(p \right)\right]}{dp}=\frac{n}{p} -\frac{\left(\sum_{1}^{n}{x}_{i}-n \right)}{\left(1-p \right)}=0 \Rightarrow p=\frac{n}{\left(\sum_{1}^{n}{x}_{i} \right)}$$ which means that the Maximum Likelihood Estimator (Loglikelihood as we applied the logarithm) is : $$P = \frac{n}{\left(\sum_{1}^{n}{x}_{i} \right)} = \frac{1}{\bar{X}}$$

With the help of the statistics pack $\mathbf{R}$, we can write a short function to compute any Geometric Distribution Loglikelihood we'd like : which when we execute for a given vector $\mathbf{trials}$ with the given observations, it returns the wanted result.

Question : My question is about part (ii) though, as I am completely at loss on how to proceed on estimating-calculating the Maximum Likelihood Estimator graphically with $\mathbf{R}$, especially since this is a case of a discrete distribution. I would really appreciate any hint or thorough explanation on how to proceed with it.