# Makefile and Beamer presentations

I have been wondering about Makefiles for some time now, and recently I finally got around learning about them so that I could use make to regenerate all the different versions of a manuscript I’m working on. And I thought I would take the opportunity to explain how they can be useful for Beamer presentations.

# Tutorial: Optimising R code

The R language is very good for statistical computations, due to its strong functional capabilities, its open source philosophy, and its extended package ecosystem. However, it can also be quite slow, because of some design choices (e.g. lazy evaluation and extreme dynamic typing).

### Before optimising…

First of all, before we start optimising our R code, we need to ask ourselves a few questions:

1. Is my code doing what I want it to do?

2. Do I really need to make my code faster?

3. Is considerable speed up even possible?

# Test case: Optimising PCEV

I will give an example of code optimisation in R, using Noam Ross’s proftable function and Luke Tierney’s proftools package, which I discuss in my tutorial on optimisation. The code we will optimise comes from the main function of our PCEV package. A few months ago, while testing the method using simulations, I had to speed up my code because it was way to slow, and the result of this optimisation is given below.

For background, recall that PCEV is a dimension-reduction technique, akin to PCA, but where the components are obtained by maximising the proportion of variance explained by a set of covariates. For more information, see this blog post.

# Using MathJax

I had some trouble rendering correctly the mathematical equations in my previous post: at first I could only see the untransformed markup, then the text simply disappeared, without being transformed, and finally the equations appeared, but coloured orange. As you can see, everything now looks fine, but to fix this I ended up learning a bit more about how markdown, HTML, CSS and javacript all work together to create the website you are currently visiting. The purpose of this post is to share some of what I learned, so that future visitors can be spared some of the pain that accompanied the learning.

# Principal components of explained variance

I have been spending most of my time on a very interesting technique that has, unfortunately, received little attention (I’ll come back later about some possible reasons). The purpose of this post is to introduce this method and give motivation for its use.