Be the first to rate this file! 26 downloads (last 30 days) File Size: 2.9 KB File ID: #25454

bbinopdf

by Antonio Trujillo-Ortiz

 

30 Sep 2009 (Updated 30 Sep 2009)

Code covered by BSD License  

Beta-binomial probability distribution function.

Download Now | Watch this File

File Information
Description

This m-file returns the beta-binomial probability density function with parameters N, A and B at the values in X. Note: The density function is zero unless N, A and B are integers.

The Beta-binomial distribution is used to model the number of successes in n binomial trials when the probability of success p is a Beta(a,b) random variable. The extreme flexibility of the shape of the Beta distribution means that it is often a very fair representation of the randomness of p.

A variable with a Beta-binomial distribution is distributed as a binomial distribution with parameter p, where p is distribution with a beta distribution with parameters a (alpha) and b (beta). For n trials, it has probability density function:

                    
                    p(x) = n_C_x [B(x+a, n-x+b) / B(a,b)]
                    

where B(a,b) is a beta function and n_C_x is a binomial coefficient. (http://mathworld.wolfram.com/BetaBinomialDistribution.html) (http://en.wikipedia.org/wiki/Beta-binomial_model)

The probability of success varies randomly, but in any one scenario that probability applies to all trials. For example, you might consider using the Beta-binomial distribution to model:

--The number of life insurance policy holders who will die in any one year, where some external variable (e.g. highly contagious disease, extreme weather) moderates the probability of death of all individual to some degree.
--The number of cars that crash in a race of n cars, where the predominant factor is not the skill of the individual driver, but the weather on the day.
--The number of bottles of wine from a producer that are bad where the predominant factor is not how each bottle is treated, but something to do with the batch as a whole.

The Beta-binomial is a two-dimensional multivariate Polya distribution, as the binomial and beta distributions are special cases of the multinomial and Dirichlet distributions, respectively.

Syntax: function y = bbinopdf(x,n,a,b)
     
Inputs:
x - number of success
n - number of trials
a – Beta’s alpha parameter
b - Beta‘s beta parameter

Output:
y - beta-binomial probability value

Required Products Statistics Toolbox
MATLAB release MATLAB 7 (R14)
Zip File Content  
Other Files bbinopdf.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
30 Sep 2009

It was added an appropriate format to cite this file.

Tag Activity for this File
Tag Applied By Date/Time
discrete Antonio Trujillo-Ortiz 30 Sep 2009 10:39:34
betabinomial Antonio Trujillo-Ortiz 30 Sep 2009 10:39:34
pdf Antonio Trujillo-Ortiz 30 Sep 2009 10:39:34
probability Antonio Trujillo-Ortiz 30 Sep 2009 10:39:34
probability density function Antonio Trujillo-Ortiz 30 Sep 2009 10:39:34
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com