I am working a very basic Bayes Lasso model and I have included the code here. While the code is working just fine, I was wondering if there is any way I can include a line of code that will provide me with the pointwise 95% prediction interval in the generated quantity block. I am guessing there is the computationally strenuous way of defining the prediction interval. But I was wondering if there is a piece of STAN code that just computes the pointwise prediction interval automatically. Thank you in advance.
data {
int<lower=1> N; // Number of data points in training set
int<lower=1> M; // Number of covariates
int<lower=1> N2; // Number of obs to predict in test set
matrix[N, M] X;
matrix[N2, M] X2pred;
int<lower=0,upper=1> y[N];
}
parameters {
vector[M] beta;
real<lower=0> sigma;
}
model {
beta ~ double_exponential(0, sigma);
sigma ~ inv_gamma(0.1,0.1);
y ~ bernoulli_logit(X * beta);
}
generated quantities{
int<lower=0,upper=1> y_post[N2];
y_post = bernoulli_logit_rng(X2pred*beta);
}