The logarithm of the Poisson mixture likelihood (3.10) can be calculated with the following R code:
sum(log(outer(x,lambda,dpois) %*% delta)),
where delta and lambda are m-vectors containing the δc and λc parameters and x is a vector of n observations.
(a) Explain this code.
(b) Write an R function called pois.mix.pn2pw to transform delta and lambda to a vector parvect of 2m - 1 working parameters, following (3.15, 3.16).
(c) Write an R function called pois.mix.pw2pn for the inverse transformation (3.17, 3.18), to produce a list containing m-vectors delta and lambda.
(d) Using these functions, write a further function called pois.mix.negllk to calculate the negative log of the Poisson mixture likelihood, evaluated at a given