// poisson_regression.stan data { int n; // number of observations int p; // number of covariates int m; // number of grid points array[n] int y; // response variables matrix[n,p] X; // matrix of covariates matrix[m,p] grid; // matrix of grid points real a; real b; } transformed data { real t_c = (2*a+p-1)/(2*b); } parameters { vector[p] beta; } model { sqrt(dot_self(beta)*t_c) ~ student_t(2*a+p-1, 0, 1); target += poisson_log_glm_lpmf( y | X, 0, beta ); } generated quantities { vector[m] fn_vals; for (i in 1:m) fn_vals[i] = exp( dot_product(beta,grid[i]) ); }