tensorflow / probability

Probabilistic reasoning and statistical analysis in TensorFlow
https://www.tensorflow.org/probability/
Apache License 2.0
4.26k stars 1.1k forks source link

Copula primer mentions Uniform marginals, but example does not have uniform marginals #1591

Open gmjw opened 2 years ago

gmjw commented 2 years ago

[TFP is awesome, thanks so much for all the amazing functionality!]

I've been reading the copulas primer at https://www.tensorflow.org/probability/examples/Gaussian_Copula

Twice in the first couple of paragraphs it mentions that a copula is a distribution on [0, 1]^n with uniform marginals.

a copula is a multivariate distribution C(U_1, U_2, ...) such that marginalizing gives U_i ~ Uniform(0, 1).

the Gaussian Copula is a distribution over the unit hypercube [0, 1]^n with uniform marginals.

However, in the example just below, the copula pdf pdf = GaussianCopulaTriL(...) doesn't have uniform marginals. The contour plot here is clearly non-uniform in the y direction (the marginal is Normal-like, not Uniform).

Would anyone be able to explain why this is?

gmjw commented 2 years ago

Ah, I think the scale_tril argument to the GaussianCopulaTriL is wrong.

I think

 scale_tril=[[1., 0.8], [0., 0.6]],

should be

scale_tril=[[1., 0], [0.8, 0.6]],

This seems to fix the example to have uniform marginals. I'll stick up a PR.