Archive for solution manual

Solution manual for Introducing Monte Carlo Methods with R

Posted in Books, R, Statistics with tags , , on January 19, 2010 by xi'an

After the complete solution manual for Bayesian Core, the solution manual for the odd numbered exercises of “Introducing Monte Carlo Methods with R” is now arXived. The fuller 133 page version for instructors is available from Springer Verlag by demand only, in order to keep the appeal of the book as a textbook (even though this is open to debate). Since the LaTeX code is available from the arXiv deposit, it can also be used and modified freely. (It may be argued that publishing a solution manual on arXiv is somehow borderline, because, while it is hopefully useful to readers and original, it does not truly qualify as research. And won’t be published anywhere else. I agree with this perspective but the final decision was up to the administrators of the site who did not object. So I do not complain!)

The warnings associated with publishing the complete solution manual for Bayesian Core, are worth repeating with this solution manual for “Introducing Monte Carlo Methods with R”, namely that “some self-study readers will undoubtedly come to the realisation that the solutions provided here are too sketchy for them because the way we wrote those solutions assumes some minimal familiarity with the maths, with the probability theory and with the statistics behind the arguments. There is unfortunately a limit to the time and to the efforts we can dedicate to this solution manual“, which is about a week for both manuals. As of earlier, comments and suggestions are welcome.

LaTeX surprises

Posted in Books, University life with tags , , , , , on January 18, 2010 by xi'an

When compiling the solution manual to “Introducing Monte Carlo Methods with R” into a version with only the odd-numbered exercises, I used a \relax{…} command to comment out the even-numbered solutions. This produced a strange bug when applied to a paragraph that included the lines

> system.time({for (t in 1:100) y=rmnorm(n=1,var=Sigma)})
user  system elapsed
 0.028   0.000   0.028

as somehow the curly bracket } in the group of commands was understood as the end of the \relax command. It took me a while to spot the reason for this bug as I implicitely assumed that anything within the verbatim environment was not understood as a LaTeX command. But the bug was also helpful in pointing out an extra curly bracket } in an R code provided as a solution (within the verbatim environment). While switching between the long and the short versions of the solution manual to “Introducing Monte Carlo Methods with R”, I also found a point I had been seeking for a while, namely that

\subsection{Exercise \ref{exo:helpme}} 
Test the \verb+help+ command on the functions \verb+seq+, 
\verb+sample+, and \verb+order+.

works out nicely to comment out whole paragraphs once the verbatim package is included. However, if I try to shorten the syntax by defining


I get a compilation error

Runaway argument?! 
File ended while scanning use of \next.
<inserted text>

Strange, isn’t it?!

Typos in Chapter 5

Posted in Books, R, Statistics with tags , , , , on January 12, 2010 by xi'an

After writing the solutions to the odd-numbered exercises in Chapter 5 of “Introducing Monte Carlo Methods with R”., I alas found the following typos, two of which are rather major (Exercise 5.3 and Example 5.16). I apologise to the readers these typos may confuse.

— Exercise 5.3 has no simple encompassing set and the constraint should be replaced by

x^2(1+\sin(y/3)\cos(8x))+y^2(2+\cos(5x)\cos(8y)) \le 1

— In Example 5.14, the sentence between parentheses should end up with “equal to 0” (merci, Robin!)

— Example 5.16 has a typo in that the EM sequence should be

\hat\theta_1 = \displaystyle{\left\{{\theta_0\,x_1\over 2+\theta_0}+ x_4\right\}}\bigg/\displaystyle{\left\{{\theta_0\,x_1\over 2+\theta_0} +x_2+x_3+x_4\right\}}

— In Exercise 5.15, the Z’s in the formula should be in capital letters, namely

P(Z_i=1) = 1 - P(Z_i=2)

— In Exercise 5.17, the function \phi should be written \varphi to be coherent with the notation of Example 5.14

— Exercise 5.21 should have been removed as it duplicates Exercise 5.11…but this redundancy  is not going to confuse anyone!

As written earlier, this is a confirmation that I should have followed my own rule of “Always write the correction before the first printing”!

Typos in Chapter 4

Posted in Books, R, Statistics, University life with tags , , , , on January 10, 2010 by xi'an

Chapter 4 of “Introducing Monte Carlo Methods with R” has four typos (so far) in the exercises:

— In Exercise 4.5, the \overline X_k should not be in bold fonts (!)

— In Exercise 4.9, I commented too many lines when revising and thus the variance terms vanished. It should read

\mathbb{E} \left[\exp-X^2|y\right] = \frac{1}{\sqrt{2 \pi \sigma^2/y}}\int\exp\{-x^2\}\,\exp\{-(x-\mu)^2y/2\sigma^2\}\,\text{d}x

\qquad =\frac{1}{\sqrt{2 \sigma^2/y+1}} \exp \left\{ -\frac{\mu^2}{1+2\sigma^2/y}\right\}

— In Exercise 4.13, following the removal of one exercise, Exercise 4.2 should read Exercise 4.1

— In Exercise 4.15, Bin(y) should be Bin(n,y) (as in Problem 4.5 of Monte Carlo Statistical Methods)

Typos in Chapter 3

Posted in Books, R, Statistics, University life with tags , , , , on January 8, 2010 by xi'an

Here are two more typos in the exercises of Chapter 3 of “Introducing Monte Carlo Methods with R”.

— due to the (later) inclusion of an extra-exercise in the book, the “above exercise” in Exercise 3.5 actually means Exercise 3.3.

— in Exercise 3.11, question c, a line got commented by mistake in the LaTeX file and it should read “Explore the gain in efficiency from this method. Take a = 4.5 in part (a) and run an experiment to determine how many normal \mathcal{N}(0,1) random variables would be needed to calculate P(Z > 4.5) to the same accuracy obtained from using 100 random variables in this importance sampler.”

— in Exercise 3.17, George Casella found that in question b it should be X|Y\sim\mathcal{G}a(1,y), not X|Y\sim\mathcal{G}a(1,y).

I have also received the following email from Australia

Dear Professor Robert
I have just received (courtesy of Amazon) a copy of your book, as above.
I am wondering if / when any “solutions” to the book will be available.
I am neither a student nor an instructor, but a full time clinician who has an interest in Bayesian statistics and would value appropriate instruction from the solutions to the exercises.
Much obliged for any advice on this
Best wishes

which keenly shows why the solution manual must be produced as quickly as possible!

%d bloggers like this: