Dear all,
I have a question on the relative speed of calculating log probabilities either with Nimble or without it. My general lesson would be that it is faster without Nimble - except maybe if done "online" - and I wished to challenge this view.
The way I do it with Nimble is though the three lines of code below:
### putting the x-th line of samples.List.matrix as parameter values in the model with the function setInits
Model[[1]]$setInits(coda2NamedList(samples.List.matrix[toto,],params,Model[[1]]))
### then calculating the logProbs of all the data with the $getLogProb function and summing them: this is the value that will be returned to logliks
Model[[1]]$calculate()
sum(sapply(names(data),function(toto) {Model[[1]]$getLogProb(toto)}))
where: samples.list.matrix contains ion line the parameter values in Coda format; and coda2NamedList transforms it to named lists.
With a very simple model I find it rather long and much longer than what I would do by hand without Nimble. I would be interested to have opinions on (i) whether this is general or if with much more complicated model the trend would be reversed; and (ii) whether there would be other Nimbvle commands that could make it much faster (such as giving Nimble the whole set of samples at once ...).
I thank you very much in advance.
All the best,
Frédéric