fixed error with non-constant mu vector in dcar_proper sampler#1158
Conversation
|
Noting this PR might not initially pass testing, since testing may well include posterior results for proper CAR models. |
|
Thanks, @danielturek . Would you like to fix the equation for the conditional density for the CAR in the manual or should I? |
…ecification mean term
|
Done. Nice eye @paciorek |
|
@danielturek I have an efficiency request here. Can you call |
|
@paciorek I just made these changes. Only one call to |
|
@danielturek did you forget to push to github? |
|
@paciorek Sorry. Done. Pushed just now. |
|
Three further thoughts (sorry to belabor things)
|
|
No worries about pushing back on these design/implementation choices.
|
|
Ok, thanks for responses. Regarding item 1, I don't see how your approach saves anything. In this code based on looking at the generated C++, an intermediate variable of length N is getting created based on the call to getParam, so doing the indexing within the RHS is no different than assigning the result of getParam to an explicit variable and then grabbing the subsets out of the full vector. |
|
Side note: I was curious if it mattered that we call |
|
@paciorek Thanks for explaining this. I understand your comments, about each component sampler getting the entire mean vector, into a length-N vector, then subsetting as necessary. I agree, this could be avoided by one call to getParam in the encompassing CAR sampler function, then passing the relevant neighbor mean components to each component (scalar) sampler function. Given the small amount of testing you did, my inclination is to leave this as-is - which is working, simpler, and very similar in your speed test. How do you feel about that? Or, is there another suggestion that you made, which I missed? |
|
I'm happy to skip using |
|
@paciorek Ok, that makes sense. Are you able to make this change in the CAR component sampler code? |
|
@danielturek Yes, I'll make that change. |
|
Ok, we now set a variable that contains the entire vector of mu values in the run code and then index that. I also realized that we could use @danielturek feel free to take a look. |
|
Just pushed a minor change of variable name. (The previous name |
|
Good catch. Thx. |
and remove Mi<=0 check in car proper sampling
Fixes a bug in MCMC sampling of
dcar_properdistributions, when the mean vectormuis non-constant.The original (buggy) version correctly implemented the equations in the GeoBUGS User Manual, Version 1.2 (September 2004), which contains a typo in the conditional specification of the proper CAR distribution.
Fixes #1157