Draw 1000 iid samples from a Binomial(k,0.2) population, where k =100. Find MLE(k) use R
R code-
x=0
s=0
k=100
for (i in 1:1000) {
x=rbinom(1,k,.2)
s=s+x
}
s
s/(1000*k)
Answer is 0.19797
Please note the answer will change over time but it will be close to the actual value of p=0.2
Theory:
For example, suppose that X1, X2, . . . , X10 are an iid sample from a binomial distribution with n = 5 and p . Since each Xi is actually the total number of successes in 5 independent Bernoulli trials, and since the Xi’s are independent of one another, their sum is actually the total number of successes in 50 independent Bernoulli trials. Thus X∼Bin(50,p) and the MLE is p^=x/n, the observed proportion of successes across all 50 trials. Whenever we have independent binomial random variables with a common p , we can always add them together to get a single binomial random variable.
Get Answers For Free
Most questions answered within 1 hours.