/** * https://mc-stan.org/docs/stan-users-guide/user-functions.html * https://mc-stan.org/docs/reference-manual/includes.html * https://mc-stan.org/docs/stan-users-guide/style-guide.html#file-extensions */ functions { vector pcat(vector theta) { // SR model predictions real c = theta[1]; // cluster storage real r = theta[2]; // cluster retrieval real u = theta[3]; // unique storage/retrieval return [ c*r, // dog, cat (1 - c)*u^2, // dog, ..., cat 2*(1 - c)*u*(1 - u), // only dog or only cat c*(1 - r) + (1 - c)*(1 - u)^2 // neither dog nor cat ]'; } }