## [Maxima-bugs] [ maxima-Bugs-3560390 ] negative_binomial overly restrictive

 [Maxima-bugs] [ maxima-Bugs-3560390 ] negative_binomial overly restrictive From: SourceForge.net - 2012-08-22 16:12:43 ```Bugs item #3560390, was opened at 2012-08-21 08:42 Message generated for change (Comment added) made by riotorto You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3560390&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open >Resolution: Fixed Priority: 5 Private: No Submitted By: Jerry W. Lewis (statsman) Assigned to: Nobody/Anonymous (nobody) Summary: negative_binomial overly restrictive Initial Comment: The negative binomial distribution need not be restricted to integer values of the argument n; cf. http://en.wikipedia.org/wiki/Negative_binomial_distribution Indeed, the noninteger case as an overdispersed generalization of the Poisson distribution is important in many fields, including ecology, environmental monitoring, epidemiology, industrial safety, insurance, medicine, microbiology, etc. Here are function definitions for the general negative binomial pdf and cdf pdf_negative_binomial2(x,n,p) := pdf_beta(p,n,x+1)*p/(n+x)\$ /* negative binomial for real n>0 */ cdf_negative_binomial2(x,n,p) := cdf_beta(p,n,x+1)\$ /* negative binomial for real n>0 */ The functions for mean, var, std, skewness, and kurtosis should be fine if you just remove the trap for non-integer n. Assuming that the quantile function numerically inverts the cdf, then it would likely be fine too. ---------------------------------------------------------------------- >Comment By: Mario Rodriguez Riotorto (riotorto) Date: 2012-08-22 09:12 Message: Thanks for bringing this to our attention. It's now fixed in git repository. Instead of using pdf_beta, we call beta_incomplete_regularized and the floor function to take into account the discrete nature of the r.v. Also, quantile_negative_binomial needed a bug fix. -- Mario ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3560390&group_id=4933 ```

 [Maxima-bugs] [ maxima-Bugs-3560390 ] negative_binomial overly restrictive From: SourceForge.net - 2012-08-21 15:50:06 ```Bugs item #3560390, was opened at 2012-08-21 08:42 Message generated for change (Settings changed) made by statsman You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3560390&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jerry W. Lewis (statsman) Assigned to: Nobody/Anonymous (nobody) >Summary: negative_binomial overly restrictive Initial Comment: The negative binomial distribution need not be restricted to integer values of the argument n; cf. http://en.wikipedia.org/wiki/Negative_binomial_distribution Indeed, the noninteger case as an overdispersed generalization of the Poisson distribution is important in many fields, including ecology, environmental monitoring, epidemiology, industrial safety, insurance, medicine, microbiology, etc. Here are function definitions for the general negative binomial pdf and cdf pdf_negative_binomial2(x,n,p) := pdf_beta(p,n,x+1)*p/(n+x)\$ /* negative binomial for real n>0 */ cdf_negative_binomial2(x,n,p) := cdf_beta(p,n,x+1)\$ /* negative binomial for real n>0 */ The functions for mean, var, std, skewness, and kurtosis should be fine if you just remove the trap for non-integer n. Assuming that the quantile function numerically inverts the cdf, then it would likely be fine too. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3560390&group_id=4933 ```
 [Maxima-bugs] [ maxima-Bugs-3560390 ] negative_binomial overly restrictive From: SourceForge.net - 2012-08-22 16:12:43 ```Bugs item #3560390, was opened at 2012-08-21 08:42 Message generated for change (Comment added) made by riotorto You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3560390&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open >Resolution: Fixed Priority: 5 Private: No Submitted By: Jerry W. Lewis (statsman) Assigned to: Nobody/Anonymous (nobody) Summary: negative_binomial overly restrictive Initial Comment: The negative binomial distribution need not be restricted to integer values of the argument n; cf. http://en.wikipedia.org/wiki/Negative_binomial_distribution Indeed, the noninteger case as an overdispersed generalization of the Poisson distribution is important in many fields, including ecology, environmental monitoring, epidemiology, industrial safety, insurance, medicine, microbiology, etc. Here are function definitions for the general negative binomial pdf and cdf pdf_negative_binomial2(x,n,p) := pdf_beta(p,n,x+1)*p/(n+x)\$ /* negative binomial for real n>0 */ cdf_negative_binomial2(x,n,p) := cdf_beta(p,n,x+1)\$ /* negative binomial for real n>0 */ The functions for mean, var, std, skewness, and kurtosis should be fine if you just remove the trap for non-integer n. Assuming that the quantile function numerically inverts the cdf, then it would likely be fine too. ---------------------------------------------------------------------- >Comment By: Mario Rodriguez Riotorto (riotorto) Date: 2012-08-22 09:12 Message: Thanks for bringing this to our attention. It's now fixed in git repository. Instead of using pdf_beta, we call beta_incomplete_regularized and the floor function to take into account the discrete nature of the r.v. Also, quantile_negative_binomial needed a bug fix. -- Mario ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3560390&group_id=4933 ```
 [Maxima-bugs] [ maxima-Bugs-3560390 ] negative_binomial overly restrictive From: SourceForge.net - 2012-11-02 06:32:01 ```Bugs item #3560390, was opened at 2012-08-21 08:42 Message generated for change (Comment added) made by rtoy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3560390&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: Jerry W. Lewis (statsman) Assigned to: Nobody/Anonymous (nobody) Summary: negative_binomial overly restrictive Initial Comment: The negative binomial distribution need not be restricted to integer values of the argument n; cf. http://en.wikipedia.org/wiki/Negative_binomial_distribution Indeed, the noninteger case as an overdispersed generalization of the Poisson distribution is important in many fields, including ecology, environmental monitoring, epidemiology, industrial safety, insurance, medicine, microbiology, etc. Here are function definitions for the general negative binomial pdf and cdf pdf_negative_binomial2(x,n,p) := pdf_beta(p,n,x+1)*p/(n+x)\$ /* negative binomial for real n>0 */ cdf_negative_binomial2(x,n,p) := cdf_beta(p,n,x+1)\$ /* negative binomial for real n>0 */ The functions for mean, var, std, skewness, and kurtosis should be fine if you just remove the trap for non-integer n. Assuming that the quantile function numerically inverts the cdf, then it would likely be fine too. ---------------------------------------------------------------------- >Comment By: Raymond Toy (rtoy) Date: 2012-11-01 23:32 Message: Actually close the bug. ---------------------------------------------------------------------- Comment By: Mario Rodriguez Riotorto (riotorto) Date: 2012-08-22 09:12 Message: Thanks for bringing this to our attention. It's now fixed in git repository. Instead of using pdf_beta, we call beta_incomplete_regularized and the floor function to take into account the discrete nature of the r.v. Also, quantile_negative_binomial needed a bug fix. -- Mario ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3560390&group_id=4933 ```