Example 7.17 in Introduction to Monte Carlo methods with R
I received the following email about Introducing Monte Carlo Methods with R a few days ago:
Hallo Dr. Robert,
I am studying your fine book for myself. There´s a little problem in examples 7.17 and 8.1: in the R code a function “gu” is used and a reference given to ex. 5.17, but I cann´t find there a definition of “gu“. (gu = log formula (5.15) ?) Could you give me a hint?
from Elmar Kisslinger. Indeed, the gu function used in this analysis of the logit model is not available in the book, it is provided by
#function for MCMC gu=function(mu,i,beta,sigma){ sum((y[i,]*(beta*x[i,]+mu))-log(1+exp(beta*x[i,]+mu)))-0.5*mu^2/sigma^2 }
and is only available in the associated mcsm R package as part of the randogit.R code. (Incidentally, this is my 1500th post on the ‘Og! And this coincides with the 3000th comment…)
Leave a Reply