What does the posterior look like? Are the parameters all reasonably well identified?
We’d generally recommend using scale as a parameter—that is, sigma
, not sigma_sq
.
I don’t know enough about the kind of GP you’re trying to put together to understand the half-normal prior you put on sigma_sq
, but the precise shape rarely matters as much as where the bulk of the probability mass is, whether it goes to zero at zero, and how long the tails are.
for(k in 2:Np){
beta[k] ~ normal(0,10);
}
can be vectorized to
beta[2:nP] ~ normal(0, 10);
but that’s not going to do much for you. Why no prior on beta[1]
?
If you don’t want to save all those transformed parameters, you can make them local variables in the model.
// matrix[N1, N1] L;
this better be commented out or it’ll create an improper posterior.
delta = to_row_vector(delta_par);
for(i in 1:N1) XScaled[i] = X1[i] ./ delta;
Why not just declare delta
as a row-vector parameter rather than taking a vector then transposing it?
Nugget = diag_matrix(rep_vector(nugget, N1));
...
Sigma = cov_exp_quad(XScaled, sqrt(sigma_sq), pow(sqrt(2), -1 )) + sigma_sq*Nugget;
this is bad news. Don’t ever create diagonal matrices unless absolutely necessary. It is far far more efficient to avoid defining Nugget
and do this:
Sigma = cov_exp_quad(XScaled, sqrt(sigma_sq), 1 / sqrt(2));
for (k in 1:rows(Sigma))
Sigma[k,k] += sigma_sq * nugget[k];
It avoids creating a quadratic number of zero values on the autodiff stack.
Does cov_exp_quad
not have any jitter built in? I haven’t used it.