Hi
I didn't notice that I haven't cc the R-help so, unknowingly, I replied
back to you only.
That's understandable and I think I may consult for the wrong type of help.
However, I'll remain in the list in case if I get stuck in any simple R
problem again.
Best regards
Sanna Soomro
On Fri, 6 Mar 2020, 15:45 Bert Gunter, <bgunter.4567 at gmail.com> wrote:
> Unless there is a good reason not to, always cc the list in your
> responses. I am not your free private consultant.
>
> Beause you use your own function, your result is not reproducible, so that
> it is unlikely you can get useful help.
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip
)
>
>
> On Fri, Mar 6, 2020 at 6:11 AM Sanna Soomro <s.soomro97 at gmail.com>
wrote:
>
>> Hi
>>
>>
>>
>> I apologize for the late response ? I?ve been busy.
>>
>> I have attached my R code in the email but I don?t know if it gone
>> through.
>>
>> The gibb_lasso function is what I created myself.
>>
>> The packages I am using are mvtnorm, GIGrvg, tmvtnorm, RGeode and
>> truncnorm.
>>
>>
>>
>> Best regards
>>
>> Sanna
>>
>>
>>
>> *From: *Bert Gunter <bgunter.4567 at gmail.com>
>> *Date: *Thursday, 5 March 2020 at 15:40
>> *To: *Sanna Soomro <s.soomro97 at gmail.com>
>> *Subject: *Re: [R] rgamma function produces NaN values
>>
>>
>>
>> What package are you using? -- this is requested by the posting guide.
>>
>>
>> Bert Gunter
>>
>> "The trouble with having an open mind is that people keep coming
along
>> and sticking things into it."
>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic
strip )
>>
>>
>>
>>
>>
>> On Thu, Mar 5, 2020 at 12:50 AM Sanna Soomro <s.soomro97 at
gmail.com>
>> wrote:
>>
>> 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 at 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.
>>
>>
[[alternative HTML version deleted]]