Deliverance!!! We have at last completed our book! Bayesian Essentials with R is off my desk! In a final nitty-gritty day of compiling and recompiling the R package bayess and the LaTeX file, we have reached versions that were in par with our expectations. The package has been submitted to CRAN (it has gone back and forth a few times, with requests to lower the computing time in the examples: each example should take less than 10s, then 5s…), then accepted by CRAN, incl. a Windows version, and the book has be sent to Springer-Verlag. This truly is a deliverance for me as this book project has been on my work horizon almost constantly for more than the past two years, led to exciting times in Luminy, Carnon and Berlin, has taken an heavy toll on my collaborations and research activities, and was slowly turning into a unsavoury chore! I am thus delighted Jean-Michel and I managed to close the door before any disastrous consequence on either the book or our friendship could develop. Bayesian Essentials with R is certainly an improvement compared with Bayesian Core, primarily by providing a direct access to the R code. We dearly hope it will attract a wider readership by reducing the mathematical requirements (even though some parts are still too involved for most undergraduates) and we will keep testing it with our own students in Montpellier and Paris over the coming months. In the meanwhile, I just enjoy this feeling of renewed freedom!!!
Archive for Bayesian Core
When Jean-Michel and I left Berlin, a month ago, I really thought we were that close to sending the new edition of Bayesian Core. Alas, we are not done yet for a series of reasons: leaving for India did not give me enough time to complete the help manual, some codes from the original version did not seem to work any longer, apparently jeopardising a whole chapter!, and the package did not seem to compile. Yesterday, we met again and made progress that makes me much more confident. For one thing, the R code that “did not work” was an original spreadsheet of Bayesian Core that we turned into functions towards the completion of the bayess package. However, due to sloppy programming at the time, we had used global variables that were called inside functions without being (explicitly) declared as variables. When those R codes got turned into functions, variables defined inside those functions were no longer global and recognised by the other functions defined within those same functions… Silly me! Once this issue got spotted by Jean-Michel, as well as the use of a few && instead of &’s, the whole problem unravelled rather quickly and we got a compiled package by the end of the day, even though some of the demos (reproducing the outcome found in the text) are still bugged. Stay tuned!
The dataset used in Bayesian Core for the chapter on image processing is a Landsat picture of Lake of Menteith in Scotland (close to Loch Lomond). (Yes, Lake of Menteith, not Loch Menteith!) Here is the image produced in the book. I just got an email from Matt Moores at QUT that the image is both rotated and flipped:
The image of Lake Mentieth in figure 8.6 of Bayesian Core is upside-down and back-to-front, so to speak. Also, I recently read a paper by Lionel Cucala & J-M Marin that has the same error.
This is due to the difference between matrix indices and image coordinates: matrices in R are indexed by [row,column] but image coordinates are [x,y]. Also, y=1 is the first row of the matrix, but the bottom row of pixels in an image.
Only a one line change to the R code is required to display the image in the correct orientation:image(1:100,1:100,t(as.matrix(lm3)[100:1,]),col=gray(256:1/256),xlab="",ylab="")
As can be checked on Googlemap, the picture is indeed rotated by a -90⁰ angle and the transpose correction does the job!
Michel Marin is a polymath artist at the frontier between painting and sculpture. (In case you wonder, he also is the father of my coauthor and dear friend Jean-Michel!) He also designed the covers of Bayesian Core and of Le Choix bayésien.
Here are some recent paintings taken from his website that I particularly like…
Another full day spent working with Jean-Michel Marin on the new edition of Bayesian Core (soon to be Bayesian Essentials with R!) and the remaining hierarchical Bayes chapter… I have reread and completed the regression and GLM chapters, sent to very friendly colleagues for a last round of comments. Now, I am essentially idle, waiting for Jean-Michel to finish his part on the hierarchical Bayes chapter, so that I can do the final editing.round. Jean-Michel had a very long day on that chapter, leaving Montpellier at 5am to return only at half past midnight, due to massive delays in the train schedule (which is why I always fly to Montpellier…)