I was writing a Stan program and some issues came up:
- Linear interpolation. I wanted to create a function that interpolates, something like this:
vector[N] x0;
vector[N] y0;
The function f(y) interpolates:
If x < x0[1], then y = x0[1];
If x is between x0[n] and x0[n+1], then y interpolates between y0[n] and y0[n+1];
If x > x0[N], then y = y0[n];
A few years ago we discussed this. I couldn’t find it in the Stan manual. It would be super-useful. Currently I’m using an ugly hack.
-
Concatenating vectors or arrays. I wanted to do something like this: a = c(b1, b2, b3), where b1, b2, b3 are vectors or 1-d arrays of reals. Is there a Stan function that does this? Again, the way I had to do this was kind of ugly. This issue comes up when stringing together different pieces of data for a Stan function call.
-
Vectors and arrays. This keeps coming up, that for some purposes we want a vector, for other purposes an array of reals, and I have to keep going back and forth between them using to_array_1d. I recall there being some discussion about making Stan more user-friendly? This comes up a lot!
Thanks.