Torsten feature: Provide a Stan language function for piecewise linear interpolation.
Description:
Return the values of a piecewise linear function at specified values of the first function argument. The function is specified in terms of a set of x y pairs. The x values must be in increasing order. All 3 arguments may be data or parameters.
The following is a simple toy Stan model that illustrates use of the proposed function.
data{
int nObs;
real xObs[nObs];
real yObs[nObs];
int nx;
real x[nx];
}
parameters{
real y[nx];
real sigma;
}
transformed parameters{
real yHat[nObs];
yHat = linear_interpolation(xObs, x, y);
}
model{
y ~ normal(0, 25);
yObs ~ normal(yHat, sigma);
}
Summary:
Torsten feature: Provide a Stan language function for piecewise linear interpolation.
Description:
Return the values of a piecewise linear function at specified values of the first function argument. The function is specified in terms of a set of x y pairs. The x values must be in increasing order. All 3 arguments may be data or parameters.
The following is a simple toy Stan model that illustrates use of the proposed function.