Thursday, 7 November 2013

Rescue remedy

Interesting day, today. I woke up really early (3.45am) to catch my flight to Amsterdam to give my talk at the Chemometrics Workshop. The cab got me to the airport early enough so that I could clear security, have a coffee and slowly make my way to the gate. 

But when I arrived there, I realised that before leaving home, on the spur of the moment, I decided to take a different jacket $-$ you know, just to stir things up a little. Too bad that I had left my passport in the jacket that was at home... But, no matter; after all I still have my Italian ID card $-$ I don't often use it, but surely that would come to the rescue and allow me to board my flight. Except that it was kind of expired (well $-$ "kind of" meaning expired two years ago). And so they kindly escorted me outside the departures area.

At which point (it was about 6am), I decided it was time for desperate measures and called home. Thankfully, my sister-in-law Sara is visiting, so, I thought, if I can get Marta, she could come and bring me my passport and XY won't be alone at home. So all will be fine. Except that, of course, at that point I had missed my flight. But they assured me that the next one would still get me to Amsterdam on time. So I just needed to pay a reasonable "recovery fee" and get the passport in time to re-do the check in, re-clear security (and possibly re-take a coffee).

I can't really blame her, but it was kind of difficult to get hold of Marta and I had to ring quite a few times before she actually picked up the phone. And of course, she was quite upset too! (You know the kind of sleepy voice that basically sounds like: "I would probably kill you and then leave you if you were here"). But again, I don't think I can really blame her... Anyway, thankfully, enter super-wife to the rescue! She drove the 45 minutes from our house to the airport and managed to get me my passport on time.

Oh, did I mention that the flight they told me would get me to Amsterdam on time was actually full, so they couldn't rebook me on that one? Yeah $-$ that happened too... Luckily, just when I was about to give up, I thought I'd check with British Airways; I was half expecting they would ask charge £100,000 but in fact I only had to pay just a little more than the "recovery fee" would have been, so I bought a one-way ticket. 

In the end, I did manage to get to Utrecht on time. The talk was scheduled for 11.15 and I got to the conference centre with well over 10 minutes to spare! Because I didn't want to miss on any of the possible excitement of the day, I also witnessed a robbery on the train from Schipol $-$ an American guy got his backpack stolen by a lovely-looking (but clearly evil-acting) lady when the train stopped at one of the stations along the way.

By the way, the talk went well, I thought. It was probably a bit too long and I had to cut one of the examples short, but people seem to have liked it and asked me quite a few questions. I'm at the airport now, waiting to board my flight back home $-$ assuming I still have a home, that is. I did buy chocolate in the hope of placating my lovely, forgiving other half...

Tuesday, 5 November 2013

Bayesian Biostatistics 2014

This has to do with the ISBA Biostats section (I suppose it will be even more, if I am elected to the post of Program Chair, but I'll try and be involved even if I don't win!): the next Bayesian Biostatistics Conference has just been announced and will be held at MD Anderson (Houston, TX) this coming February (12-14).

I went to the 2009 edition, which was good. Most of the emphasis, as is obvious given the research interest of the organisers, was on clinical trials, in particular early phase. At that time I wasn't really working on that topic, so it was good for the academic experience, but it didn't have immediate impact on my personal work.


Now I am doing some work that is related to this, so this would probably be even more interesting (although it does happen in the middle of the teaching term, so I'm not sure I'll be able to go...). And in any case, the topics are quite diverse:
  • Imaging analysis
  • NGS data analysis
  • Subgroup analysis
  • Enrichment designs
  • Integrative genomics
  • Deconvolving tumor heterogeneity
  • Biomarker-driven adaptive designs
  • Drawing inferences from large databases
  • Anti-infectives and other non-cancer therapeutic areas
so it wouldn't necessarily be just about clinical trials!

Typos in BMHE



No matter how many times you check and no matter how good the publishers are, I'm guessing there's no way out of getting typos in a publication, especially if it's a relatively long one, such as a book.

I've just discovered a couple in BMHE, which I thought I should try and correct (or at least point out) here.


  1. Page 45, figure 2.5: the bottom part of the decision tree shows the possible outcomes when the operation does not go well. However, the headings for the branch out of the "Patient lives" random node are both "No". The top one should read "Yes" (much as in the top half of the tree).
  2. Because of the changes in the R2jags package, the code in chapter 4 and 5 should be slightly modified to say attach.jags() instead of attach.bugs() $-$ I've already explained this in more details here.
  3. Page 186: I don't really like that the transition matrix overflows to the very bottom of the page $-$ but that's not my fault... My original file didn't have that.
I'm sure there are more $-$ I'll post them when I catch them (or, more likely, when people make me notice them: I have to thank my student Shabai for noticing the mistake in the decision tree).

Monday, 4 November 2013

My talk @ the Dutch Chemometrics Symposium

For same reason, Paul Eilers really liked the talk I gave on INLA at the BayesPharma workshop earlier this year and so he invited me to talk at the Dutch Chemometrics Symposium.

Now: you may ask what have I got to do with chemometrics. And you would be right in doing that $-$ in fact, such is the extent of my ignorance on the subject, that I had to actually look "chemometrics" up... But Paul asked me to talk about Bayesian statistics in general, so that was very much up my street, which is why I gladly agreed.

The workshop is this coming Thursday (7th November) in Utrecht. I've put the slides of my talk: "Come to the dark side: we got cookies! An introduction to Bayesian statistics" here.

Tuesday, 29 October 2013

Fellow me

Last summer I have applied for a NIHR Research Methods fellowship. Earlier this week the results have come out and they have liked my proposal, which is of course great news. 

The idea of this project is to critically evaluate the stepped wedge design (SWD) in clinical trials. This is a relatively new design, effectively an extension of cross-over design, in which a given intervention is rolled out in clusters that unilaterally switch treatment at different time points. The first time point usually coincides with a baseline measurement where all the clusters are assigned to the control arm. Subsequently, clusters begin to receive the active treatment, but, unlike in a standard cross-over trial, once the intervention is given, it is not removed. The time at which the intervention is started is randomly determined.

This on the one hand typically increases the duration of the study (because several time points are usually needed to reach a fixed level of statistical power); however, on the other hand, the SWD has shown the potential to be more efficient than standard cluster randomised (CR) designs.

But of course, much as for standard cross-over designs, the actual gains depend on specific settings and parameters specifications (eg in terms of the the number of clusters and time points; the clusters size; the level of correlation between measurements in the same cluster and across time). So we'll try and investigate these issues and see under which conditions the SWD works better than other strategies. As part of the proposed outputs of this research, we have indicated that we'll produce a toolbox (in R) to perform sample size calculations and guide the analysis of the actual data.

Monday, 21 October 2013

The Big Bayes theorem theory

While we were eating a forkful of what was supposed to be a frittata, but turned out to be very fluffy mushroom scrambled eggs earlier, we were half watching an episode of The Big Bang Theory. 

Long story short, my eye was caught by Sheldon explaining how he is estimating his life expectancy, clearly using Bayes's theorem (although he didn't refer to it in his speech to Leonard).

Good stuff, Shelly!

Bad teacher(s)

This morning there has been some frenzy on the UK media (eg here or here) after the publication of a pamphlet by David Willetts, a junior minister for University and Science under the infamous coalition government.

The minister's point is that, comparatively to what used to be case in the past (notably in 1963 before changes in policy that led to increase in the number of university students), the proportion of time spent teaching by university lecturers is decreased in favour of the time that they spend otherwise.

Now, of course, this is not necessarily bad or good per se, but the minister says in his paper that "Looking back we will wonder how the higher education system was ever allowed to become so lopsided away from teaching." 

Well, one easy answer is of course to point out that apart from the huge increase in the number of students $-$ it would actually be interesting to have reasonable figures on the time spent teaching per-student, in comparison with pre-1963! $-$ the government(s) have switched the emphasis to research by decreasing the amount of funding available for universities and rewarding private initiative to obtain research money, eg from industry, or simply making the process of funding increasingly competitive!

Again, not necessarily a bad thing, but certainly not something to coolly swipe under the rug...

Saturday, 19 October 2013

R2jags & BCEA (& the examples from BMHE)

Recently, Yu-Sung Su and Masanao Yajima, the developers of the R2jags package, have released a new version (the current one is 0.03-11). As far as I understand it, one of the main changes is that since the update, R2jags no longer depends on the R2WinBUGS package (although it "imports" it).

The consequence of this is that you can no longer use the
R2WinBUGS functions, such as for example bugs or attach.bugs(), by just loading R2jags. In fact, there's a new function attach.jags() that allows you to attach the object you obtain as a result of the call to the jags function and containing, among other things, the MCMC simulations.

More importantly, if you also use BCEA and try to replicate the examples I describe in BMHE (for example see here, here, here and here) you are in trouble. All the code I have produced was running OK under the previous version of R2jags, but now you do get an error message when you try to attach the JAGS object using the attach.bugs() command.

Fortunately, this is not a huge problem and you actually have two options to solve it: the first one is to add to all those scripts a formal call to R2WinBUGS, eg library(R2WinBUGS). This will make the attach.bugs() command available again and so the rest of the code will run OK.

The second way is to actually use the attach.jags() command directly. In this, you don't need to load R2WinBUGS; however (because, as Sheldon Cooper would say: "what's life without whimsy?"), in this case you have to change the argument to this function, since attach.jags() takes a rjags object, while  attach.bugs() wants a bugs object.

So, for example, assume you have the following code.
library(R2jags)
model <- jags(data,inits,parameters.to.save,
        model.file="some_file.txt", n.chains=2, 
        n.iter, n.burnin, n.thin, DIC=TRUE, 
        working.directory=working.dir, progress.bar="text")
and you want to make the object model (and all the elements contained in it) available to your R session, you can either do
library(R2WinBUGS)
attach.bugs(model$BUGSoutput)
(notice that model is an object in the class rjags, while its element BUGSoutput is in the class bugs), or do
attach.jags(model)
directly.