This is (in some ways) a followup on Subset error with new cmdstanr version.
After concertation with @avehtari, we’ve decided to update the name of the function to include the suffix _lpmf. Nothing too hard: I update the stan-math and the stanc3 code, notably doing an edit to
let is_distribution_name s = (not ( String.is_suffix s ~suffix:"_cdf_log" || String.is_suffix s ~suffix:"_ccdf_log" || String.equal s "laplace_marginal_poisson_log_lpmf")) && List.exists ~f:(fun suffix -> String.is_suffix s ~suffix) distribution_suffices
With these changes, I can compile and run a model that uses the following line
target += laplace_marginal_poisson_log_lpmf(y | n_samples, ye, K, phi, x, delta, delta_int, theta_0);
and in the short term, that’s all I need.
y ~ laplace_marginal_poisson_log(n_samples, ye, ...);
I get the following message
Ill-typed arguments to '~' statement. No distribution 'laplace_marginal_poisson_log' was found with the correct signature.
which is a transpiler issue. Fair enough, I didn’t do much to indicate laplace_marginal_poisson_log was a distribution. The relevant edit in
Stan_math_signatures.ml should be
let distributions = [ (full_lpmf, "beta_binomial", [DVInt; DVInt; DVReal; DVReal]) ; (full_lpdf, "beta", [DVReal; DVReal; DVReal]) . . . ; ([Lpmf], "lapalce_marginal_poisson_log", [ (DataOnly, UArray UInt); (DataOnly, UArray UInt) ; ( AutoDiffable , UFun ( [ (AutoDiffable, UVector); (DataOnly, UArray UVector) ; (DataOnly, UArray UReal); (DataOnly, UArray UInt) ] , ReturnType UMatrix ) ) ; (AutoDiffable, UVector); (DataOnly, UArray UVector) ; (DataOnly, UArray UReal); (DataOnly, UArray UInt) ; (AutoDiffable, UVector) ]) ]
which prompts the error message
MacBook-Pro:stanc3 charlesm$ dune runtest test/integration File "src/middle/Stan_math_signatures.ml", line 192, characters 5-9: Error: This variant expression is expected to have type fkind list The constructor Lpmf does not belong to type list MacBook-Pro:stanc3 charlesm$ dune runtest test/integration File "src/middle/Stan_math_signatures.ml", line 193, characters 6-29: Error: This expression has type 'a * 'b but an expression was expected of type dimensionality
I’m not sure what the error is here. I also assume there are some additional moving parts from using qualifier arguments. Any help would be very much welcomed.