Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Error in ggs_geweke from 0-var check in sde0f function #63

Merged
merged 1 commit into from
Feb 15, 2019

Conversation

brianstock
Copy link
Contributor

Hello,

I wrote and maintain a package that depends on ggmcmc (MixSIAR). In one of my updates, I encountered an error stemming from ggs_geweke, which I traced to sde0f.

The error was surprising, because it occurred for a JAGS model with an informative prior, but NOT for the same model with the same data using an uninformative prior. My guess is the issue occurs for a parameter with nearly 0 variance. Your check for 0 variance in sde0f was length(unique(x)) > 0, but an alternative solution from Stack Overflow seems more robust in my case:

0 != var(if (is.factor(x)) as.integer(x) else x)

When I make this change to sde0f I get no errors with ggs_geweke for either model.

@aijawhite
Copy link

Thank you! This fix worked for the error code in my case too.

@xfim
Copy link
Owner

xfim commented Feb 15, 2019

Thank you.

@xfim xfim merged commit 035d1af into xfim:master Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants