We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
beta_poisson_pmf<- function(x, alpha, beta, N) {
beta_term <- gamma(x + alpha) * gamma(alpha + beta) / (gamma(alpha) * gamma(x + alpha + beta))
poisson_term <- N^x / gamma(x + 1)
hypergeo_term <- hypergeometric1F1(x + alpha, x + alpha + beta, -N)
result <- beta_term * poisson_term *hypergeo_term
return(result) } print(beta_poisson_pmf(1,2,3,10)) IAM GETTING BETA POISSON PROBABILITY MASS FUNCTION AS NEGATIVE AND ABOVE ONE WHICH IS NOT POSSIBLE
The text was updated successfully, but these errors were encountered:
Please note from the documentation that BAS::hypergeometric1F1 computes the log of the function by default.
BAS::hypergeometric1F1
hypergeometric1F1(a, b, c, laplace = FALSE, log = TRUE)
> BAS::hypergeometric1F1(1+2,1 + 2 + 3,-10) [1] -3.467487 > BAS::hypergeometric1F1(1+2,1 + 2 + 3,-10, log=FALSE) [1] 0.03119531
Sorry, something went wrong.
No branches or pull requests
Define the probability mass function (PMF) function
beta_poisson_pmf<- function(x, alpha, beta, N) {
Beta function term
beta_term <- gamma(x + alpha) * gamma(alpha + beta) / (gamma(alpha) * gamma(x + alpha + beta))
Poisson term
poisson_term <- N^x / gamma(x + 1)
Confluent hypergeometric function term
hypergeo_term <- hypergeometric1F1(x + alpha, x + alpha + beta, -N)
Combine terms
result <- beta_term * poisson_term *hypergeo_term
return(result)
}
print(beta_poisson_pmf(1,2,3,10))
IAM GETTING BETA POISSON PROBABILITY MASS FUNCTION AS NEGATIVE AND ABOVE ONE WHICH IS NOT POSSIBLE
The text was updated successfully, but these errors were encountered: