Speeding up hurdle model with latent factors and covariates?

Makes sense to me.

The simplest way to check this will be to just write a function for both and make sure they’re returning the same value.

Like in generated quantities do:

generated quantities {
  real lp1 = my_slow_lpdf_i_trust(...);
  real lp2 = my_fast_lpdf_i_want_to_check(...);
  real error = abs(lp1 - lp2);
}

And then just look at the output distribution of error.

Probably. There will be a new release of cmdstan tomorrow that has a profiling feature that should make it easier to figure this out: CmdStan 2.26.0 release candidate (cmdstanr will support the profiling too)