Indeed, to cut on code length, we purposely did not include *[but should have included!]* the lines of code that are necessary to plot the surface of the log-posterior density. They can be found in the file Chapter.5.R *[located in demo]* as

#log-likelihood surface mu1=mu2=seq(-2,5,le=250) lli=matrix(0,nco=250,nro=250) for (i in 1:250) for (j in 1:250) lli[i,j]=like(c(mu1[i],mu2[j])) par(mar=c(4,4,1,1)) image(mu1,mu2,-lli,xlab=expression(mu[1]), ylab=expression(mu[2])) contour(mu1,mu2,-lli,nle=100,add=T)

or (since Chapter.5.R needs fixing because of the update in optimise) the very same code can be extracted from the function **mhmix**;

mu1 = mu2 = seq(-2, 5, le = 250) lli = matrix(0, nco = 250, nro = 250) for (i in 1:250) for (j in 1:250) lli[i, j] = like(c(mu1[i],mu2[j])) par(mar = c(4, 4, 1, 1)) image(mu1, mu2, lli, xlab = expression(mu[1]), ylab = expression(mu[2])) contour(mu1, mu2, lli, nle = 100, add = T)]]>

Could you tell me how to do it? Thank you ]]>

I’ve no idea why the order of arguments was changed.

I think allowing partial argument matches in R is a mistake. It just promotes this sort of error, or worse, related errors in which there isn’t actually any error message. It may not be fixable now, though, for backwards compatibility reasons.

]]>