Learn R Programming

fitODBOD (version 1.5.3)

dBetaCorrBin: Beta-Correlated Binomial Distribution

Description

These functions provide the ability for generating probability function values and cumulative probability function values for the Beta-Correlated Binomial Distribution.

Usage

dBetaCorrBin(x,n,cov,a,b)

Value

The output of dBetaCorrBin gives a list format consisting

pdf probability function values in vector form.

mean mean of Beta-Correlated Binomial Distribution.

var variance of Beta-Correlated Binomial Distribution.

corr correlation of Beta-Correlated Binomial Distribution.

mincorr minimum correlation value possible.

maxcorr maximum correlation value possible.

Arguments

x

vector of binomial random variables.

n

single value for no of binomial trials.

cov

single value for covariance.

a

single value for alpha parameter.

b

single value for beta parameter.

Details

The probability function and cumulative function can be constructed and are denoted below

The cumulative probability function is the summation of probability function values.

$$x = 0,1,2,3,...n$$ $$n = 1,2,3,...$$ $$0 < a,b$$ $$-\infty < cov < +\infty $$ $$0 < p < 1$$

$$p=\frac{a}{a+b}$$ $$\Theta=\frac{1}{a+b}$$

The Correlation is in between $$\frac{-2}{n(n-1)} min(\frac{p}{1-p},\frac{1-p}{p}) \le correlation \le \frac{2p(1-p)}{(n-1)p(1-p)+0.25-fo} $$ where \(fo=min [(x-(n-1)p-0.5)^2] \)

The mean and the variance are denoted as $$E_{BetaCorrBin}[x]= np$$ $$Var_{BetaCorrBin}[x]= np(1-p)(n\Theta+1)(1+\Theta)^{-1}+n(n-1)cov$$ $$Corr_{BetaCorrBin}[x]=\frac{cov}{p(1-p)}$$

NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.

References

paul1985threefitODBOD

Examples

Run this code
#plotting the random variables and probability values
col <- rainbow(5)
a <- c(9.0,10,11,12,13)
b <- c(8.0,8.1,8.2,8.3,8.4)
plot(0,0,main="Beta-Correlated binomial probability function graph",xlab="Binomial random variable",
ylab="Probability function values",xlim = c(0,10),ylim = c(0,0.5))
for (i in 1:5)
{
lines(0:10,dBetaCorrBin(0:10,10,0.001,a[i],b[i])$pdf,col = col[i],lwd=2.85)
points(0:10,dBetaCorrBin(0:10,10,0.001,a[i],b[i])$pdf,col = col[i],pch=16)
}

dBetaCorrBin(0:10,10,0.001,10,13)$pdf      #extracting the pdf values
dBetaCorrBin(0:10,10,0.001,10,13)$mean     #extracting the mean
dBetaCorrBin(0:10,10,0.001,10,13)$var      #extracting the variance
dBetaCorrBin(0:10,10,0.001,10,13)$corr     #extracting the correlation
dBetaCorrBin(0:10,10,0.001,10,13)$mincorr  #extracting the minimum correlation value
dBetaCorrBin(0:10,10,0.001,10,13)$maxcorr  #extracting the maximum correlation value

#plotting the random variables and cumulative probability values
col <- rainbow(5)
a <- c(9.0,10,11,12,13)
b <- c(8.0,8.1,8.2,8.3,8.4)
plot(0,0,main="Beta-Correlated binomial probability function graph",xlab="Binomial random variable",
ylab="Probability function values",xlim = c(0,10),ylim = c(0,1))
for (i in 1:5)
{
lines(0:10,pBetaCorrBin(0:10,10,0.001,a[i],b[i]),col = col[i],lwd=2.85)
points(0:10,pBetaCorrBin(0:10,10,0.001,a[i],b[i]),col = col[i],pch=16)
}

pBetaCorrBin(0:10,10,0.001,10,13)      #acquiring the cumulative probability values

Run the code above in your browser using DataLab