Issues with defining the custom likelihoods of spatial survival model in Stan

In such cases, it is often best to start with a subset of the data to let you iterate quickly and only move to full dataset when you are confident your model works for the smaller data. Often one can simplify the model and reduce dataset at the same time. In your case, it could make sense to start with data from a single province, (potentially further subsampled to say a 100 observations) low dimensional kernel (low n_grid) and using no predictors (i.e. num = 0). Once this is working, one can move to moree complex stuff.

Also note that you can use triple backticks (```) to neatly format your Stan/R code. I edited your previous post for you.