In: Statistics and Probability
Use MATLAB to plot the likelihood function for estimating the probability of a coin landing heads-up without prior knowledge after observing HTHT. -would greatly appreciate if you went in detail on how to find the likelihood function based off the given information.
Let p be the probability of landing Heads up.
Let be the independent outcomes from n toss of a coin, taking the value 1 if it lands heads up and 0 otherwise.
Then has a Bernoulli distribution with parameter p with probability
The joint probability of observing and hence the likelihood is
We wanve observed HTHT. That means n=4.
The likelihood of observing HTHT is
We will plot L(p|x) for different values of p=[0,1] and find the value of p at which the likelihood L is the maximum.
Matlab code
The plot is
We can see that the maximum is at p=0.50.
the output from the program confirms that
The maximum likelihood estimate of p (the probability of a coin landing heads up) given the sample HTHT is