Sunday, March 31, 2013

System76 Linux computer

I recently bought a Linux desktop computer ("Leopard Extreme") from System76. It has a six-core Intel Core I7 CPU, 64 GB memory, and an Intel SSD. I have to replace the Ubuntu system, which came pre-installed, with Mint to make it fully functional. 

I really like this machine, and it certainly has made my data analysis work easier and more pleasurable. 

Saturday, March 16, 2013

Save compilation time with RStan


It seems RStan compiles the program every time the "stan_code = " option in "stan" command was invoked. The best way to avoid this is to do it once:

fit1 <- stan(model_code = "stan.model," chains = 1, data = data)

Then call it using the "fit" option:

fit2 <- stan(fit="fit1," data=data, iter = 10000)

Or do it in parallel way:

library(parallel)
sflist1 <- 
  mclapply(1:4, mc.cores = 8, 
           function(i) stan(fit = fit1, chains = 1, chain_id = i, refresh = -1))
fit3 <- sflist2stanfit(sflist1)

Tuesday, March 12, 2013

Counter