The disappearing mouse pointer…
To synchronize the behavioral data with the fMRI data, a Siemens mri-scanner sends a pulse at the start of every scan, and this pulse is picked up by your mac as a ‘^’-keypress. This makes it really easy to log the scan times, but it also hides the mouse pointer every two seconds, which is extremely annoying for your participants if they have to use the mouse. I had to find a solution for this...
When google didn’t provide an answer, I came to realize that there is no way (as far as I know - please correct me if I’m wrong) to not hide the mouse pointer in OS X when you’re typing. To solve this, I came up with the following solution. First, download pinpoint, a tiny application from macchampion that displays a graphic around your mouse pointer. Then, pay the 10$ fee which allows you to add your own graphics, and add a standard mac cursor as a graphic. Now, make sure this cursor is displayed at the exact same location as your own mouse pointer, and you fixed your problem. While the real mouse pointer still disappears on every scanner pulse, the graphic stays in place, and your participants won’t even notice that the real pointer disappeared.

S3 vs S4, efficiency issues
While developing some new simulation code with S4 system I stumbled upon some big difficulties in terms of computational efficiency. That lead me to diging into archives of Rhelp and Rdevel looking for clues. I found some interesting threads that address almost exactly the same problems that I do. Read for yourself here and here, including the follow-ups by John Chambers and others.
It is almost two years since I started to use S4 extensively for almost anything I develop in R. The transparency of the code and the ease of maintenance is so much greater in S4 than in S3. Not mentioning multiple inheritance, validity checks etc.
Things seem to have improved since 2003 as this example, based on one of the posts mentioned above gave back then:
setClass("MyClass", representation(x="numeric"))
system.time( structure(list(x=rep(1, 10^7)), class="MyS3Class") )
# [1] 1.05 0.00 1.05 NA NA
system.time( new("MyClass", x=rep(1, 10^7)) )
# [1] 3.15 0.34 11.19 NA NA
So at least 3 times slower in S4 case. Now, on my P4 3.2Ghz, with R 2.7.0 gave
setClass("MyClass", representation(x="numeric"))
system.time( structure( list(x=rep(1,10^7)), class="MyS3Class") )
# user system elapsed
# 0.74 0.19 0.94
system.time( new("MyClass",x=rep(1,10^7)))
# user system elapsed
# 0.80 0.18 1.06
which is comparable.
Nevertheless, I tried code profiling on my simulation and the output revealed that the majority of the CPU time was spent on method dispatch etc. so the difference might be still substantial. Right now my code works. Perhaps at some point I’ll port some portion to S3 and compare the results…
R2jags: A Package for Running jags from R
Error capture
for (i in 1:1000){
fit<-try(lm(y~x,dataset))
results<- ifelse(class(fit)=="try-error", NA, fit$coefficients)
}
How to make SVN work on R-Forge and your local driver?
Paper on GillespieSSA now published
My paper on the GillespieSSA package has now been published in the latest volume of Journal of Statistical Software.
