Hi all,

I’m new to Stan and gaussian processes, but I have a problem at hand where these can potentially be very useful.

I want to build a non-parametric gaussian process using an exponentiated quadratic kernel to model count data with a negative binomial distribution. My *y* is a vector of count data and my *x* is a vector of natural numbers.

I followed Michael’s excellent blog post ( https://betanalpha.github.io/assets/case_studies/gp_part1/part1.html ), although I have a few doubts on how to modify the existing example to consider a neg_binomial_2 distribution.

Could you point me to any example that could achieve this, similarly to the example below (I found this thread https://groups.google.com/forum/#!msg/stan-users/XjHD_2FvVlE/PAjfY62zDkwJ but I couldn’t understand/find the final model)?

data {

int<lower=1> N;

real x[N];

vector[N] y;

}parameters {

real<lower=0> rho;

real<lower=0> alpha;

real<lower=0> sigma;

}model {

matrix[N, N] cov = cov_exp_quad(x, alpha, rho) + diag_matrix(rep_vector(square(sigma), N));

matrix[N, N] L_cov = cholesky_decompose(cov);y ~ multi_normal_cholesky(rep_vector(0, N), L_cov);

}

I also would like to fit this model to two different *y*’s and find where these two GPs differ significantly (I’ll also need to contain a specific offset to each *y*). I presume I can obtain this by assessing calculating | GP1(x) - GP2(x) | and validating if the difference is higher than the expected standard variation of each GP1 and GP2.

I apologise in advance for the basic questions and thank you any opinion/suggestion you might have.

Thanks,