Hi all,
I have a complex pdf based on hierarchical Bayesian formalism where x depends on the hyperpriors w’ and w’’ as w=Gamma(beta/2,2/zeta) where Gamma is the gamma distribution with parameters beta and zeta. The resulting negative log likelihood for joint posterior pdf is in the attached picture. I want to sample both of w’, w’’, and x. My approach is to use the Hamiltonian Monte Carlo sampler. I have the following questions below:

I thought before that I can split the sampling process that, I sample w’ and w’’ from the gamma distribution first. And as they become known values, they can be taken out from the exponential as normalizing constants leaving only x to be sampled. As I have the constraint x>=0, this makes the posterior truncated mulitivariate Gaussian. Consequently, I thought of sampling x using the exact algorithm by Pakman and Paninski. Is this approach feasible?

I want to use the HMC algorithm by Stan, however I want to know if the optimizer in Stan to estimate the MAP supports the x>=0 constraint or it is for x>0 only?

Can you refer me to a good RStan example to train myself who to sample a complex hierarchical posteriors like the one attached?
Thanks and best regards
Notes:
Exact HMC algorithm: https://arxiv.org/abs/1208.4118
lambda, beta, zeta are given input parameters