diff --git a/inst/stan/include/distributions.stan b/inst/stan/include/distributions.stan index 4368274..f8d8d31 100644 --- a/inst/stan/include/distributions.stan +++ b/inst/stan/include/distributions.stan @@ -130,19 +130,19 @@ real surv_weibull_lpdf (real t, real d, real shape, real scale) { return log_lik; } -// take additional arguments for integration -real weibull_survival_1d(real t, real xc, array[] real theta, array[] real x_r, array[] int x_i) { +// Define the function to be integrated +real weibull_survival_1d(real t, real xc, vector theta, data vector x_r, data int x_i) { real shape = theta[1]; real scale = theta[2]; return exp(-pow(t / scale, shape)); } -// restricted mean survival time +// Restricted mean survival time real rmst_weibull(real shape, real scale, real tmax) { real rmst; - array[2] real theta = {shape, scale}; - array[0] real x_r; - array[0] int x_i; + vector[2] theta = [shape, scale]; + vector[0] x_r; // zero-sized vector + int[0] x_i; // zero-sized int array // integrate survival function from 0 to tmax rmst = integrate_1d(weibull_survival_1d, 0, tmax, theta, x_r, x_i, 1e-8);