II.ps Oe+00 -2e+07 -4e+07 -6e+07 0.0 0.2 0.4 ps 0.6 0.8 1.0
From 1965 to 1974, in U.S. there were M = 17, 857, 857 male livebirths and F = 16, 974, 194 female livebirths. We model the number of male livebirth as a binomial distribution with parameters size = M+F and prob = p. The following code computes the maximum likelihood estimator for p.
M <- 17857857
F <- 16974194
ll <- function(p){ dbinom(M, size=M+F, prob=p, log=TRUE) }
ps <- seq(0.01, 0.99, by = 0.001)
ll.ps <- ll(ps)
plot(ps, ll.ps, type='l')
phat <- ps[which.max(ll.ps)]
abline(v = phat, col='blue')
Question: An estimator for p, denoted by pˆ, is obtained by ps[which.max(ll.ps)]. Is
this the maximum likelihood estimator? Why (explain the code)?
Given that,
From 1965 to 1974, in U.S
male = 17857857
female = 16974194
ll <-function(p){dbinom(male, size = male+female, prob=p, log=TRUE) }
ps <-seq(0.01, 0.99, by = 0.001)
ll.ps <-ll(ps)
plot(ps, ll.ps, type='l')
phat <- ps[which.max(ll.ps)]
abline(v = phat, col='blue'
Step by step
Solved in 3 steps