How To Vectorize lccdf functions

Hi all, I am having trouble vectorizing an otherwise non-vectorized probability function. I have a censored model where profiling has showed that the censored likelihood element is by far the slowest. The approach shown below is not demonstrably faster than looping through the individual elements, and I’m wondering if I’m doing something wrong.

model {
  target += normal_lccdf(vector_y | vector_mu, real_sigma);
} 

I’m afraid that your code is OK, @jack_monroe. In cases where the actual function is very compute intensive, the vectorization doesn’t shave off much relative time. With functions like lccdd, we haven’t written particularly optimized vectorizations that can share a lot of operations that we we do with normal_lpdf.

1 Like