## How to use mcsm

**W**ithin the past two days, I received this email

Dear Prof.Robert

I have just bought your recent book on. Although I have checked your web page for the R programs (bits of the code in the book, codes for generating the figures and tec – not the package available on cran) used in the book, I have not found them.Introducing Monte Carlo Methods with R

I wonder whether you could make them available.

Thank you very much for your time and patience.

Yours Sincerely

and that one

Dear Prof. Robert,

I bought “” from Amazon booksore. I am a teacher at […] University, and I choose this book as a textbook in my class.Introducing Monte Carlo Methods with R

I can not find the R package “mcsm” according to your book (page 5). Where can I download the R package “mcsm”?

I highly appreciate your help.

Best regards,

so I fear that readers may miss the piece of information provided in the book. As indicated on pages 36-37 of ** Introducing Monte Carlo Methods with R**, mcsm is a registred R package, readers can therefore download it manually from CRAN, but they should first try using install.packages in R as this is both easier and safer. (They should check on the main R project webpage for more help in installing packages.)

Another useful information for readers is that the code used on the examples of ** Introducing Monte Carlo Methods with R** is available from mcsm through the demo command/code. Typing demo(Chapter.3) starts the production of the examples of Chapter 3:

> demo(Chapter.3)

demo(Chapter.3)

————————

Type <Return> to start :

> # Section 3.1, Introduction

>

> ch=function(la){ integrate(function(x){x^(la-1)*exp(-x)},0,Inf)$val}

> plot(lgamma(seq(.01,10,le=100)),log(apply(as.matrix(

+ seq(.01,10,le=100)),1,ch)),xlab=”log(integrate(f))”,

+ ylab=expression(log(Gamma(lambda))),pch=19,cex=.6)

> S=readline(prompt=”Type <Return> to continue : “)

Type <Return> to continue :

and obviously the same for all other chapters. This also means the code is available in the corresponding file, something like

/usr/lib/R/site-library/mcsm/demo/Chapter.3.R

depending on your system.

January 4, 2012 at 7:08 am

[…] is only available in the associated mcsm R package as part of the randogit.R code. […]

May 13, 2010 at 12:29 am

[…] The function pimax from our package mcsm is used in to reproduce Figure 5.11 of our book Introducing Monte Carlo Methods with R. (The name […]