We will now visualize the likelihood function for the binomial, Poisson, and normal distributions discussed before:

- Initialize the graphics windows for the three samples using
`par(mfrow= c(1,3))`

. - Declare the number of trials
*n*and the number of success*x*by`n <- 10; x <- 7`

. - Set the sequence of
*p*values with`p_seq <- seq(0,1,0.01)`

.For

`p_seq`

, obtain the probabilities for*n*= 10 and*x*= 7 by using the`dbinom`

function:`dbinom(x=7,size=n,prob=p_seq)`

. - Next, obtain the likelihood function plot by running
`plot(p_seq, dbinom( x=7,size=n,prob=p_seq), xlab="p", ylab="Binomial Likelihood Function", "l")`

- Enter the data for the Poisson random sample into R using
`x <- c(1,2,2,1, 0,2,3,1,2,4)`

and the number of ...

Start Free Trial

No credit card required