Sampling from this banana shaped distribution

Hi folks,

I’m trying to sample from the following banana shaped distribution using NUTS.
I’d appreciate it if you could guide me whether my Stan model is correct or not.
Here is the model information:
Given two correlated Gaussian random variables, u1 and u2 with zero mean, unit variance and correlation coefficient rho equal to 0.9, consider the following transformation:

x = u1* a
y = (u2/a)+b*(u1^2+a^2)
where a = 1.15 and b=0.5.

So, here is my Stan code:

data{
vector[2] mu;
matrix[2, 2] Sigma;
real a;
real b;

}
parameters {
vector[2] u;
}

transformed parameters {
real x = a* u[1];
real y = (u[2]/a)+b*(u[1]^2+a^2);
}

model {
u ~ multi_normal(mu, Sigma);
}

And the attached figure is the banana shaped dist. based on x and y coordinate.

I’m wondering if my model is correct or not.
I think i need to write the joint probability dist. of x and y, but i don’t know how i can code it in Stan.

Any help would be greatly appreciated.
Hamed

You should move x and y to the generated quantities block. Other than that, your model is fine, although you don’t need Stan to draw from a multivariate normal and transform the result, and if you were to use Stan, it is better to use multi_normal_cholesky instead of multi_normal. Writing the model block in terms of x and y would require a Jacobian determinant, which is best avoided if possible, which is what you have done by putting the “prior” on the thing(s) declared in the parameters block.

Dear Ben,

Thank you very much for your prompt reply.
It is working now!

Best,
Hamed

I am wondering why this picture clearly cropped from the following paper:

https://www.researchgate.net/publication/317356872_Hamiltonian_Monte_Carlo_Methods_for_Subset_Simulation_in_Reliability_Analysis

or

https://arxiv.org/abs/1706.01435

has been placed here without contacting the Authors…

1 Like

I took a look at your paper and while I see the similarity in the figures I don’t see an exact correspondence with a specific figure. I see one candidate and the point patterns aren’t the same up to scaling AFAICT. Can you be more clear as to which figure you are suggesting?

Dear Krzysztof
the First picture of this post (which was not posted by a developer) is the “cropped version” of Figure 8 a) of the attached paper. The second clearly is not.
It is not a big deal, but we would like to see the proper reference to the original source… or at least being informed by its use

I agree that it’s appropriate (and standard) to reference a borrowed figure (esp. since they sometimes represent a serious time investment.

@H.Nik would you be willing to drop a sentence in here about the source of the figure?

Hi Sakredja,
Of course. definitely.
I don’t know why i cannot edit my original post.
I didn’t expect it will be a big deal. Anyway, i refer it here:
Dear all,
The source of the original figure is from the following paper:
https://arxiv.org/abs/1706.01435

1 Like

Definitely not a big deal, we just try to keep the forums friendly and that means wrapping up the ends in response to @marcobroccardo’s comment.

Thanks!

1 Like

Dear Dr. Broccardo,

I’m sorry for that and I referred it in the following post.

Regards,
Hamed

No Problem! Thank you very much!

1 Like