Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to find estimate for the unknown $\theta$ with MLE using the R language if i'm given the following sample: $2, 2, 2, 2, 2, 8, 8, 8$. The sample is obtained from a discrete distribution with the rules:

$$P(2) = \theta\quad \text{and}\quad P(8) = 1-\theta$$

share|cite|improve this question
up vote 1 down vote accepted

Why R language! You could do it by hand. The estimator is $\hat{\theta}=5/8$. This a Bernoulli random variable. The MLE (of the parameter which is the probability of observing 2's) is the sample mean (proportion of 2's).

In R, it is

y <- c(1, 1, 1, 1, 1, 0, 0, 0)

thetahat <- mean(y)


share|cite|improve this answer
I know how to do it by hand. The assignment i have is to do it in R. – 1001 Dec 11 '12 at 12:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.