Publications by csgillespie
An analysis of the Stackoverflow Beta sites
In the last six months or so, the behemoth of Q & A sites stackoverflow, decided to change tack and launch a number of other non-computing-language sites. To launch a site in the stackoverflow family, sites have to spend time gathering followers in Area51. Once a site has gained a critical mass, a new StackExchange (SE) site is born. At present t...
1914 sym R (1417 sym/2 pcs) 18 img
Installing R packages
Part of the reason R has become so popular is the vast array of packages available at the cran and bioconductor repositories. In the last few years, the number of packages has grown exponentially! This is a short post giving steps on how to actually install R packages. Let’s suppose you want to install the ggplot2 package. Well nothing could be...
2292 sym 16 img
Assignment operators in R: ‘=’ vs. ‘<-’
In R, you can use both ‘=’ and ‘ What’s the difference? The main difference between the two assignment operators is scope. It’s easiest to see the difference with an example: ##Delete x (if it exists) > rm(x) > mean(x=1:10) #[1] 5.5 > x #Error: object 'x' not found Here x is declared within the function’s scope of the function,...
1988 sym 16 img
R Style Guide
Each year I have the pleasure (actually it’s quite fun) of teaching R programming to first year mathematics and statistics students. The vast majority of these students have no experience of programming, yet think they are good with computers because they use facebook! Debugging students' R scripts The class has around 100 students, and there a...
3102 sym R (322 sym/2 pcs) 20 img
Advanced Markov Chain Monte Carlo Methods (AMCMC)
I’ve just received my copy of Advanced Markov Chain Monte Carlo Methods, by Liang, Liu, & Carroll. Although my PhD didn’t really involve any Bayesian methodology (and my undergrad was devoid of any Bayesian influence), I’ve found that the sort of problems I’m now tackling in systems biology demand a Bayesian/MCMC approach. There are a num...
1448 sym 20 img
Random variable generation (Pt 1 of 3)
As I mentioned in a recent post, I’ve just received a copy of Advanced Markov Chain Monte Carlo Methods. Chapter 1.4 in the book (very quickly) covers random variable generation. Inverse CDF Method A standard algorithm for generating random numbers is the inverse cdf method. The continuous version of the algorithm is as follows: 1. Generate a u...
1417 sym 26 img
Random variable generation (Pt 2 of 3)
Acceptance-rejection methods This post is based on chapter 1.4 of Advanced Markov Chain Monte Carlo. Another method of generating random variates from distributions is to use acceptance-rejection methods. Basically to generate a random number from , we generate a RN from an envelope distribution , where . The acceptance-rejection algorithm is a...
1870 sym R (257 sym/2 pcs) 88 img
New paper: Survival analysis
Each year I try to carry out some statistical consultancy to give me experience in other areas of statistics and also to provide teaching examples. Last Christmas I was approached by a paediatric consultant from the RVI who wanted to carry out prospective survival analysis. The consultant, Bruce Jaffray, had performed Nissen fundoplication surg...
2778 sym 20 img
Logical operators in R
A logical operator In R, the operators “|” and “&” indicate the logical operations OR and AND. For example, to test if x equals 1 and y equals 2 we do the following: > x = 1; y = 2 > (x == 1) & (y == 2) [1] TRUE However, if you are used to programming in C you may be tempted to write #Gives the same answer as above (in this example.....
2276 sym 20 img
R programming books
My sabbatical is rapidly coming to an end, and I have to start thinking more and more about teaching. Glancing over my module description for the introductory computational statistics course I teach, I noticed that it’s a bit light on recommend/background reading. In fact it has only two books: A first course in statistical programming with R ...
1698 sym 22 img