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

ebpm_point_gamma produces warnings and poor convergence #2

Open
stephens999 opened this issue Nov 11, 2019 · 2 comments
Open

ebpm_point_gamma produces warnings and poor convergence #2

stephens999 opened this issue Nov 11, 2019 · 2 comments

Comments

@stephens999
Copy link
Contributor

try:

set.seed(123)
x = rpois(1000,1000)
ebpm_point_gamma(x,1)
ebpm_point_gamma(x,1)$posterior$mean

@zihao12
Copy link
Collaborator

zihao12 commented Nov 12, 2019

Thanks! It should be fixed now. It is numerical issue for computing log(1+exp(x)) where x is small.

@pcarbo
Copy link
Member

pcarbo commented Nov 12, 2019

# logpexp(x) returns log(1 + exp(x)). The computation is performed in a
# numerically stable manner. For large entries of x, log(1 + exp(x)) is
# effectively the same as x.
logpexp <- function (x) {
  y    <- x
  i    <- which(x < 16)
  y[i] <- log(1 + exp(x[i]))
  return(y)
}

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

No branches or pull requests

3 participants