TransformVariables.jl icon indicating copy to clipboard operation
TransformVariables.jl copied to clipboard

symmetric positive definite domain

Open simonbyrne opened this issue 7 years ago • 10 comments

Could you add a symmetric positive definite domain transformation? It could be based on the correlation one.

simonbyrne avatar Aug 30 '18 00:08 simonbyrne

I will add one (perhaps in the examples on how to use CustomTransform). But I am curious what you need it for, since in practice its Cholesky factor is much more useful for inference.

tpapp avatar Aug 30 '18 05:08 tpapp

I have a model where the prior is inverse Wishart.

simonbyrne avatar Aug 30 '18 16:08 simonbyrne

I added it as a test/example.

I will think about adding it as a regular transform, but I don't think Wishart is a good prior, so I would rather encourage using half-Cauchy for standard deviations and LKJ for the correlation matrix (apologies if you know about this and decided you still need Wishart).

tpapp avatar Aug 31 '18 13:08 tpapp

I agree, but i'm replicating someone else's results.

simonbyrne avatar Aug 31 '18 16:08 simonbyrne

and thanks for the example!

simonbyrne avatar Aug 31 '18 16:08 simonbyrne

@simonbyrne: just to let you know, I am merging an API change now. I have updated the example in the tests.

If you are using this library in production, you may want to pin to df4234b, or update your code.

As the library is currently in development and I am experimenting, there will be no deprecations or releases until it stabilizes. So you may want to use Github's watch functionality for notifications.

tpapp avatar Sep 08 '18 07:09 tpapp

No problem, thanks for the heads up.

simonbyrne avatar Sep 09 '18 17:09 simonbyrne

+1 to please add this. I don't think preference against the Inverse Wishart prior is a strong reason not to include this transform - appropriateness of the Wishart/IW prior depends on the user's likelihood. I'm using a Wishart it for estimating a symmetric positive definite matrix that isn't a covariance (i.e. my likelihood is not multivariate Gaussian with unknown Sigma or anything remotely near), where LKJ is not necessarily appropriate, and Wishart with identity hyperparameter is a natural choice due to its group invariance properties.

aterenin avatar Dec 21 '18 14:12 aterenin

So would you need a transformation from an n⋅(n+1)/2 vector of reals to an n × n positive definite matrix?

tpapp avatar Dec 23 '18 17:12 tpapp

Yes - just as in Stan - this would be fantastic!

aterenin avatar Dec 23 '18 21:12 aterenin