Articles by Pierre Jacob

Coding algorithms in R for models written in Stan

September 27, 2019 | Pierre Jacob

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 ...
[Read more...]

Couplings of Normal variables

August 23, 2018 | Pierre Jacob

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 | Pierre Jacob

    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’...
[Read more...]

Likelihood calculation for the g-and-k distribution

June 10, 2017 | Pierre Jacob

    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 ...
[Read more...]

Moustache target distribution and Wes Anderson

March 31, 2014 | Pierre Jacob

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 | Pierre Jacob

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 | Pierre Jacob

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 | Pierre Jacob

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 | Pierre Jacob

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...]

Speed up your R code with C++

February 3, 2011 | Pierre Jacob

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/...
[Read more...]

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)