Hi,

In my code, I want to sample from the posterior distribution to get
estimates for each parameter via the Bayesian approach. My model has
spatial coefficient and lasso penalty.

When I run this line

gibbs_lasso(y = Y, x= X, W=W.rook, tau = 0.5, M=2)

It works, however, when I changed M from 2 to 5, I get the following error:

Error in rgig(1, 0.5, (SIGMA[m, ]/theta2) * ((y[ik] - crossprod(x[ik,  :
  invalid parameters for GIG distribution: lambda=0.5, chi=nan, psi=nan
In addition: Warning message:
In rgamma(1, shape = 1.5 * n + a0, rate = SIGMAgamma + b0) : NAs produced

It makes sense that rgig cannot accept NaN values of sigma parameter in its
computation. But why does rgamma produces NaN value for sigma? The gamma
distribution require both shape and scale parameters to be positive and my
R computations for both should always be positive then sigma can be sampled
easily. So, what went wrong in my code?

Best regards
Sanna
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to