I know how to find the MLE in the usual case where the variable takes numerical values. But what if that is not the case?
Suppose we have a sample of the blood type of $1000$ independent individuals
$$ \begin{array}{c|lcr} \text{Blood Type} & \text{O} & \text{A} & \text{B} & \text{AB}\\ \hline \text{Frequency} & 400 & 250 & 250 & 100 \\ \end{array} $$
And we are given the probabilities $$ \Bbb P(X_i=x_i)= \begin{cases} (1-p)^2 &, & x_i=\text{O} \\ p(1-p) &, & x_i=\text{A} \\ p(1-p) &, & x_i=\text{B} \\ p^2 &, & x_i=\text{AB} \\ \end{cases} $$
Where $X_i$ is the blood type of the $i$-th individual. How do we find the MLE?
In a Bernoulli distribution, we would say that
$$ \Bbb P(X_i=x_i)= \begin{cases} 1-p &, & x_i=0 \\ p & , & x_i=1 \end{cases} =p^{x_i}(1-p)^{1-x_i}$$ Do we use some sort of a similar idea in this case?
Thanks
Let $f(x; p) = \mathbb P(X = x)$ denote the probability mass function and $x_1,\dotsc, x_n\in\{O, A, B, AB\}$ denote the realizations. Then, we obtain the log-likelihood function $$ \begin{align*} L(p) &= \sum_{i=1}^n \log(f(x_i; p)) \\ &= 500 \cdot 2 \cdot \log(1-p) + 2\cdot 250 \cdot (\log(p)+ \log(1-p)) + 100 \cdot 2 \cdot \log(p) \\ &= 1500 \log(1-p) + 700 \log(p). \end{align*} $$
Now, differentiate $L$ to maximize it for $p\in(0,1)$.