Hey there! Ready to crunch some numbers? Let’s dive into the world of statistics! Feel Free to reach out any time Contact Us

Maximum Likelihood Estimator in Binomial Distribution

Likelihood estimators, Binomial Distribution, Bernoulli Distribution, Likelihood Function, Likelihood Equation

 Let $r$ be the number of success resulting from $n$ independent trials with unknown success probability $p$, such that $X$ follows $Binomial$ $Distribution$.

Let $X_i$ be a random sample from $Bin(r, \theta)$, population with $r$ known, such that $0 \leq \theta \leq 1.$

`X \sim Bin(r, \theta)`

then the $maximum$ $likelihood$ $estimator$ of $\theta$ is

`\hat{\theta}_{MLE} = \frac{\bar{X}}{r}`

Proof. with the probability mass function of Binomial Distribution

`P(X=x)=\binom{r}{x} (\theta)^{x} (1-\theta)^{r-x} I_{(x \in 0,1,2,....,n)} \tag{1}`

the Likelihood equation is given by

`L(\theta, x) = \prod_{i=1}^{n} P(X_i=x_i) \tag{2}`

`L(\theta, x)=\prod_{i=1}^{n} \binom{r}{x_i} \theta^{\sum x_i} (1-\theta)^{r-\sum x_i} \tag{3}`

now, taking log both sides

`\log L(\theta, x) = \sum_{i=1}^{n} \log \binom{r}{x_i} + \sum_{i=1}^{n} \log \theta + \left(r - \sum_{i=1}^{n} x_i\right) \log(1 - \theta)  \tag{4}`

partially differentiate with respect to $\theta$ we get

`\frac{\partial}{\partial \theta}\log L = \frac{\sum_{i=1}^{n} x_i}{\theta} - \frac{\sum_{i=1}^{n} (r-x_i)}{\left(1 - \theta\right)} \tag{5}`

putting it equal to $0$ and find the $\theta$

`\hat{\theta}_{MLE} = \frac{\sum x_i}{r n} =\frac{\bar{x}}{r} \tag{6}`

Binomial Distribution bar graph 



Binomial distribution bar plot

R

# R program to create a binomial distribution bar plot

# User inputs for number of trials and probability of success
n <- as.numeric(readline("Enter the number of trials (n): "))
p <- as.numeric(readline("Enter the probability of success (p): "))

# Ensure valid inputs
if (n <= 0 || p < 0 || p > 1) {
  stop("Invalid inputs! Ensure n > 0 and 0 <= p <= 1.")
}

# Binomial probabilities
x <- seq(0, n, by = 1)
probabilities <- dbinom(x, size = n, prob = p)

# Create the bar plot
barplot(
  probabilities, 
  names.arg = x, 
  col = 'skyblue', 
  xlab = 'Number of Successes', 
  ylab = 'Probability', 
  main = paste("Binomial Distribution (n =", n, ", p =", p, ")"),
  border = 'blue'
)

grid(col = 'gray')
    

Post a Comment

Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
Site is Blocked
Sorry! This site is not available in your country.