Publications by James Keirstead

Changing the fonts in R plots

28.10.2007

Tweet I use R to do almost all of my statistical analysis and plotting. It has a very steep learning curve but once you get into it, it’s very powerful and you can customise almost anything. The only problem is that these changes are not always obvious or easy to do. Case in point: how to change the fonts on an R plot. Here are some R commands...

2894 sym 4 img

How to: Binomial regression models in R

19.03.2011

Tweet We’ve been doing a lot of work recently with multinomial logit choice models; that is, trying to predict how choices are made between multiple options. It’s a fairly new topic for me so I’m trying to get the hang of both the theory and the practical bits. But learning multinomial modelling before binomial modelling (the choice betw...

2703 sym R (628 sym/2 pcs) 6 img

How to: Multinomial regression models in R

05.04.2011

Tweet In my last post I looked at binomial choice modelling in R, i.e. how to predict a yes/no decision from other data. Now however I want to look at modelling a more complicated choice, between more than two options. This is known as multinomial choice modelling and R can perform these analyses using the nnet package. Let’s start by making...

3046 sym R (1351 sym/6 pcs) 4 img

How to do a quantitative literature review in R

17.05.2011

Tweet Recently I’ve been working on a review of urban energy modelling literature. It’s a very broad field and a quick search through Web of Knowledge turns up about 400 papers that look relevant. How on earth can you distill these reams of paper into something sensible? One technique I’ve found helpful, especially at the earlier stage...

4836 sym R (2410 sym/5 pcs) 4 img

Positive coefficient regression in R

05.08.2011

Tweet I’m currently working on a paper about simulating urban demands for electricity and gas at 5 minute resolution. To do this, I have a simple regression model that tries to explain observed consumption based on local population figures and simulated levels of activity demands (e.g. minutes spent at work, leisure, etc). The data set looks...

2802 sym R (1475 sym/7 pcs) 2 img

Getters and setters in R

12.08.2011

Tweet When I first started using R, one of the things that attracted me was its claim to be an object-oriented programming (OOP) language. Coming from a Java background, I was used to designing software with OOP concepts like encapsulation and inheritance but, when I turned my hand to R, I quickly realized that “object-oriented” meant somet...

2766 sym R (255 sym/1 pcs)

Sampling for Monte Carlo simulations with R

31.10.2011

When doing Monte Carlo simulation, it’s important to pick your parameter values efficiently especially if your model is computationally expensive to run. If the model takes two days to run, and a parameter ranges from 0 to 10, it doesn’t make much sense to run it once at and again at if hasn’t been explored at all. To get around this p...

2403 sym R (1364 sym/2 pcs) 14 img

Grrr…

15.11.2011

I’ve been working through Gelman et al.’s otherwise excellent Bayesian Data Analysis and it’s going reasonably well. My statistics is a little bit rusty so it’s taken time to work through all of the exercises and really understand what’s going on. But I say “otherwise excellent” because yesterday I spent ages trying to figure out ...

1659 sym R (685 sym/1 pcs) 10 img

Gaussian process regression with R

05.04.2012

I’m currently working my way through Rasmussen and Williams’s book on Gaussian processes. It’s another one of those topics that seems to crop up a lot these days, particularly around control strategies for energy systems, and thought I should be able to at least perform basic analyses with this method. While the book is sensibly laid-out a...

4160 sym 8 img

What have I been doing all these years?!

11.08.2012

So the London Olympics have been pretty exciting, right? All those rare sports a person only seems to watch once every four years, right alongside familiar favourites being performed at the absolute top level. To top it all off, watching this year’s Games have made me realize that I’ve been making big mistakes in my running technique for ye...

3646 sym 4 img