Example 7.17 in Introduction to Monte Carlo methods with R

[This article was first published on Xi'an's Og » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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…)


Filed under: Books, R, Statistics, University life Tagged: Introducing Monte Carlo Methods with R, mcsm

To leave a comment for the author, please follow the link and comment on their blog: Xi'an's Og » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)