Prettier base plots in R

R’s base graphics system is notable for the minimal design of its plots. Basic usage is very simple, although more complex customization capabilities are not user friendly. Hence I wrapped the plot and hist functions to improve their default behavior.

Any argument usually passed to plot or hist can also be passed to the two wrapper functions pretty_plot and pretty_hist. A comparison is shown below; “prettified” functions are on the right (obviously!).

plot(cars); pretty_plot(cars)

cars.pngRead More »

What this blog is about

Here I write and brainstorm about some subjects that interest me. The goal is to share what I like and explore ideas that are tangential to my work as a student.

Almost everything on this site was written while I was a senior undergraduate student at Université du Québec à Montréal. Nowadays I’m busy with other projects and I don’t expect to continue to post as often.

Bayesian theory and exposition

Problem solving, short proofs and notes

Surface regression and reconstruction from a topological perspective

Échantillonnage préférentiel


Le problème est de calculer I(f) = \int f d\lambda,\mu est une mesure de probabilité sur un espace X et f : X \rightarrow \mathbb{R} est intégrable. Si \{X_n\} est une suite de variables aléatoires indépendantes et distribuées selon \mu, alors on peut approximer I(f) par

I_n(f) = \frac{1}{n}\sum_{i=1}^n f(X_i),

qui est dit un estimateur de Monte-Carlo.
En pratique, il peut être difficile de générer X_n \sim \lambda. On préférera alors introduire une mesure \mu, avec \lambda absolument continue par rapport à \mu, de sorte que

I_n(f;\mu) = \frac{1}{n}\sum_{i=1}^n f(Y_i) \tfrac{d\lambda}{d\mu}(Y_i), \quad Y_i \sim^{ind.} \mu,

soit une estimée de I(f) plus commode à calculer. Cette technique, dite de l’échantillonnage préférentiel, peut aussi servir à améliorer la qualité de l’estimateur I_n par exemple en réduisant sa variance.Read More »

Bayesian learning

Friday july 28 at 17:00
Rutherford Physics Building, Room 118, McGill

Next week, I’ll be talking about Bayesian learning at the Mathematical congress of the americas and at the Canadian undergraduate mathematics conference. These are somewhat challenging talks: I need to sell the idea of Bayesian statistics to a general mathematical audience (which knows nothing about it), interest them in some though problems of Bayesian nonparametrics, and then present some of our research results. This must be done in under 20 minutes.

To make the presentation more intuitive and accessible, I borrowed some language from machine learning. I’m talking about learning rather than inference, uncertain knowledge rather than subjective belief, and “asymptotic correctness” rather than consistency. These are essentially synonymous, although some authors might use them in different ways. This should not cause problems for this introductory talk.Read More »

The discretization trick

I explain the discretization trick that I mentioned in my previous post (Posterior consistency under possible misspecification). I think it was introduced by Walker (New approaches to Bayesian consistency (2004)).

Let \mathbb{F} be a set of densities and let \Pi be a prior on \mathbb{F}. If x_1, x_2, x_3, \dots follows some distribution P_0 having density f_0, then the posterior distribution of \Pi can be written as

\Pi(A | x_1, \dots, x_n) \propto \int_A \prod_{i=1}^n f(x_i) \Pi(df).

The discretization trick is to find densities f_{1}, f_2, f_3, \dots in the convex hull of A (taken in the space of all densities) such that

\int_A \prod_{i=1}^n f(x_i) = \prod_{i=1}^n f_i(x_i) \Pi(A).Read More »