Non-invertible change of variables?

I wrote this up as a blog post explaining how the implicit function theorem relates to this issue for posterity.

http://models.street-artists.org/2017/09/22/the-implicit-function-theorem-and-likelihood-functions/

I see that some related posterity recently hit the discourse forum as well where someone linked to our old google groups discussion about rounding that initially got me thinking about this issue.

@Bob_Carpenter

Would it be hard for Stan to determine that the left hand side of a sampling statement included a transform of both parameters and data, and then alter the warning? Perhaps the warning could say something like “The left hand side of this sampling statement contains a transform of both parameters and data. This may define an implicit likelihood or may be part of a multi-parameter reparameterization which would require a Jacobian correction. It is the responsibility of the user to ensure that any required Jacobian corrections are included explicitly as Stan does not automatically calculate anything in this case.”

Or the like. I also would be happy to donate some version of my blog post to a section in the Stan manual if it seems useful (and the warning could refer to that section). I think we’ve seen several cases in the last few weeks where the warning about the Jacobian correction leads people in the wrong direction when in fact what they’re doing is an implicit likelihood. I do think the Jacobian warnings are very helpful, but they currently don’t detect the difference between say a pure invertible parameter transform requiring a Jacobian correction, and a relationship between data and a parameter that defines an implicit likelihood and so they sometimes lead people astray.

1 Like