Closed amarshankarc closed 6 months ago
Please note from the documentation that BAS::hypergeometric1F1
computes the log of the function by default.
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
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