# Articles by Pierre Jacob

### Coding algorithms in R for models written in Stan

September 27, 2019 |

Hi all, On top of recommending the excellent autobiography of Stanislaw Ulam, this post is about using the software Stan, but not directly to perform inference, instead to obtain R functions to evaluate a target’s probability density function and its gradient. With which, one can implement custom methods, while ...

### Couplings of Normal variables

August 23, 2018 |

Hi, Just to play a bit with the gganimate package, and to celebrate National Coupling Day, the above plot shows different couplings of two univariate Normal distributions, Normal(0,1) and Normal(2,1). That is, each point is a pair (x,y) where x follows a Normal(0,1) and y follows a Normal(2,1). Below ... [Read more...]

### nrow, references and copies

December 10, 2017 |

Hi all, This post deals with a strange phenomenon in R that I have noticed while working on unbiased MCMC. Reducing the problem to a simple form, consider the following code, which iteratively samples a vector ‘x’ and stores it in a row of a large matrix called ‘chain’ (I’...

### Likelihood calculation for the g-and-k distribution

June 10, 2017 |

Hello, An example often used in the ABC literature is the g-and-k distribution (e.g. reference [1] below), which is defined through the inverse of its cumulative distribution function (cdf). It is easy to simulate from such distributions by drawing uniform variables and applying the inverse cdf to them. However, since ...

### Moustache target distribution and Wes Anderson

March 31, 2014 |

Today I am going to introduce the moustache target distribution (moustarget distribution for brievety). Load some packages first. Let’s invoke the moustarget distribution. This defines a target distribution represented by a SVG file using RShapeTarget. The target probability density function is defined on and is proportional to on the ... [Read more...]

### Rasmus Bååth’s Bayesian first aid

January 23, 2014 |

Besides having coded a pretty cool MCMC app in Javascript, this guy Rasmus Bååth has started the Bayesian first aid project. The idea is that if there’s an R function called blabla.test performing test “blabla”, there should be a function bayes.blabla.test performing a similar test ... [Read more...]

### From SVG to probability distributions [with R package]

August 25, 2013 |

Hey, To illustrate generally complex probability density functions on continuous spaces, researchers always use the same examples, for instance mixtures of Gaussian distributions or a banana shaped distribution defined on with density function: If we draw a sample from this distribution using MCMC we obtain a [scatter]plot like this ... [Read more...]

### PAWL package on CRAN

October 26, 2011 |

The PAWL package (which I talked about there, and which implements the parallel adaptive Wang-Landau algorithm and adaptive Metropolis-Hastings for comparison) is now on CRAN! http://cran.r-project.org/web/packages/PAWL/index.html which means that within R you can easily install it by typing install.packages("PAWL") Isn’... [Read more...]

### Calling Google Maps API from R

October 5, 2011 |

Hi, Related to Julyan’s previous post, I want to share an easy way to access Google Maps API through R. And then we’ll stop about Google, otherwise it’ll look like we’re just looking for jobs. My problem was the following: … Continue reading → [Read more...]

### Density exploration and Wang-Landau algorithms [with R package]

September 21, 2011 |

Hey, Since a new paper that I’ve co-written has appeared on arXiv, here is a quick post summarizing it. The paper is named: An Adaptive Interacting Wang-Landau Algorithm for Automatic Density Exploration and describes improvements over the Wang-Landau algorithm described … Continue reading → [Read more...]

### Speed up your R code with C++

February 3, 2011 |

Hi again, Recently, Julyan blogged about allocating memory first before modifying R objects. That’s a very useful trick that applies to most programming languages. Tonight I want to blog about something a bit more complicated and more specific to R, but which can lead to massive speed-ups: interfacing C/...