Parameter fitting with STAN? I have a model that produces data given a set of parameters. Now, given data, I'ld like to find out which parameters of the model are likely. I have an implementation in Matlab that uses Delayed Rejection Adaptive Metropolis for fitting (DRAM toolbox). Basically, DRAM samples parameter values, and tries to minimize an objective function. 
Not having used STAN before, I was wondering: 
(1) If and how such this could be implemented in STAN, 
and, in case it is possible, 
(2) if one could expect speed improvements as compared to using Matlab, since STAN code is compiled?
 A: This is less an answer than an extended comment, so apologies to the reader.


*

*Yes, it is possible to implement a routine that will find optimal parameter values given data and a prior in STAN. However, in STAN, your objective function is assumed to be the log posterior probability. You don't specify your objective function in your question, but if  you are indeed looking to find the most probable parameter values given your data and a prior, you're set. If not, then there may be clever ways to manipulate the log posterior probability to optimize alternative functions, but that is not STAN's manifest purpose -- and not my area of expertise. You might find a more informative answer by asking a more detailed question on STAN's (very helpful) Google group.

*I am uncertain whether STAN will be more efficient in your particular application. All things being equal, noncompiled code is probably (certainly? I'm not a computer science person) slower than compiled code. But all things are not equal here, as we are comparing one implementation of STAN (in R, C, or Python) to MATLAB. Additionally, major features of STAN's performance are determined by how well you code you model, define data transformations, and take additional steps to ensure that the way you go about defining your model are optimal for Hamiltonian Monte Carlo sampling, so it's not as simple as asking whether or not STAN is faster than an alternative program. The same model, coded in two different, equivalent ways, can converge very quickly or very slowly in STAN for reasons that are described extensively in its documentation.
