On 1/23/14, 5:37 PM, Chris Rose wrote:
> Thanks, Bob, that's useful. And it would be great to see user-definable functions (and some sensible way to test and
> debug them) in Stan.
User-definable functions are on the short-term to-do list.
I'm imagining a syntax like this for functions:
simplex foo(vector x, real[,] y, int N) {
... local var defs ...
... statements ...
return result;
}
for a function that takes a vector, a 2D array of reals,
and an integer as input and returns a simplex.
And then for relational calls that could be used to
define submodels, something like:
void linear_regression(matrix x, vector beta, real<lower=0> sigma) {
sigma ~ cauchy(0,2.5);
beta ~ cauchy(0,2.5);
y ~ normal(x * beta, sigma);
}
So you'd still have access to the log probabilities where
appropriate.
We still have to work out the details.
- Bob