| Title: | Modeling Over Dispersed Binomial Outcome Data Using BMD and ABD |
|---|---|
| Description: | Contains Probability Mass Functions, Cumulative Mass Functions, Negative Log Likelihood value, parameter estimation and modeling data using Binomial Mixture Distributions (BMD) (Manoj et al (2013) <doi:10.5539/ijsp.v2n2p24>) and Alternate Binomial Distributions (ABD) (Paul (1985) <doi:10.1080/03610928508828990>), also Journal article to use the package(<doi:10.21105/joss.01505>). |
| Authors: | Amalan Mahendran [aut, cre] (ORCID: <https://orcid.org/0000-0002-0643-9052>), Pushpakanthie Wijekoon [aut, ctb] (ORCID: <https://orcid.org/0000-0003-4242-1017>) |
| Maintainer: | Amalan Mahendran <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.5.5 |
| Built: | 2026-05-21 07:35:52 UTC |
| Source: | https://github.com/Amalan-ConStat/fitODBOD |
Lemmens , Knibbe and Tan(1988) described a study of self reported alcohol frequencies. The no of alcohol consumption data in two reference weeks is separately self reported by a randomly selected sample of 399 respondents in the Netherlands in 1983. Number of days a given individual consumes alcohol out of 7 days a week can be treated as a binomial variable. The collection of all such variables from all respondents would be defined as "Binomial Outcome Data".
Alcohol_dataAlcohol_data
A data frame with 3 columns and 8 rows.
DaysNo of Days Drunk
week1Observed frequencies for week1
week2Observed frequencies for week2
Extracted from
Manoj, C., Wijekoon, P. & Yapa, R.D., 2013. The McDonald Generalized Beta-Binomial Distribution: A New Binomial Mixture Distribution and Simulation Based Comparison with Its Nested Distributions in Handling Overdispersion. International Journal of Statistics and Probability, 2(2), pp.24-41.
Available at: doi:10.5539/ijsp.v2n2p24
Alcohol_data$Days # extracting the binomial random variables sum(Alcohol_data$week2) # summing all the frequencies in week2Alcohol_data$Days # extracting the binomial random variables sum(Alcohol_data$week2) # summing all the frequencies in week2
The below function has the ability to extract from the raw data to Binomial Outcome Data. This function simplifies the data into more presentable way to the user.
BODextract(data)BODextract(data)
data |
vector of observations |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further
The output of BODextract gives a list format consisting
RV binomial random variables in vector form
Freq corresponding frequencies in vector form
datapoints <- sample(0:10,340,replace=TRUE) #creating a sample set of observations BODextract(datapoints) #extracting binomial outcome data from observations Random.variable <- BODextract(datapoints)$RV #extracting the binomial random variablesdatapoints <- sample(0:10,340,replace=TRUE) #creating a sample set of observations BODextract(datapoints) #extracting binomial outcome data from observations Random.variable <- BODextract(datapoints)$RV #extracting the binomial random variables
Data in this example refer to 337 observations on the secondary association of chromosomes in Brassika; n , which is now the number of chromosomes, equals 3 and X is the number of pairs of bivalents showing association.
Chromosome_dataChromosome_data
A data frame with 2 columns and 4 rows
No.of.AssoNo of Associations
freObserved frequencies
Extracted from
Paul, S.R., 1985. A three-parameter generalization of the binomial distribution. Communications in Statistics - Theory and Methods, 14(6), pp.1497-1506.
Available at: doi:10.1080/03610928508828990
Chromosome_data$No.of.Asso #extracting the binomial random variables sum(Chromosome_data$fre) #summing all the frequenciesChromosome_data$No.of.Asso #extracting the binomial random variables sum(Chromosome_data$fre) #summing all the frequencies
The data refer to the numbers of courses taken by a class of 65 students from the first year of the Department of Statistics of Athens University of Economics. The students enrolled in this class attended 8 courses during the first year of their study. The total numbers of successful examinations (including resits) were recorded.
Course_dataCourse_data
A data frame with 2 columns and 9 rows
sub.passsubjects passed
freObserved frequencies
Extracted from
Karlis, D. & Xekalaki, E., 2008. The Polygonal Distribution. In Advances in Mathematical and Statistical Modeling. Boston: Birkhuser Boston, pp. 21-33.
Available at: doi:10.1007/978-0-8176-4626-4_2.
Course_data$sub.pass # extracting the binomial random variables sum(Course_data$fre) # summing all the frequenciesCourse_data$sub.pass # extracting the binomial random variables sum(Course_data$fre) # summing all the frequencies
These functions provide the ability for generating probability function values and cumulative probability function values for the Additive Binomial Distribution.
dAddBin(x,n,p,alpha)dAddBin(x,n,p,alpha)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
p |
single value for probability of success |
alpha |
single value for alpha parameter. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
The alpha is in between
The mean and the variance are denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dAddBin gives a list format consisting
pdf probability function values in vector form.
mean mean of Additive Binomial Distribution.
var variance of Additive Binomial Distribution.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506. Morel JG, Neerchal NK (2012). Overdispersion models in SAS. SAS Publishing.
#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Additive 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,dAddBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dAddBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dAddBin(0:10,10,0.58,0.022)$pdf #extracting the probability values dAddBin(0:10,10,0.58,0.022)$mean #extracting the mean dAddBin(0:10,10,0.58,0.022)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Additive 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,pAddBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pAddBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pAddBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Additive 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,dAddBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dAddBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dAddBin(0:10,10,0.58,0.022)$pdf #extracting the probability values dAddBin(0:10,10,0.58,0.022)$mean #extracting the mean dAddBin(0:10,10,0.58,0.022)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Additive 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,pAddBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pAddBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pAddBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Beta Distribution bounded between [0,1]
dBETA(p,a,b)dBETA(p,a,b)
p |
vector of probabilities. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
The probability density function and cumulative density function of a unit bounded Beta distribution with random variable P are given by
;
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as is
incomplete beta integrals and is the beta function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dBETA gives a list format consisting
pdf probability density values in vector form.
mean mean of the Beta distribution.
var variance of the Beta distribution.
Johnson NL, Kotz S, Balakrishnan N (1995). Continuous univariate distributions, volume 2, volume 289. John wiley and sons. Trenkler G (1996). “Continuous univariate distributions.” Computational Statistics and Data Analysis, 21(1), 119–119.
or
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Beta.html
#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dBETA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dBETA(seq(0,1,by=0.01),2,3)$pdf #extracting the pdf values dBETA(seq(0,1,by=0.01),2,3)$mean #extracting the mean dBETA(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pBETA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pBETA(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazBETA(1.4,3,2) #acquiring the moment about zero values mazBETA(2,3,2)-mazBETA(1,3,2)^2 #acquiring the variance for a=3,b=2 #only the integer value of moments is taken here because moments cannot be decimal mazBETA(1.9,5.5,6)#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dBETA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dBETA(seq(0,1,by=0.01),2,3)$pdf #extracting the pdf values dBETA(seq(0,1,by=0.01),2,3)$mean #extracting the mean dBETA(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pBETA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pBETA(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazBETA(1.4,3,2) #acquiring the moment about zero values mazBETA(2,3,2)-mazBETA(1,3,2)^2 #acquiring the variance for a=3,b=2 #only the integer value of moments is taken here because moments cannot be decimal mazBETA(1.9,5.5,6)
These functions provide the ability for generating probability function values and cumulative probability function values for the Beta-Binomial Distribution.
dBetaBin(x,n,a,b)dBetaBin(x,n,a,b)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
Mixing Beta distribution with Binomial distribution will create the Beta-Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
Defined as B(a,b) is the beta function.
The output of dBetaBin gives a list format consisting
pdf probability function values in vector form.
mean mean of the Beta-Binomial Distribution.
var variance of the Beta-Binomial Distribution.
over.dis.para over dispersion value of the Beta-Binomial Distribution.
Young-Xu Y, Chan KA (2008). “Pooling overdispersed binomial data to estimate event rate.” BMC medical research methodology, 8, 1–12. Trenkler G (1996). “Continuous univariate distributions.” Computational Statistics and Data Analysis, 21(1), 119–119. HUGHES G, MADDEN L (1993). “Using the beta-binomial distribution to describe aggegated patterns of disease incidence.” Phytopathology, 83(7), 759–763.
#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.2) plot(0,0,main="Beta-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,dBetaBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dBetaBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } dBetaBin(0:10,10,4,.2)$pdf #extracting the pdf values dBetaBin(0:10,10,4,.2)$mean #extracting the mean dBetaBin(0:10,10,4,.2)$var #extracting the variance dBetaBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pBetaBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pBetaBin(0:10,10,a[i],a[i]),col = col[i]) } pBetaBin(0:10,10,4,.2) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.2) plot(0,0,main="Beta-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,dBetaBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dBetaBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } dBetaBin(0:10,10,4,.2)$pdf #extracting the pdf values dBetaBin(0:10,10,4,.2)$mean #extracting the mean dBetaBin(0:10,10,4,.2)$var #extracting the variance dBetaBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pBetaBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pBetaBin(0:10,10,a[i],a[i]),col = col[i]) } pBetaBin(0:10,10,4,.2) #acquiring the cumulative probability values
These functions provide the ability for generating probability function values and cumulative probability function values for the Beta-Correlated Binomial Distribution.
dBetaCorrBin(x,n,cov,a,b)dBetaCorrBin(x,n,cov,a,b)
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. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
The Correlation is in between
where
The mean and the variance are denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
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.
Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506.
#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#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
These functions provide the ability for generating probability function values and cumulative probability function values for the COM Poisson Binomial Distribution.
dCOMPBin(x,n,p,v)dCOMPBin(x,n,p,v)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
p |
single value for probability of success. |
v |
single value for v. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dCOMPBin gives a list format consisting
pdf probability function values in vector form.
mean mean of COM Poisson Binomial Distribution.
var variance of COM Poisson Binomial Distribution.
Borges P, Rodrigues J, Balakrishnan N, Bazan J (2014). “A COM–Poisson type generalization of the binomial distribution and its properties and applications.” Statistics and Probability Letters, 87, 158–166.
#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="COM Poisson 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,dCOMPBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dCOMPBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dCOMPBin(0:10,10,0.58,0.022)$pdf #extracting the pdf values dCOMPBin(0:10,10,0.58,0.022)$mean #extracting the mean dCOMPBin(0:10,10,0.58,0.022)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="COM Poisson 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,pCOMPBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pCOMPBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pCOMPBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="COM Poisson 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,dCOMPBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dCOMPBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dCOMPBin(0:10,10,0.58,0.022)$pdf #extracting the pdf values dCOMPBin(0:10,10,0.58,0.022)$mean #extracting the mean dCOMPBin(0:10,10,0.58,0.022)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="COM Poisson 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,pCOMPBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pCOMPBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pCOMPBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values
These functions provide the ability for generating probability function values and cumulative probability function values for the Correlated Binomial Distribution.
dCorrBin(x,n,p,cov)dCorrBin(x,n,p,cov)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
p |
single value for probability of success. |
cov |
single value for covariance. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
The Correlation is in between
where
The mean and the variance are denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dCorrBin gives a list format consisting
pdf probability function values in vector form.
mean mean of Correlated Binomial Distribution.
var variance of Correlated Binomial Distribution.
corr correlation of Correlated Binomial Distribution.
mincorr minimum correlation value possible.
maxcorr maximum correlation value possible.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506. Morel JG, Neerchal NK (2012). Overdispersion models in SAS. SAS Publishing.
#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="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,dCorrBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dCorrBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dCorrBin(0:10,10,0.58,0.022)$pdf #extracting the pdf values dCorrBin(0:10,10,0.58,0.022)$mean #extracting the mean dCorrBin(0:10,10,0.58,0.022)$var #extracting the variance dCorrBin(0:10,10,0.58,0.022)$corr #extracting the correlation dCorrBin(0:10,10,0.58,0.022)$mincorr #extracting the minimum correlation value dCorrBin(0:10,10,0.58,0.022)$maxcorr #extracting the maximum correlation value #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="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,pCorrBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pCorrBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pCorrBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="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,dCorrBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dCorrBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dCorrBin(0:10,10,0.58,0.022)$pdf #extracting the pdf values dCorrBin(0:10,10,0.58,0.022)$mean #extracting the mean dCorrBin(0:10,10,0.58,0.022)$var #extracting the variance dCorrBin(0:10,10,0.58,0.022)$corr #extracting the correlation dCorrBin(0:10,10,0.58,0.022)$mincorr #extracting the minimum correlation value dCorrBin(0:10,10,0.58,0.022)$maxcorr #extracting the maximum correlation value #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="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,pCorrBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pCorrBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pCorrBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for Gamma Distribution bounded between [0,1].
dGAMMA(p,c,l)dGAMMA(p,c,l)
p |
vector of probabilities. |
c |
single value for shape parameter c. |
l |
single value for shape parameter l. |
The probability density function and cumulative density function of a unit bounded Gamma distribution with random variable P are given by
;
;
The mean the variance are denoted by
The moments about zero is denoted as
Defined as is the gamma function
Defined as is the Lower incomplete gamma function
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dGAMMA gives a list format consisting
pdf probability density values in vector form.
mean mean of the Gamma distribution.
var variance of Gamma distribution.
Olshen AC (1938). “Transformations of the pearson type III distribution.” The Annals of Mathematical Statistics, 9(3), 176–200.
#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dGAMMA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dGAMMA(seq(0,1,by=0.01),5,6)$pdf #extracting the pdf values dGAMMA(seq(0,1,by=0.01),5,6)$mean #extracting the mean dGAMMA(seq(0,1,by=0.01),5,6)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pGAMMA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pGAMMA(seq(0,1,by=0.01),5,6) #acquiring the cumulative probability values mazGAMMA(1.4,5,6) #acquiring the moment about zero values mazGAMMA(2,5,6)-mazGAMMA(1,5,6)^2 #acquiring the variance for a=5,b=6 #only the integer value of moments is taken here because moments cannot be decimal mazGAMMA(1.9,5.5,6)#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dGAMMA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dGAMMA(seq(0,1,by=0.01),5,6)$pdf #extracting the pdf values dGAMMA(seq(0,1,by=0.01),5,6)$mean #extracting the mean dGAMMA(seq(0,1,by=0.01),5,6)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pGAMMA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pGAMMA(seq(0,1,by=0.01),5,6) #acquiring the cumulative probability values mazGAMMA(1.4,5,6) #acquiring the moment about zero values mazGAMMA(2,5,6)-mazGAMMA(1,5,6)^2 #acquiring the variance for a=5,b=6 #only the integer value of moments is taken here because moments cannot be decimal mazGAMMA(1.9,5.5,6)
These functions provide the ability for generating probability function values and cumulative probability function values for the Gamma Binomial Distribution.
dGammaBin(x,n,c,l)dGammaBin(x,n,c,l)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
c |
single value for shape parameter c. |
l |
single value for shape parameter l. |
Mixing Gamma distribution with Binomial distribution will create the the Gamma Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
The output of dGammaBin gives a list format consisting
pdf probability function values in vector form.
mean mean of the Gamma Binomial Distribution.
var variance of the Gamma Binomial Distribution.
over.dis.para over dispersion value of the Gamma Binomial Distribution.
Grassia A (1977). “On a family of distributions with argument between 0 and 1 obtained by transformation of the gamma and derived compound distributions.” Australian Journal of Statistics, 19(2), 108–114.
#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.2) plot(0,0,main="Gamma 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,dGammaBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dGammaBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } dGammaBin(0:10,10,4,.2)$pdf #extracting the pdf values dGammaBin(0:10,10,4,.2)$mean #extracting the mean dGammaBin(0:10,10,4,.2)$var #extracting the variance dGammaBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pGammaBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pGammaBin(0:10,10,a[i],a[i]),col = col[i]) } pGammaBin(0:10,10,4,.2) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.2) plot(0,0,main="Gamma 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,dGammaBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dGammaBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } dGammaBin(0:10,10,4,.2)$pdf #extracting the pdf values dGammaBin(0:10,10,4,.2)$mean #extracting the mean dGammaBin(0:10,10,4,.2)$var #extracting the variance dGammaBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pGammaBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pGammaBin(0:10,10,a[i],a[i]),col = col[i]) } pGammaBin(0:10,10,4,.2) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Generalized Beta Type-1 Distribution bounded between [0,1].
dGBeta1(p,a,b,c)dGBeta1(p,a,b,c)
p |
vector of probabilities. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
c |
single value for shape parameter gamma representing as c. |
The probability density function and cumulative density function of a unit bounded Generalized Beta Type-1 Distribution with random variable P are given by
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as is Beta function.
Defined as is Gaussian Hypergeometric function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dGBeta1 gives a list format consisting
pdf probability density values in vector form.
mean mean of the Generalized Beta Type-1 Distribution.
var variance of the Generalized Beta Type-1 Distribution.
Manoj C, Wijekoon P, Yapa RD (2013). “The McDonald generalized beta-binomial distribution: A new binomial mixture distribution and simulation based comparison with its nested distributions in handling overdispersion.” International journal of statistics and probability, 2(2), 24. Janiffer NM, Islam A, Luke O, others (2014). “Estimating Equations for Estimation of Mcdonald Generalized Beta—Binomial Parameters.” Open Journal of Statistics, 4(09), 702. Roozegar R, Tahmasebi S, Jafari AA (2017). “The McDonald Gompertz distribution: properties and applications.” Communications in Statistics-Simulation and Computation, 46(5), 3341–3355.
#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGBeta1(seq(0,1,by=0.001),a[i],1,2*a[i])$pdf,col = col[i]) } dGBeta1(seq(0,1,by=0.01),2,3,1)$pdf #extracting the pdf values dGBeta1(seq(0,1,by=0.01),2,3,1)$mean #extracting the mean dGBeta1(seq(0,1,by=0.01),2,3,1)$var #extracting the variance pGBeta1(0.04,2,3,4) #acquiring the cdf values for a=2,b=3,c=4 mazGBeta1(1.4,3,2,2) #acquiring the moment about zero values mazGBeta1(2,3,2,2)-mazGBeta1(1,3,2,2)^2 #acquiring the variance for a=3,b=2,c=2 #only the integer value of moments is taken here because moments cannot be decimal mazGBeta1(3.2,3,2,2)#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGBeta1(seq(0,1,by=0.001),a[i],1,2*a[i])$pdf,col = col[i]) } dGBeta1(seq(0,1,by=0.01),2,3,1)$pdf #extracting the pdf values dGBeta1(seq(0,1,by=0.01),2,3,1)$mean #extracting the mean dGBeta1(seq(0,1,by=0.01),2,3,1)$var #extracting the variance pGBeta1(0.04,2,3,4) #acquiring the cdf values for a=2,b=3,c=4 mazGBeta1(1.4,3,2,2) #acquiring the moment about zero values mazGBeta1(2,3,2,2)-mazGBeta1(1,3,2,2)^2 #acquiring the variance for a=3,b=2,c=2 #only the integer value of moments is taken here because moments cannot be decimal mazGBeta1(3.2,3,2,2)
These functions provide the ability for generating probability function values and cumulative probability function values for the Gaussian Hypergeometric Generalized Beta Binomial distribution.
dGHGBB(x,n,a,b,c)dGHGBB(x,n,a,b,c)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
a |
single value for shape parameter alpha value representing a. |
b |
single value for shape parameter beta value representing b. |
c |
single value for shape parameter lambda value representing c. |
Mixing Gaussian Hypergeometric Generalized Beta distribution with Binomial distribution will create the Gaussian Hypergeometric Generalized Beta Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
Defined as is the beta function.
Defined as is the Gaussian Hypergeometric function
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dGHGBB gives a list format consisting
pdf probability function values in vector form.
mean mean of Gaussian Hypergeometric Generalized Beta Binomial Distribution.
var variance of Gaussian Hypergeometric Generalized Beta Binomial Distribution.
over.dis.para over dispersion value of Gaussian Hypergeometric Generalized Beta
Binomial Distribution.
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2007). “A generalization of the beta–binomial distribution.” Journal of the Royal Statistical Society Series C: Applied Statistics, 56(1), 51–61. Pearson JW (2009). Computation of hypergeometric functions. Ph.D. thesis, University of Oxford.
#plotting the random variables and probability values col <- rainbow(6) a <- c(.1,.2,.3,1.5,2.1,3) plot(0,0,main="GHGBB probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,7),ylim = c(0,0.9)) for (i in 1:6) { lines(0:7,dGHGBB(0:7,7,1+a[i],0.3,1+a[i])$pdf,col = col[i],lwd=2.85) points(0:7,dGHGBB(0:7,7,1+a[i],0.3,1+a[i])$pdf,col = col[i],pch=16) } dGHGBB(0:7,7,1.3,0.3,1.3)$pdf #extracting the pdf values dGHGBB(0:7,7,1.3,0.3,1.3)$mean #extracting the mean dGHGBB(0:7,7,1.3,0.3,1.3)$var #extracting the variance dGHGBB(0:7,7,1.3,0.3,1.3)$over.dis.par #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,7),ylim = c(0,1)) for (i in 1:4) { lines(0:7,pGHGBB(0:7,7,1+a[i],0.3,1+a[i]),col = col[i]) points(0:7,pGHGBB(0:7,7,1+a[i],0.3,1+a[i]),col = col[i]) } pGHGBB(0:7,7,1.3,0.3,1.3) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(6) a <- c(.1,.2,.3,1.5,2.1,3) plot(0,0,main="GHGBB probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,7),ylim = c(0,0.9)) for (i in 1:6) { lines(0:7,dGHGBB(0:7,7,1+a[i],0.3,1+a[i])$pdf,col = col[i],lwd=2.85) points(0:7,dGHGBB(0:7,7,1+a[i],0.3,1+a[i])$pdf,col = col[i],pch=16) } dGHGBB(0:7,7,1.3,0.3,1.3)$pdf #extracting the pdf values dGHGBB(0:7,7,1.3,0.3,1.3)$mean #extracting the mean dGHGBB(0:7,7,1.3,0.3,1.3)$var #extracting the variance dGHGBB(0:7,7,1.3,0.3,1.3)$over.dis.par #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,7),ylim = c(0,1)) for (i in 1:4) { lines(0:7,pGHGBB(0:7,7,1+a[i],0.3,1+a[i]),col = col[i]) points(0:7,pGHGBB(0:7,7,1+a[i],0.3,1+a[i]),col = col[i]) } pGHGBB(0:7,7,1.3,0.3,1.3) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Gaussian Hypergeometric Generalized Beta distribution bounded between [0,1].
dGHGBeta(p,n,a,b,c)dGHGBeta(p,n,a,b,c)
p |
vector of probabilities. |
n |
single value for no of binomial trials. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
c |
single value for shape parameter lambda representing as c. |
The probability density function and cumulative density function of a unit bounded Gaussian Hypergeometric Generalized Beta Distribution with random variable P are given by
;
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as as the beta function.
Defined as as the Gaussian Hypergeometric function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dGHGBeta gives a list format consisting
pdf probability density values in vector form.
mean mean of the Gaussian Hypergeometric Generalized Beta Distribution.
var variance of the Gaussian Hypergeometric Generalized Beta Distribution.
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2007). “A generalization of the beta–binomial distribution.” Journal of the Royal Statistical Society Series C: Applied Statistics, 56(1), 51–61. Pearson JW (2009). Computation of hypergeometric functions. Ph.D. thesis, University of Oxford.
#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGHGBeta(seq(0,1,by=0.001),7,1+a[i],0.3,1+a[i])$pdf,col = col[i]) } dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$pdf #extracting the pdf values dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$mean #extracting the mean dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(6) a <- c(.1,.2,.3,1.5,2.1,3) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:6) { lines(seq(0.01,1,by=0.001),pGHGBeta(seq(0.01,1,by=0.001),7,1+a[i],0.3,1+a[i]),col=col[i]) } pGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659) #acquiring the cumulative probability values mazGHGBeta(1.4,7,1.6312,0.3913,0.6659) #acquiring the moment about zero values #acquiring the variance for a=1.6312,b=0.3913,c=0.6659 mazGHGBeta(2,7,1.6312,0.3913,0.6659)-mazGHGBeta(1,7,1.6312,0.3913,0.6659)^2 #only the integer value of moments is taken here because moments cannot be decimal mazGHGBeta(1.9,15,5,6,1)#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGHGBeta(seq(0,1,by=0.001),7,1+a[i],0.3,1+a[i])$pdf,col = col[i]) } dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$pdf #extracting the pdf values dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$mean #extracting the mean dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(6) a <- c(.1,.2,.3,1.5,2.1,3) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:6) { lines(seq(0.01,1,by=0.001),pGHGBeta(seq(0.01,1,by=0.001),7,1+a[i],0.3,1+a[i]),col=col[i]) } pGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659) #acquiring the cumulative probability values mazGHGBeta(1.4,7,1.6312,0.3913,0.6659) #acquiring the moment about zero values #acquiring the variance for a=1.6312,b=0.3913,c=0.6659 mazGHGBeta(2,7,1.6312,0.3913,0.6659)-mazGHGBeta(1,7,1.6312,0.3913,0.6659)^2 #only the integer value of moments is taken here because moments cannot be decimal mazGHGBeta(1.9,15,5,6,1)
These functions provide the ability for generating probability function values and cumulative probability function values for the Grassia-II-Binomial Distribution.
dGrassiaIIBin(x,n,a,b)dGrassiaIIBin(x,n,a,b)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
a |
single value for shape parameter a. |
b |
single value for shape parameter b. |
Mixing Gamma distribution with Binomial distribution will create the the Grassia-II-Binomial distribution, only when (1-p)=e^(-lambda) of the Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
The output of dGrassiaIIBin gives a list format consisting
pdf probability function values in vector form.
mean mean of the Grassia II Binomial Distribution.
var variance of the Grassia II Binomial Distribution.
over.dis.para over dispersion value of the Grassia II Binomial Distribution.
Grassia A (1977). “On a family of distributions with argument between 0 and 1 obtained by transformation of the gamma and derived compound distributions.” Australian Journal of Statistics, 19(2), 108–114.
#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.2) plot(0,0,main="Grassia II 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,dGrassiaIIBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dGrassiaIIBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } dGrassiaIIBin(0:10,10,4,.2)$pdf #extracting the pdf values dGrassiaIIBin(0:10,10,4,.2)$mean #extracting the mean dGrassiaIIBin(0:10,10,4,.2)$var #extracting the variance dGrassiaIIBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <-c (1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pGrassiaIIBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pGrassiaIIBin(0:10,10,a[i],a[i]),col = col[i]) } pGrassiaIIBin(0:10,10,4,.2) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.2) plot(0,0,main="Grassia II 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,dGrassiaIIBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dGrassiaIIBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } dGrassiaIIBin(0:10,10,4,.2)$pdf #extracting the pdf values dGrassiaIIBin(0:10,10,4,.2)$mean #extracting the mean dGrassiaIIBin(0:10,10,4,.2)$var #extracting the variance dGrassiaIIBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <-c (1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pGrassiaIIBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pGrassiaIIBin(0:10,10,a[i],a[i]),col = col[i]) } pGrassiaIIBin(0:10,10,4,.2) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Kumaraswamy Distribution bounded between [0,1].
dKUM(p,a,b)dKUM(p,a,b)
p |
vector of probabilities. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
The probability density function and cumulative density function of a unit bounded Kumaraswamy Distribution with random variable P are given by
;
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as is the beta function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dKUM gives a list format consisting
pdf probability density values in vector form.
mean mean of the Kumaraswamy distribution.
var variance of the Kumaraswamy distribution.
Kumaraswamy P (1980). “A generalized probability density function for double-bounded random processes.” Journal of hydrology, 46(1-2), 79–88. Jones MC (2009). “Kumaraswamy’s distribution: A beta-type distribution with some tractability advantages.” Statistical methodology, 6(1), 70–81.
#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,6)) for (i in 1:4) { lines(seq(0,1,by=0.01),dKUM(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dKUM(seq(0,1,by=0.01),2,3)$pdf #extracting the probability values dKUM(seq(0,1,by=0.01),2,3)$mean #extracting the mean dKUM(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pKUM(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pKUM(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazKUM(1.4,3,2) #acquiring the moment about zero values mazKUM(2,2,3)-mazKUM(1,2,3)^2 #acquiring the variance for a=2,b=3 #only the integer value of moments is taken here because moments cannot be decimal mazKUM(1.9,5.5,6)#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,6)) for (i in 1:4) { lines(seq(0,1,by=0.01),dKUM(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dKUM(seq(0,1,by=0.01),2,3)$pdf #extracting the probability values dKUM(seq(0,1,by=0.01),2,3)$mean #extracting the mean dKUM(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pKUM(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pKUM(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazKUM(1.4,3,2) #acquiring the moment about zero values mazKUM(2,2,3)-mazKUM(1,2,3)^2 #acquiring the variance for a=2,b=3 #only the integer value of moments is taken here because moments cannot be decimal mazKUM(1.9,5.5,6)
These functions provide the ability for generating probability function values and cumulative probability function values for the Kumaraswamy Binomial Distribution.
dKumBin(x,n,a,b,it=25000)dKumBin(x,n,a,b,it=25000)
x |
vector of binomial random variables |
n |
single value for no of binomial trial |
a |
single value for shape parameter alpha representing a |
b |
single value for shape parameter beta representing b |
it |
number of iterations to converge as a proper probability function replacing infinity |
Mixing Kumaraswamy distribution with Binomial distribution will create the Kumaraswamy Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
Defined as is the beta function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dKumBin gives a list format consisting
pdf probability function values in vector form.
mean mean of the Kumaraswamy Binomial Distribution.
var variance of the Kumaraswamy Binomial Distribution.
over.dis.para over dispersion value of the Kumaraswamy Distribution.
Xiaohu L, Yanyan H, Xueyan Z (2011). “The Kumaraswamy binomial distribution.” Chinese Journal of Applied Probability and Statistics, 27(5), 511–521.
## Not run: #plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,.85) plot(0,0,main="Kumaraswamy 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,dKumBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dKumBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } ## End(Not run) dKumBin(0:10,10,4,2)$pdf #extracting the pdf values dKumBin(0:10,10,4,2)$mean #extracting the mean dKumBin(0:10,10,4,2)$var #extracting the variance dKumBin(0:10,10,4,2)$over.dis.para #extracting the over dispersion value ## Not run: #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(1,2,5,10,.85) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:5) { lines(0:10,pKumBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pKumBin(0:10,10,a[i],a[i]),col = col[i]) } ## End(Not run) pKumBin(0:10,10,4,2) #acquiring the cumulative probability values## Not run: #plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,.85) plot(0,0,main="Kumaraswamy 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,dKumBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dKumBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } ## End(Not run) dKumBin(0:10,10,4,2)$pdf #extracting the pdf values dKumBin(0:10,10,4,2)$mean #extracting the mean dKumBin(0:10,10,4,2)$var #extracting the variance dKumBin(0:10,10,4,2)$over.dis.para #extracting the over dispersion value ## Not run: #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(1,2,5,10,.85) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:5) { lines(0:10,pKumBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pKumBin(0:10,10,a[i],a[i]),col = col[i]) } ## End(Not run) pKumBin(0:10,10,4,2) #acquiring the cumulative probability values
These functions provide the ability for generating probability function values and cumulative probability function values for the Lovinson Multiplicative Binomial Distribution.
dLMBin(x,n,p,phi)dLMBin(x,n,p,phi)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
p |
single value for probability of success. |
phi |
single value for phi. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
here is
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dLMBin gives a list format consisting
pdf probability function values in vector form.
mean mean of Lovinson Multiplicative Binomial Distribution.
var variance of Lovinson Multiplicative Binomial Distribution.
Elamir EA (2013). “Multiplicative-Binomial Distribution: Some Results on Characterization, Inference and Random Data Generation.” Journal of Statistical Theory and Applications, 12(1), 92–105.
#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Lovinson Multiplicative 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,dLMBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dLMBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],pch=16) } dLMBin(0:10,10,.58,10.022)$pdf #extracting the pdf values dLMBin(0:10,10,.58,10.022)$mean #extracting the mean dLMBin(0:10,10,.58,10.022)$var #extracting the variance #plotting random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Lovinson Multiplicative 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,pLMBin(0:10,10,a[i],1+b[i]),col = col[i],lwd=2.85) points(0:10,pLMBin(0:10,10,a[i],1+b[i]),col = col[i],pch=16) } pLMBin(0:10,10,.58,10.022) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Lovinson Multiplicative 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,dLMBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dLMBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],pch=16) } dLMBin(0:10,10,.58,10.022)$pdf #extracting the pdf values dLMBin(0:10,10,.58,10.022)$mean #extracting the mean dLMBin(0:10,10,.58,10.022)$var #extracting the variance #plotting random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Lovinson Multiplicative 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,pLMBin(0:10,10,a[i],1+b[i]),col = col[i],lwd=2.85) points(0:10,pLMBin(0:10,10,a[i],1+b[i]),col = col[i],pch=16) } pLMBin(0:10,10,.58,10.022) #acquiring the cumulative probability values
These functions provide the ability for generating probability function values and cumulative probability function values for the McDonald Generalized Beta Binomial Distribution.
dMcGBB(x,n,a,b,c)dMcGBB(x,n,a,b,c)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
c |
single value for shape parameter gamma representing as c. |
Mixing Generalized Beta Type-1 Distribution with Binomial distribution the probability function value and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
The output of dMcGBB gives a list format consisting
pdf probability function values in vector form.
mean mean of McDonald Generalized Beta Binomial Distribution.
var variance of McDonald Generalized Beta Binomial Distribution.
over.dis.para over dispersion value of McDonald Generalized Beta Binomial Distribution.
Manoj C, Wijekoon P, Yapa RD (2013). “The McDonald generalized beta-binomial distribution: A new binomial mixture distribution and simulation based comparison with its nested distributions in handling overdispersion.” International journal of statistics and probability, 2(2), 24. Janiffer NM, Islam A, Luke O, others (2014). “Estimating Equations for Estimation of Mcdonald Generalized Beta—Binomial Parameters.” Open Journal of Statistics, 4(09), 702. Roozegar R, Tahmasebi S, Jafari AA (2017). “The McDonald Gompertz distribution: properties and applications.” Communications in Statistics-Simulation and Computation, 46(5), 3341–3355.
#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.6) plot(0,0,main="Mcdonald generalized beta-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,dMcGBB(0:10,10,a[i],2.5,a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dMcGBB(0:10,10,a[i],2.5,a[i])$pdf,col = col[i],pch=16) } dMcGBB(0:10,10,4,2,1)$pdf #extracting the pdf values dMcGBB(0:10,10,4,2,1)$mean #extracting the mean dMcGBB(0:10,10,4,2,1)$var #extracting the variance dMcGBB(0:10,10,4,2,1)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pMcGBB(0:10,10,a[i],a[i],2),col = col[i]) points(0:10,pMcGBB(0:10,10,a[i],a[i],2),col = col[i]) } pMcGBB(0:10,10,4,2,1) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.6) plot(0,0,main="Mcdonald generalized beta-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,dMcGBB(0:10,10,a[i],2.5,a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dMcGBB(0:10,10,a[i],2.5,a[i])$pdf,col = col[i],pch=16) } dMcGBB(0:10,10,4,2,1)$pdf #extracting the pdf values dMcGBB(0:10,10,4,2,1)$mean #extracting the mean dMcGBB(0:10,10,4,2,1)$var #extracting the variance dMcGBB(0:10,10,4,2,1)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pMcGBB(0:10,10,a[i],a[i],2),col = col[i]) points(0:10,pMcGBB(0:10,10,a[i],a[i],2),col = col[i]) } pMcGBB(0:10,10,4,2,1) #acquiring the cumulative probability values
These functions provide the ability for generating probability function values and cumulative probability function values for the Multiplicative Binomial Distribution.
dMultiBin(x,n,p,theta)dMultiBin(x,n,p,theta)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
p |
single value for probability of success. |
theta |
single value for theta. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
here is
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dMultiBin gives a list format consisting
pdf probability function values in vector form.
mean mean of Multiplicative Binomial Distribution.
var variance of Multiplicative Binomial Distribution.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506.
#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Multiplicative 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,dMultiBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dMultiBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],pch=16) } dMultiBin(0:10,10,.58,10.022)$pdf #extracting the pdf values dMultiBin(0:10,10,.58,10.022)$mean #extracting the mean dMultiBin(0:10,10,.58,10.022)$var #extracting the variance #plotting random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Multiplicative 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,pMultiBin(0:10,10,a[i],1+b[i]),col = col[i],lwd=2.85) points(0:10,pMultiBin(0:10,10,a[i],1+b[i]),col = col[i],pch=16) } pMultiBin(0:10,10,.58,10.022) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Multiplicative 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,dMultiBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dMultiBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],pch=16) } dMultiBin(0:10,10,.58,10.022)$pdf #extracting the pdf values dMultiBin(0:10,10,.58,10.022)$mean #extracting the mean dMultiBin(0:10,10,.58,10.022)$var #extracting the variance #plotting random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Multiplicative 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,pMultiBin(0:10,10,a[i],1+b[i]),col = col[i],lwd=2.85) points(0:10,pMultiBin(0:10,10,a[i],1+b[i]),col = col[i],pch=16) } pMultiBin(0:10,10,.58,10.022) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moments about zero values for the Triangular Distribution bounded between [0,1].
dTRI(p,mode)dTRI(p,mode)
p |
vector of probabilities. |
mode |
single value for mode. |
Setting and in the Triangular distribution
a unit bounded Triangular distribution can be obtained. The probability density function
and cumulative density function of a unit bounded Triangular distribution with random
variable P are given by
;
;
;
;
The mean and the variance are denoted by
Moments about zero is denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dTRI gives a list format consisting
pdf probability density values in vector form.
mean mean of the unit bounded Triangular distribution.
variance variance of the unit bounded Triangular distribution
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Johnson NL, Kotz S, Balakrishnan N (1995). Continuous univariate distributions, volume 2, volume 289. John wiley and sons. Karlis D, Xekalaki E (2008). The polygonal distribution. Springer. Okagbue HI, Edeki SO, Opanuga AA, Oguntunde PE, Adeosun ME (2014). “Using the Average of the Extreme Values of a Triangular Distribution for a Transformation, and Its Approximant via the Continuous Uniform Distribution.” British Journal of Mathematics and Computer Science, 4(24), 3497.
#plotting the random variables and probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Probability density graph",xlab="Random variable", ylab="Probability density values",xlim = c(0,1),ylim = c(0,3)) for (i in 1:4) { lines(seq(0,1,by=0.01),dTRI(seq(0,1,by=0.01),x[i])$pdf,col = col[i]) } dTRI(seq(0,1,by=0.05),0.3)$pdf #extracting the pdf values dTRI(seq(0,1,by=0.01),0.3)$mean #extracting the mean dTRI(seq(0,1,by=0.01),0.3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Cumulative density graph",xlab="Random variable", ylab="Cumulative density values",xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pTRI(seq(0,1,by=0.01),x[i]),col = col[i]) } pTRI(seq(0,1,by=0.05),0.3) #acquiring the cumulative probability values mazTRI(1.4,.3) #acquiring the moment about zero values mazTRI(2,.3)-mazTRI(1,.3)^2 #variance for when is mode 0.3 #only the integer value of moments is taken here because moments cannot be decimal mazTRI(1.9,0.5)#plotting the random variables and probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Probability density graph",xlab="Random variable", ylab="Probability density values",xlim = c(0,1),ylim = c(0,3)) for (i in 1:4) { lines(seq(0,1,by=0.01),dTRI(seq(0,1,by=0.01),x[i])$pdf,col = col[i]) } dTRI(seq(0,1,by=0.05),0.3)$pdf #extracting the pdf values dTRI(seq(0,1,by=0.01),0.3)$mean #extracting the mean dTRI(seq(0,1,by=0.01),0.3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Cumulative density graph",xlab="Random variable", ylab="Cumulative density values",xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pTRI(seq(0,1,by=0.01),x[i]),col = col[i]) } pTRI(seq(0,1,by=0.05),0.3) #acquiring the cumulative probability values mazTRI(1.4,.3) #acquiring the moment about zero values mazTRI(2,.3)-mazTRI(1,.3)^2 #variance for when is mode 0.3 #only the integer value of moments is taken here because moments cannot be decimal mazTRI(1.9,0.5)
These functions provide the ability for generating probability function values and cumulative probability function values for the Triangular Binomial distribution.
dTriBin(x,n,mode)dTriBin(x,n,mode)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
mode |
single value for mode. |
Mixing unit bounded Triangular distribution with Binomial distribution will create Triangular Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
Defined as is incomplete beta integrals
and is the beta function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dTriBin gives a list format consisting
pdf probability function values in vector form.
mean mean of the Triangular Binomial Distribution.
var variance of the Triangular Binomial Distribution.
over.dis.para over dispersion value of the Triangular Binomial Distribution.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Karlis D, Xekalaki E (2008). The polygonal distribution. Springer. Okagbue HI, Edeki SO, Opanuga AA, Oguntunde PE, Adeosun ME (2014). “Using the Average of the Extreme Values of a Triangular Distribution for a Transformation, and Its Approximant via the Continuous Uniform Distribution.” British Journal of Mathematics and Computer Science, 4(24), 3497.
#plotting the random variables and probability values col <- rainbow(7) x <- seq(0.1,0.7,by=0.1) plot(0,0,main="Triangular binomial probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,10),ylim = c(0,.3)) for (i in 1:7) { lines(0:10,dTriBin(0:10,10,x[i])$pdf,col = col[i],lwd=2.85) points(0:10,dTriBin(0:10,10,x[i])$pdf,col = col[i],pch=16) } dTriBin(0:10,10,.4)$pdf #extracting the pdf values dTriBin(0:10,10,.4)$mean #extracting the mean dTriBin(0:10,10,.4)$var #extracting the variance dTriBin(0:10,10,.4)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(7) x <- seq(0.1,0.7,by=0.1) plot(0,0,main="Triangular binomial probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:7) { lines(0:10,pTriBin(0:10,10,x[i]),col = col[i],lwd=2.85) points(0:10,pTriBin(0:10,10,x[i]),col = col[i],pch=16) } pTriBin(0:10,10,.4) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(7) x <- seq(0.1,0.7,by=0.1) plot(0,0,main="Triangular binomial probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,10),ylim = c(0,.3)) for (i in 1:7) { lines(0:10,dTriBin(0:10,10,x[i])$pdf,col = col[i],lwd=2.85) points(0:10,dTriBin(0:10,10,x[i])$pdf,col = col[i],pch=16) } dTriBin(0:10,10,.4)$pdf #extracting the pdf values dTriBin(0:10,10,.4)$mean #extracting the mean dTriBin(0:10,10,.4)$var #extracting the variance dTriBin(0:10,10,.4)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(7) x <- seq(0.1,0.7,by=0.1) plot(0,0,main="Triangular binomial probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:7) { lines(0:10,pTriBin(0:10,10,x[i]),col = col[i],lwd=2.85) points(0:10,pTriBin(0:10,10,x[i]),col = col[i],pch=16) } pTriBin(0:10,10,.4) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moments about zero values for the Uniform Distribution bounded between [0,1].
dUNI(p)dUNI(p)
p |
vector of probabilities. |
Setting and in the Uniform Distribution
a unit bounded Uniform Distribution can be obtained. The probability density function
and cumulative density function of a unit bounded Uniform Distribution with random
variable P are given by
The mean and the variance are denoted as
Moments about zero is denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dUNI gives a list format consisting
pdf probability density values in vector form.
mean mean of unit bounded uniform distribution.
var variance of unit bounded uniform distribution.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Johnson NL, Kotz S, Balakrishnan N (1995). Continuous univariate distributions, volume 2, volume 289. John wiley and sons.
or
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Uniform.html
#plotting the random variables and probability values plot(seq(0,1,by=0.01),dUNI(seq(0,1,by=0.01))$pdf,type = "l",main="Probability density graph", xlab="Random variable",ylab="Probability density values") dUNI(seq(0,1,by=0.05))$pdf #extract the pdf values dUNI(seq(0,1,by=0.01))$mean #extract the mean dUNI(seq(0,1,by=0.01))$var #extract the variance #plotting the random variables and cumulative probability values plot(seq(0,1,by=0.01),pUNI(seq(0,1,by=0.01)),type = "l",main="Cumulative density graph", xlab="Random variable",ylab="Cumulative density values") pUNI(seq(0,1,by=0.05)) #acquiring the cumulative probability values mazUNI(c(1,2,3)) #acquiring the moment about zero values #only the integer value of moments is taken here because moments cannot be decimal mazUNI(1.9)#plotting the random variables and probability values plot(seq(0,1,by=0.01),dUNI(seq(0,1,by=0.01))$pdf,type = "l",main="Probability density graph", xlab="Random variable",ylab="Probability density values") dUNI(seq(0,1,by=0.05))$pdf #extract the pdf values dUNI(seq(0,1,by=0.01))$mean #extract the mean dUNI(seq(0,1,by=0.01))$var #extract the variance #plotting the random variables and cumulative probability values plot(seq(0,1,by=0.01),pUNI(seq(0,1,by=0.01)),type = "l",main="Cumulative density graph", xlab="Random variable",ylab="Cumulative density values") pUNI(seq(0,1,by=0.05)) #acquiring the cumulative probability values mazUNI(c(1,2,3)) #acquiring the moment about zero values #only the integer value of moments is taken here because moments cannot be decimal mazUNI(1.9)
These functions provide the ability for generating probability function values and cumulative probability function values for the Uniform Binomial Distribution.
dUniBin(x,n)dUniBin(x,n)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
Mixing unit bounded uniform distribution with binomial distribution will create the Uniform Binomial Distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values
The mean, variance and over dispersion are denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of dUniBin gives a list format consisting
pdf probability function values in vector form.
mean mean of the Uniform Binomial Distribution.
var variance of the Uniform Binomial Distribution.
ove.dis.para over dispersion value of Uniform Binomial Distribution.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Okagbue HI, Edeki SO, Opanuga AA, Oguntunde PE, Adeosun ME (2014). “Using the Average of the Extreme Values of a Triangular Distribution for a Transformation, and Its Approximant via the Continuous Uniform Distribution.” British Journal of Mathematics and Computer Science, 4(24), 3497.
#plotting the binomial random variables and probability values plot(0:10,dUniBin(0:10,10)$pdf,type="l",main="Uniform binomial probability function graph", xlab=" Binomial random variable",ylab="Probability function values") points(0:10,dUniBin(0:10,10)$pdf) dUniBin(0:300,300)$pdf #extracting the pdf values dUniBin(0:10,10)$mean #extracting the mean dUniBin(0:10,10)$var #extracting the variance dUniBin(0:10,10)$over.dis.para #extracting the over dispersion #plotting the binomial random variables and cumulative probability values plot(0:10,pUniBin(0:10,10),type="l",main="Cumulative probability function graph", xlab=" Binomial random variable",ylab="Cumulative probability function values") points(0:10,pUniBin(0:10,10)) pUniBin(0:15,15) #acquiring the cumulative probability values#plotting the binomial random variables and probability values plot(0:10,dUniBin(0:10,10)$pdf,type="l",main="Uniform binomial probability function graph", xlab=" Binomial random variable",ylab="Probability function values") points(0:10,dUniBin(0:10,10)$pdf) dUniBin(0:300,300)$pdf #extracting the pdf values dUniBin(0:10,10)$mean #extracting the mean dUniBin(0:10,10)$var #extracting the variance dUniBin(0:10,10)$over.dis.para #extracting the over dispersion #plotting the binomial random variables and cumulative probability values plot(0:10,pUniBin(0:10,10),type="l",main="Cumulative probability function graph", xlab=" Binomial random variable",ylab="Cumulative probability function values") points(0:10,pUniBin(0:10,10)) pUniBin(0:15,15) #acquiring the cumulative probability values
In this investigation, families of the same size, two parents and three children, living in different circumstances of domestic overcrowding were visited at fortnightly intervals. The date of onset and the clinical nature of upper respiratory infectious experienced by each member of the family were charted on a time scale marked off in days. Family epidemics of acute coryza-or common colds-were thus available for analysis.
Epidemic_ColdEpidemic_Cold
A data frame with 6 columns and 5 rows
CasesNo of Further Cases
FamiliesNo of Families
FatherFather with Status of Introducing Cases
MotherMother with Status of Introducing Cases
SChildSchool Child with Status of Introducing Cases
PSChildPre-School Child with Status of Introducing Cases
By inspection of the epidemic time charts, it was possible to identify new or primary introductions of illness into the household by the onset of a cold after a lapse of 10 days since the last such case in the same home. Two such cases occurring on the same or succeeding days were classified as multiple primaries. Thereafter, the links in the epidemic chain of spread were defined by an interval of one day or more between successive cases in the same family. These family epidemics could then be described thus 1-2-1, 1-1-1-0, 2-1-0, etc. It must be emphasized that although this method of classification is somewhat arbitrary, it was completed before the corresponding theoretical distributions were worked out and the interval chosen agrees with the distribution of presumptive incubation periods of the common cold seen in field surveys (e.g. Badger, Dingle, Feller, Hodges, Jordan, and Rammelkamp, 1953).
Extracted from
Heasman, M. A. and Reid, D. D. (1961). "Theory and observation in family epidemics of the common cold." Br. J. pleu. SOC. Med., 15, 12-16.
Epidemic_Cold$Cases sum(Epidemic_Cold$SChild)Epidemic_Cold$Cases sum(Epidemic_Cold$SChild)
The functions will estimate the shape parameters using the maximum log likelihood method and moment generating function method for the Beta-Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMGFBetaBin(x,freq)EstMGFBetaBin(x,freq)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of EstMGFBetaBin will produce the class mgf format consisting
a shape parameter of beta distribution representing for alpha
b shape parameter of beta distribution representing for beta
min Negative loglikelihood value
AIC AIC value
call the inputs for the function
Methods print, summary, coef and AIC can be used to extract
specific outputs.
Young-Xu Y, Chan KA (2008). “Pooling overdispersed binomial data to estimate event rate.” BMC medical research methodology, 8, 1–12. Trenkler G (1996). “Continuous univariate distributions.” Computational Statistics and Data Analysis, 21(1), 119–119. HUGHES G, MADDEN L (1993). “Using the beta-binomial distribution to describe aggegated patterns of disease incidence.” Phytopathology, 83(7), 759–763.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it estimate <- EstMLEBetaBin(No.D.D,Obs.fre.1,a=0.1,b=0.1) bbmle::coef(estimate) #extracting the parameters #estimating the parameters using moment generating function methods results <- EstMGFBetaBin(No.D.D,Obs.fre.1) # extract the estimated parameters and summary coef(results) summary(results) AIC(results) #show the AIC valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it estimate <- EstMLEBetaBin(No.D.D,Obs.fre.1,a=0.1,b=0.1) bbmle::coef(estimate) #extracting the parameters #estimating the parameters using moment generating function methods results <- EstMGFBetaBin(No.D.D,Obs.fre.1) # extract the estimated parameters and summary coef(results) summary(results) AIC(results) #show the AIC value
The function will estimate the probability of success and alpha using the maximum log likelihood method for the Additive Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMLEAddBin(x,freq)EstMLEAddBin(x,freq)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of EstMLEAddBin will produce the class mlAB and ml with a list consisting
min Negative Log Likelihood value.
p estimated probability of success.
alpha estimated alpha parameter.
AIC AIC value.
call the inputs for the function.
Methods print, summary, coef and AIC can be used to extract specific outputs.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506. Morel JG, Neerchal NK (2012). Overdispersion models in SAS. SAS Publishing.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the probability value and alpha value results <- EstMLEAddBin(No.D.D,Obs.fre.1) #printing the summary of results summary(results) #extracting the estimated parameters coef(results) ## End(Not run)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the probability value and alpha value results <- EstMLEAddBin(No.D.D,Obs.fre.1) #printing the summary of results summary(results) #extracting the estimated parameters coef(results) ## End(Not run)
The functions will estimate the shape parameters using the maximum log likelihood method and moment generating function method for the Beta-Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMLEBetaBin(x,freq,a,b,...)EstMLEBetaBin(x,freq,a,b,...)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
... |
mle2 function inputs except data and estimating parameter. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
EstMLEBetaBin here is used as a wrapper for the mle2 function of bbmle package
therefore output is of class of mle2.
Young-Xu Y, Chan KA (2008). “Pooling overdispersed binomial data to estimate event rate.” BMC medical research methodology, 8, 1–12. Trenkler G (1996). “Continuous univariate distributions.” Computational Statistics and Data Analysis, 21(1), 119–119. HUGHES G, MADDEN L (1993). “Using the beta-binomial distribution to describe aggegated patterns of disease incidence.” Phytopathology, 83(7), 759–763.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it estimate <- EstMLEBetaBin(No.D.D,Obs.fre.1,a=0.1,b=0.1) bbmle::coef(estimate) #extracting the parameters #estimating the parameters using moment generating function methods EstMGFBetaBin(No.D.D,Obs.fre.1)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it estimate <- EstMLEBetaBin(No.D.D,Obs.fre.1,a=0.1,b=0.1) bbmle::coef(estimate) #extracting the parameters #estimating the parameters using moment generating function methods EstMGFBetaBin(No.D.D,Obs.fre.1)
The function will estimate the covariance, alpha and beta parameter values using the maximum log likelihood method for the Beta-Correlated Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMLEBetaCorrBin(x,freq,cov,a,b,...)EstMLEBetaCorrBin(x,freq,cov,a,b,...)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
cov |
single value for covariance. |
a |
single value for alpha parameter. |
b |
single value for beta parameter. |
... |
mle2 function inputs except data and estimating parameter. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
EstMLEBetaCorrBin here is used as a wrapper for the mle2 function of bbmle package
therefore output is of class of mle2.
Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEBetaCorrBin(x=No.D.D,freq=Obs.fre.1,cov=0.0050,a=10,b=10) bbmle::coef(parameters) #extracting the parametersNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEBetaCorrBin(x=No.D.D,freq=Obs.fre.1,cov=0.0050,a=10,b=10) bbmle::coef(parameters) #extracting the parameters
The function will estimate the probability of success and v parameter using the maximum log likelihood method for the COM Poisson Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMLECOMPBin(x,freq,p,v,...)EstMLECOMPBin(x,freq,p,v,...)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
p |
single value for probability of success. |
v |
single value for v. |
... |
mle2 function inputs except data and estimating parameter. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
EstMLECOMPBin here is used as a wrapper for the mle2 function of bbmle package
therefore output is of class of mle2.
Borges P, Rodrigues J, Balakrishnan N, Bazan J (2014). “A COM–Poisson type generalization of the binomial distribution and its properties and applications.” Statistics and Probability Letters, 87, 158–166.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLECOMPBin(x=No.D.D,freq=Obs.fre.1,p=0.5,v=0.1) bbmle::coef(parameters) #extracting the parametersNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLECOMPBin(x=No.D.D,freq=Obs.fre.1,p=0.5,v=0.1) bbmle::coef(parameters) #extracting the parameters
The function will estimate the probability of success and correlation using the maximum log likelihood method for the Correlated Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMLECorrBin(x,freq,p,cov,...)EstMLECorrBin(x,freq,p,cov,...)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
p |
single value for probability of success. |
cov |
single value for covariance. |
... |
mle2 function inputs except data and estimating parameter. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
EstMLECorrBin here is used as a wrapper for the mle2 function of bbmle package
therefore output is of class of mle2.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506. Morel JG, Neerchal NK (2012). Overdispersion models in SAS. SAS Publishing.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLECorrBin(x=No.D.D,freq=Obs.fre.1,p=0.5,cov=0.0050) bbmle::coef(parameters) #extracting the parametersNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLECorrBin(x=No.D.D,freq=Obs.fre.1,p=0.5,cov=0.0050) bbmle::coef(parameters) #extracting the parameters
The function will estimate the shape parameters using the maximum log likelihood method for the Gamma Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMLEGammaBin(x,freq,c,l,...)EstMLEGammaBin(x,freq,c,l,...)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
c |
single value for shape parameter c. |
l |
single value for shape parameter l. |
... |
mle2 function inputs except data and estimating parameter. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
EstMLEGammaBin here is used as a wrapper for the mle2 function of bbmle package
therefore output is of class of mle2.
Grassia A (1977). “On a family of distributions with argument between 0 and 1 obtained by transformation of the gamma and derived compound distributions.” Australian Journal of Statistics, 19(2), 108–114.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGammaBin(x=No.D.D,freq=Obs.fre.1,c=0.1,l=0.1) bbmle::coef(parameters) #extracting the parametersNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGammaBin(x=No.D.D,freq=Obs.fre.1,c=0.1,l=0.1) bbmle::coef(parameters) #extracting the parameters
The function will estimate the shape parameters using the maximum log likelihood method for the Gaussian Hypergeometric Generalized Beta Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMLEGHGBB(x,freq,a,b,c,...)EstMLEGHGBB(x,freq,a,b,c,...)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing a. |
b |
single value for shape parameter beta representing b. |
c |
single value for shape parameter lambda representing c. |
... |
mle2 function inputs except data and estimating parameter. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
EstMLEGHGBB here is used as a wrapper for the mle2 function of
bbmle package therefore output is of class of mle2.
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2007). “A generalization of the beta–binomial distribution.” Journal of the Royal Statistical Society Series C: Applied Statistics, 56(1), 51–61. Pearson JW (2009). Computation of hypergeometric functions. Ph.D. thesis, University of Oxford.
—————-
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGHGBB(No.D.D,Obs.fre.1,a=0.1,b=0.2,c=0.5) bbmle::coef(parameters) #extracting the parametersNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGHGBB(No.D.D,Obs.fre.1,a=0.1,b=0.2,c=0.5) bbmle::coef(parameters) #extracting the parameters
The function will estimate the shape parameters using the maximum log likelihood method for the Grassia II Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMLEGrassiaIIBin(x,freq,a,b,...)EstMLEGrassiaIIBin(x,freq,a,b,...)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
a |
single value for shape parameter a. |
b |
single value for shape parameter b. |
... |
mle2 function inputs except data and estimating parameter. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
EstMLEGrassiaIIBin here is used as a wrapper for the mle2 function of bbmle package
therefore output is of class of mle2.
Grassia A (1977). “On a family of distributions with argument between 0 and 1 obtained by transformation of the gamma and derived compound distributions.” Australian Journal of Statistics, 19(2), 108–114.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGrassiaIIBin(x=No.D.D,freq=Obs.fre.1,a=0.1,b=0.1) bbmle::coef(parameters) #extracting the parametersNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGrassiaIIBin(x=No.D.D,freq=Obs.fre.1,a=0.1,b=0.1) bbmle::coef(parameters) #extracting the parameters
The function will estimate the shape parameters using the maximum log likelihood method for the Kumaraswamy Binomial distribution when the binomial random variables and corresponding frequencies are given
EstMLEKumBin(x,freq,a,b,it,...)EstMLEKumBin(x,freq,a,b,it,...)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
it |
number of iterations to converge as a proper probability function replacing infinity. |
... |
mle2 function inputs except data and estimating parameter. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
EstMLEKumBin here is used as a wrapper for the mle2 function of
bbmle package therefore output is of class of mle2.
Xiaohu L, Yanyan H, Xueyan Z (2011). “The Kumaraswamy binomial distribution.” Chinese Journal of Applied Probability and Statistics, 27(5), 511–521.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the parameters using maximum log likelihood value and assigning it parameters1 <- EstMLEKumBin(x=No.D.D,freq=Obs.fre.1,a=10.1,b=1.1,it=10000) bbmle::coef(parameters1) #extracting the parameters ## End(Not run)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the parameters using maximum log likelihood value and assigning it parameters1 <- EstMLEKumBin(x=No.D.D,freq=Obs.fre.1,a=10.1,b=1.1,it=10000) bbmle::coef(parameters1) #extracting the parameters ## End(Not run)
The function will estimate the probability of success and phi parameter using the maximum log likelihood method for the Lovinson Multiplicative Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMLELMBin(x,freq,p,phi,...)EstMLELMBin(x,freq,p,phi,...)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
p |
single value for probability of success. |
phi |
single value for phi parameter. |
... |
mle2 function inputs except data and estimating parameter. |
EstMLELMBin here is used as a wrapper for the mle2 function of
bbmle package therefore output is of class of mle2.
Elamir EA (2013). “Multiplicative-Binomial Distribution: Some Results on Characterization, Inference and Random Data Generation.” Journal of Statistical Theory and Applications, 12(1), 92–105.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLELMBin(x=No.D.D,freq=Obs.fre.1,p=0.5,phi=15) bbmle::coef(parameters) #extracting the parametersNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLELMBin(x=No.D.D,freq=Obs.fre.1,p=0.5,phi=15) bbmle::coef(parameters) #extracting the parameters
The function will estimate the shape parameters using the maximum log likelihood method for the McDonald Generalized Beta Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMLEMcGBB(x,freq,a,b,c,...)EstMLEMcGBB(x,freq,a,b,c,...)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
c |
single value for shape parameter gamma representing as c. |
... |
mle2 function inputs except data and estimating parameter. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
EstMLEMcGBB here is used as a wrapper for the mle2 function of bbmle package
therefore output is of class of mle2.
Manoj C, Wijekoon P, Yapa RD (2013). “The McDonald generalized beta-binomial distribution: A new binomial mixture distribution and simulation based comparison with its nested distributions in handling overdispersion.” International journal of statistics and probability, 2(2), 24. Janiffer NM, Islam A, Luke O, others (2014). “Estimating Equations for Estimation of Mcdonald Generalized Beta—Binomial Parameters.” Open Journal of Statistics, 4(09), 702. Roozegar R, Tahmasebi S, Jafari AA (2017). “The McDonald Gompertz distribution: properties and applications.” Communications in Statistics-Simulation and Computation, 46(5), 3341–3355.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEMcGBB(x=No.D.D,freq=Obs.fre.1,a=0.1,b=0.1,c=0.2) bbmle::coef(parameters) #extracting the parameters ## End(Not run)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEMcGBB(x=No.D.D,freq=Obs.fre.1,a=0.1,b=0.1,c=0.2) bbmle::coef(parameters) #extracting the parameters ## End(Not run)
The function will estimate the probability of success and theta parameter using the maximum log likelihood method for the Multiplicative Binomial distribution when the binomial random variables and corresponding frequencies are given.
EstMLEMultiBin(x,freq,p,theta,...)EstMLEMultiBin(x,freq,p,theta,...)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
p |
single value for probability of success. |
theta |
single value for theta parameter. |
... |
mle2 function inputs except data and estimating parameter. |
EstMLEMultiBin here is used as a wrapper for the mle2 function of
bbmle package therefore output is of class of mle2.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEMultiBin(x=No.D.D,freq=Obs.fre.1,p=0.5,theta=15) bbmle::coef(parameters) #extracting the parametersNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEMultiBin(x=No.D.D,freq=Obs.fre.1,p=0.5,theta=15) bbmle::coef(parameters) #extracting the parameters
The function will estimate the mode value using the maximum log likelihood method for the Triangular Binomial Distribution when the binomial random variables and corresponding frequencies are given.
EstMLETriBin(x,freq)EstMLETriBin(x,freq)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of EstMLETriBin will produce the classes of ml and mlTB
format consisting
min Negative log likelihood value.
mode Estimated mode value.
AIC AIC value.
call the inputs for the function.
Methods print, summary, coef and AIC can be used to
extract specific outputs.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Karlis D, Xekalaki E (2008). The polygonal distribution. Springer. Okagbue HI, Edeki SO, Opanuga AA, Oguntunde PE, Adeosun ME (2014). “Using the Average of the Extreme Values of a Triangular Distribution for a Transformation, and Its Approximant via the Continuous Uniform Distribution.” British Journal of Mathematics and Computer Science, 4(24), 3497.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the mode value and extracting the mode value results <- EstMLETriBin(No.D.D,Obs.fre.1) # extract the mode value and summary coef(results) summary(results) AIC(results) #show the AIC value ## End(Not run)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the mode value and extracting the mode value results <- EstMLETriBin(No.D.D,Obs.fre.1) # extract the mode value and summary coef(results) summary(results) AIC(results) #show the AIC value ## End(Not run)
In an examination, there were 9 questions set on a particular topic. Each question is marked out of a total of 20 and in assessing the final class of a candidate, particular attention is paid to the total number of questions for which he has an "alpha", i.e., at least 15 out of 20, as well as his total number of marks. His number of alpha's is a rough indication of the "quality" of his exam performance. Thus, the distribution of alpha's over the candidates is of interest. There were 209 candidates attempting questions from this section of 9 questions and a total of 326 alpha's was awarded. So we treat 9 as the "litter size", and the dichotomous response is whether or not he got an alpha on the question.
Exam_dataExam_data
A data frame with 2 columns and 10 rows
No.of.alphaNo of Alphas
freObserved frequencies
Extracted from
Paul, S.R., 1985. A three-parameter generalization of the binomial distribution. Communications in Statistics - Theory and Methods, 14(6), pp.1497-1506.
Available at: doi:10.1080/03610928508828990
Exam_data$No.of.alpha #extracting the binomial random variables sum(Exam_data$fre) #summing all the frequenciesExam_data$No.of.alpha #extracting the binomial random variables sum(Exam_data$fre) #summing all the frequencies
The function will fit the Additive Binomial distribution when random variables, corresponding frequencies, probability of success and alpha are given. It will provide the expected frequencies, chi-squared test statistics value, p value, and degree of freedom value so that it can be seen if this distribution fits the data.
fitAddBin(x,obs.freq,p,alpha)fitAddBin(x,obs.freq,p,alpha)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
p |
single value for probability of success. |
alpha |
single value for alpha. |
The output of fitAddBin gives the class format fitAB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitAB fitted probability values of dAddBin.
NegLL Negative Log Likelihood value.
p estimated probability value.
alpha estimated alpha parameter value.
AIC AIC value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted
can be used to extract specific outputs.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506. Morel JG, Neerchal NK (2012). Overdispersion models in SAS. SAS Publishing.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding the frequencies ## Not run: #assigning the estimated probability value paddbin <- EstMLEAddBin(No.D.D,Obs.fre.1)$p #assigning the estimated alpha value alphaaddbin <- EstMLEAddBin(No.D.D,Obs.fre.1)$alpha #fitting when the random variable,frequencies,probability and alpha are given results <- fitAddBin(No.D.D,Obs.fre.1,paddbin,alphaaddbin) results #extracting the AIC value AIC(results) #extract fitted values fitted(results) ## End(Not run)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding the frequencies ## Not run: #assigning the estimated probability value paddbin <- EstMLEAddBin(No.D.D,Obs.fre.1)$p #assigning the estimated alpha value alphaaddbin <- EstMLEAddBin(No.D.D,Obs.fre.1)$alpha #fitting when the random variable,frequencies,probability and alpha are given results <- fitAddBin(No.D.D,Obs.fre.1,paddbin,alphaaddbin) results #extracting the AIC value AIC(results) #extract fitted values fitted(results) ## End(Not run)
The function will fit the Beta-Binomial distribution when random variables, corresponding frequencies and shape parameters are given. It will provide the expected frequencies, chi-squared test statistics value, p value, degree of freedom and over dispersion value so that it can be seen if this distribution fits the data.
fitBetaBin(x,obs.freq,a,b)fitBetaBin(x,obs.freq,a,b)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of fitBetaBin gives the class format fitBB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitBB fitted values of dBetaBin.
NegLL Negative Log Likelihood value.
a estimated value for alpha parameter as a.
b estimated value for alpha parameter as b.
AIC AIC value.
over.dis.para over dispersion value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted can be
used to extract specific outputs.
Young-Xu Y, Chan KA (2008). “Pooling overdispersed binomial data to estimate event rate.” BMC medical research methodology, 8, 1–12. Trenkler G (1996). “Continuous univariate distributions.” Computational Statistics and Data Analysis, 21(1), 119–119. HUGHES G, MADDEN L (1993). “Using the beta-binomial distribution to describe aggegated patterns of disease incidence.” Phytopathology, 83(7), 759–763.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEBetaBin(No.D.D,Obs.fre.1,0.1,0.1) bbmle::coef(parameters) #extracting the parameters a and b aBetaBin <- bbmle::coef(parameters)[1] #assigning the parameter a bBetaBin <- bbmle::coef(parameters)[2] #assigning the parameter b #fitting when the random variable,frequencies,shape parameter values are given. fitBetaBin(No.D.D,Obs.fre.1,aBetaBin,bBetaBin) #estimating the parameters using moment generating function methods results <- EstMGFBetaBin(No.D.D,Obs.fre.1) results aBetaBin1 <- results$a #assigning the estimated a bBetaBin1 <- results$b #assigning the estimated b #fitting when the random variable,frequencies,shape parameter values are given. BB <- fitBetaBin(No.D.D,Obs.fre.1,aBetaBin1,bBetaBin1) #extracting the expected frequencies fitted(BB) #extracting the residuals residuals(BB)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEBetaBin(No.D.D,Obs.fre.1,0.1,0.1) bbmle::coef(parameters) #extracting the parameters a and b aBetaBin <- bbmle::coef(parameters)[1] #assigning the parameter a bBetaBin <- bbmle::coef(parameters)[2] #assigning the parameter b #fitting when the random variable,frequencies,shape parameter values are given. fitBetaBin(No.D.D,Obs.fre.1,aBetaBin,bBetaBin) #estimating the parameters using moment generating function methods results <- EstMGFBetaBin(No.D.D,Obs.fre.1) results aBetaBin1 <- results$a #assigning the estimated a bBetaBin1 <- results$b #assigning the estimated b #fitting when the random variable,frequencies,shape parameter values are given. BB <- fitBetaBin(No.D.D,Obs.fre.1,aBetaBin1,bBetaBin1) #extracting the expected frequencies fitted(BB) #extracting the residuals residuals(BB)
The function will fit the Beta-Correlated Binomial Distribution when random variables, corresponding frequencies, covariance, alpha and beta parameters are given. It will provide the expected frequencies, chi-squared test statistics value, p value, and degree of freedom so that it can be seen if this distribution fits the data.
fitBetaCorrBin(x,obs.freq,cov,a,b)fitBetaCorrBin(x,obs.freq,cov,a,b)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
cov |
single value for covariance. |
a |
single value for alpha parameter. |
b |
single value for beta parameter. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of fitBetaCorrBin gives the class format fitBCB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic
corr Correlation value.
fitBCB fitted probability values of dBetaCorrBin.
NegLL Negative Log Likelihood value.
a estimated shape parameter value a.
b estimated shape parameter value b.
cov estimated covariance value.
AIC AIC value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted
can be used to extract specific outputs.
Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEBetaCorrBin(x=No.D.D,freq=Obs.fre.1,cov=0.0050,a=10,b=10) covBetaCorrBin <- bbmle::coef(parameters)[1] aBetaCorrBin <- bbmle::coef(parameters)[2] bBetaCorrBin <- bbmle::coef(parameters)[3] #fitting when the random variable,frequencies,covariance, a and b are given results <- fitBetaCorrBin(No.D.D,Obs.fre.1,covBetaCorrBin,aBetaCorrBin,bBetaCorrBin) results #extract AIC value AIC(results) #extract fitted values fitted(results)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEBetaCorrBin(x=No.D.D,freq=Obs.fre.1,cov=0.0050,a=10,b=10) covBetaCorrBin <- bbmle::coef(parameters)[1] aBetaCorrBin <- bbmle::coef(parameters)[2] bBetaCorrBin <- bbmle::coef(parameters)[3] #fitting when the random variable,frequencies,covariance, a and b are given results <- fitBetaCorrBin(No.D.D,Obs.fre.1,covBetaCorrBin,aBetaCorrBin,bBetaCorrBin) results #extract AIC value AIC(results) #extract fitted values fitted(results)
The function will fit the Binomial distribution when random variables, corresponding frequencies and probability value are given. It will provide the expected frequencies, chi-squared test statistics value, p value and degree of freedom so that it can be seen if this distribution fits the data.
fitBin(x,obs.freq,p=0)fitBin(x,obs.freq,p=0)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
p |
single value for probability or zero to estimate p. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of fitBin gives the class format fitB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics value.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitB fitted probability values of dbinom.
phat estimated probability value.
call the inputs of the function.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #fitting when the random variable,frequencies are given. fitBin(No.D.D,Obs.fre.1)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #fitting when the random variable,frequencies are given. fitBin(No.D.D,Obs.fre.1)
The function will fit the COM Poisson Binomial Distribution when random variables, corresponding frequencies, probability of success and v parameter are given. It will provide the expected frequencies, chi-squared test statistics value, p value, and degree of freedom so that it can be seen if this distribution fits the data.
fitCOMPBin(x,obs.freq,p,v)fitCOMPBin(x,obs.freq,p,v)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
p |
single value for probability of success. |
v |
single value for v. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of fitCOMPBin gives the class format fitCPB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitCPB fitted probability values of dCOMPBin.
NegLL Negative Log Likelihood value.
p estimated probability value.
v estimated v parameter value.
AIC AIC value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted
can be used to extract specific outputs.
Borges P, Rodrigues J, Balakrishnan N, Bazan J (2014). “A COM–Poisson type generalization of the binomial distribution and its properties and applications.” Statistics and Probability Letters, 87, 158–166.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLECOMPBin(x=No.D.D,freq=Obs.fre.1,p=0.5,v=0.050) pCOMPBin <- bbmle::coef(parameters)[1] vCOMPBin <- bbmle::coef(parameters)[2] #fitting when the random variable,frequencies,probability and v parameter are given results <- fitCOMPBin(No.D.D,Obs.fre.1,pCOMPBin,vCOMPBin) results #extracting the AIC value AIC(results) #extract fitted values fitted(results)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLECOMPBin(x=No.D.D,freq=Obs.fre.1,p=0.5,v=0.050) pCOMPBin <- bbmle::coef(parameters)[1] vCOMPBin <- bbmle::coef(parameters)[2] #fitting when the random variable,frequencies,probability and v parameter are given results <- fitCOMPBin(No.D.D,Obs.fre.1,pCOMPBin,vCOMPBin) results #extracting the AIC value AIC(results) #extract fitted values fitted(results)
The function will fit the Correlated Binomial Distribution when random variables, corresponding frequencies, probability of success and covariance are given. It will provide the expected frequencies, chi-squared test statistics value, p value, and degree of freedom so that it can be seen if this distribution fits the data.
fitCorrBin(x,obs.freq,p,cov)fitCorrBin(x,obs.freq,p,cov)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
p |
single value for probability of success. |
cov |
single value for covariance. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of fitCorrBin gives the class format fitCB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic.
corr Correlation value.
fitCB fitted probability values of dCorrBin.
NegLL Negative Log Likelihood value.
AIC AIC value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted
can be used to extract specific outputs.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506. Morel JG, Neerchal NK (2012). Overdispersion models in SAS. SAS Publishing.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLECorrBin(x=No.D.D,freq=Obs.fre.1,p=0.5,cov=0.0050) pCorrBin <- bbmle::coef(parameters)[1] covCorrBin <- bbmle::coef(parameters)[2] #fitting when the random variable,frequencies,probability and covariance are given results <- fitCorrBin(No.D.D,Obs.fre.1,pCorrBin,covCorrBin) results #extracting the AIC value AIC(results) #extract fitted values fitted(results)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLECorrBin(x=No.D.D,freq=Obs.fre.1,p=0.5,cov=0.0050) pCorrBin <- bbmle::coef(parameters)[1] covCorrBin <- bbmle::coef(parameters)[2] #fitting when the random variable,frequencies,probability and covariance are given results <- fitCorrBin(No.D.D,Obs.fre.1,pCorrBin,covCorrBin) results #extracting the AIC value AIC(results) #extract fitted values fitted(results)
The function will fit the Gamma Binomial Distribution when random variables, corresponding frequencies and shape parameters are given. It will provide the expected frequencies, chi-squared test statistics value, p value, degree of freedom and over dispersion value so that it can be seen if this distribution fits the data.
fitGammaBin(x,obs.freq,c,l)fitGammaBin(x,obs.freq,c,l)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
c |
single value for shape parameter c. |
l |
single value for shape parameter l. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of fitGammaBin gives the class format fitGaB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitMB fitted values of dGammaBin.
NegLL Negative Log Likelihood value.
c estimated value for shape parameter c.
l estimated value for shape parameter l.
AIC AIC value.
over.dis.para over dispersion value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted can be used to
extract specific outputs.
Grassia A (1977). “On a family of distributions with argument between 0 and 1 obtained by transformation of the gamma and derived compound distributions.” Australian Journal of Statistics, 19(2), 108–114.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGammaBin(x=No.D.D,freq=Obs.fre.1,c=0.1,l=0.1) cGBin <- bbmle::coef(parameters)[1] #assigning the estimated c lGBin <- bbmle::coef(parameters)[2] #assigning the estimated l #fitting when the random variable,frequencies,shape parameter values are given. results <- fitGammaBin(No.D.D,Obs.fre.1,cGBin,lGBin) results #extracting the expected frequencies fitted(results) #extracting the residuals residuals(results)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGammaBin(x=No.D.D,freq=Obs.fre.1,c=0.1,l=0.1) cGBin <- bbmle::coef(parameters)[1] #assigning the estimated c lGBin <- bbmle::coef(parameters)[2] #assigning the estimated l #fitting when the random variable,frequencies,shape parameter values are given. results <- fitGammaBin(No.D.D,Obs.fre.1,cGBin,lGBin) results #extracting the expected frequencies fitted(results) #extracting the residuals residuals(results)
The function will fit the Gaussian Hypergeometric Generalized Beta Binomial Distribution when random variables, corresponding frequencies and shape parameters are given. It will provide the expected frequencies, chi-squared test statistics value, p value, degree of freedom and over dispersion value so that it can be seen if this distribution fits the data.
fitGHGBB(x,obs.freq,a,b,c)fitGHGBB(x,obs.freq,a,b,c)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing a. |
b |
single value for shape parameter beta representing b. |
c |
single value for shape parameter lambda representing c. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of fitGHGBB gives the class format fitGB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitGB fitted values of dGHGBB.
NegLL Negative Loglikelihood value.
a estimated value for alpha parameter as a.
b estimated value for beta parameter as b.
c estimated value for gamma parameter as c.
AIC AIC value.
over.dis.para over dispersion value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted can be used
to extract specific outputs.
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2007). “A generalization of the beta–binomial distribution.” Journal of the Royal Statistical Society Series C: Applied Statistics, 56(1), 51–61. Pearson JW (2009). Computation of hypergeometric functions. Ph.D. thesis, University of Oxford.
——————–
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGHGBB(No.D.D,Obs.fre.1,0.1,20,1.3) bbmle::coef(parameters) #extracting the parameters aGHGBB <- bbmle::coef(parameters)[1] #assigning the estimated a bGHGBB <- bbmle::coef(parameters)[2] #assigning the estimated b cGHGBB <- bbmle::coef(parameters)[3] #assigning the estimated c #fitting when the random variable,frequencies,shape parameter values are given. results <- fitGHGBB(No.D.D,Obs.fre.1,aGHGBB,bGHGBB,cGHGBB) results #extracting the expected frequencies fitted(results) #extracting the residuals residuals(results)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGHGBB(No.D.D,Obs.fre.1,0.1,20,1.3) bbmle::coef(parameters) #extracting the parameters aGHGBB <- bbmle::coef(parameters)[1] #assigning the estimated a bGHGBB <- bbmle::coef(parameters)[2] #assigning the estimated b cGHGBB <- bbmle::coef(parameters)[3] #assigning the estimated c #fitting when the random variable,frequencies,shape parameter values are given. results <- fitGHGBB(No.D.D,Obs.fre.1,aGHGBB,bGHGBB,cGHGBB) results #extracting the expected frequencies fitted(results) #extracting the residuals residuals(results)
The function will fit the Grassia II Binomial Distribution when random variables, corresponding frequencies and shape parameters are given. It will provide the expected frequencies, chi-squared test statistics value, p value, degree of freedom and over dispersion value so that it can be seen if this distribution fits the data.
fitGrassiaIIBin(x,obs.freq,a,b)fitGrassiaIIBin(x,obs.freq,a,b)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
a |
single value for shape parameter a. |
b |
single value for shape parameter b. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of fitGrassiaIIBin gives the class format fitGrIIB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitGrIIB fitted values of dGrassiaIIBin.
NegLL Negative Log Likelihood value.
a estimated value for shape parameter a.
b estimated value for shape parameter b.
AIC AIC value.
over.dis.para over dispersion value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted can be used to
extract specific outputs.
Grassia A (1977). “On a family of distributions with argument between 0 and 1 obtained by transformation of the gamma and derived compound distributions.” Australian Journal of Statistics, 19(2), 108–114.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGrassiaIIBin(x=No.D.D,freq=Obs.fre.1,a=0.1,b=0.1) aGIIBin <- bbmle::coef(parameters)[1] #assigning the estimated a bGIIBin <- bbmle::coef(parameters)[2] #assigning the estimated b #fitting when the random variable,frequencies,shape parameter values are given. results <- fitGrassiaIIBin(No.D.D,Obs.fre.1,aGIIBin,bGIIBin) results #extracting the expected frequencies fitted(results) #extracting the residuals residuals(results)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEGrassiaIIBin(x=No.D.D,freq=Obs.fre.1,a=0.1,b=0.1) aGIIBin <- bbmle::coef(parameters)[1] #assigning the estimated a bGIIBin <- bbmle::coef(parameters)[2] #assigning the estimated b #fitting when the random variable,frequencies,shape parameter values are given. results <- fitGrassiaIIBin(No.D.D,Obs.fre.1,aGIIBin,bGIIBin) results #extracting the expected frequencies fitted(results) #extracting the residuals residuals(results)
The function will fit the Kumaraswamy Binomial distribution when random variables, corresponding frequencies and shape parameters are given. It will provide the expected frequencies, chi-squared test statistics value, p value, degree of freedom and over dispersion value so that it can be seen if this distribution fits the data.
fitKumBin(x,obs.freq,a,b,it)fitKumBin(x,obs.freq,a,b,it)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing a. |
b |
single value for shape parameter beta representing b. |
it |
number of iterations to converge as a proper probability function replacing infinity. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of fitKumBin gives the class format fitKB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitKB fitted values of dKumBin.
NegLL Negative Log Likelihood value.
a estimated value for alpha parameter as a.
b estimated value for beta parameter as b.
it estimated it value for iterations.
AIC AIC value.
over.dis.para over dispersion value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fiited can be used to
extract specific outputs.
Xiaohu L, Yanyan H, Xueyan Z (2011). “The Kumaraswamy binomial distribution.” Chinese Journal of Applied Probability and Statistics, 27(5), 511–521.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEKumBin(x=No.D.D,freq=Obs.fre.1,a=10.1,b=1.1,it=10000) bbmle::coef(parameters) #extracting the parameters aKumBin <- bbmle::coef(parameters)[1] #assigning the estimated a bKumBin <- bbmle::coef(parameters)[2] #assigning the estimated b itKumBin <- bbmle::coef(parameters)[3] #assigning the estimated iterations #fitting when the random variable,frequencies,shape parameter values are given. results <- fitKumBin(No.D.D,Obs.fre.1,aKumBin,bKumBin,itKumBin*100) results #extracting the expected frequencies fitted(results) #extracting the residuals residuals(results) ## End(Not run)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEKumBin(x=No.D.D,freq=Obs.fre.1,a=10.1,b=1.1,it=10000) bbmle::coef(parameters) #extracting the parameters aKumBin <- bbmle::coef(parameters)[1] #assigning the estimated a bKumBin <- bbmle::coef(parameters)[2] #assigning the estimated b itKumBin <- bbmle::coef(parameters)[3] #assigning the estimated iterations #fitting when the random variable,frequencies,shape parameter values are given. results <- fitKumBin(No.D.D,Obs.fre.1,aKumBin,bKumBin,itKumBin*100) results #extracting the expected frequencies fitted(results) #extracting the residuals residuals(results) ## End(Not run)
The function will fit the Lovinson Multiplicative Binomial distribution when random variables, corresponding frequencies, probability of success and phi parameter are given. It will provide the expected frequencies, chi-squared test statistics value, p value and degree of freedom value so that it can be seen if this distribution fits the data.
fitLMBin(x,obs.freq,p,phi)fitLMBin(x,obs.freq,p,phi)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
p |
single value for probability of success. |
phi |
single value for phi parameter. |
The output of fitLMBin gives the class format fitLMB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitLMB fitted probability values of dLMBin.
NegLL Negative Log Likelihood value.
p estimated probability value.
phi estimated phi parameter value.
AIC AIC value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted
can be used to extract specific outputs.
Elamir EA (2013). “Multiplicative-Binomial Distribution: Some Results on Characterization, Inference and Random Data Generation.” Journal of Statistical Theory and Applications, 12(1), 92–105.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLELMBin(x=No.D.D,freq=Obs.fre.1,p=0.1,phi=.3) pLMBin=bbmle::coef(parameters)[1] #assigning the estimated probability value phiLMBin <- bbmle::coef(parameters)[2] #assigning the estimated phi value #fitting when the random variable,frequencies,probability and phi are given results <- fitLMBin(No.D.D,Obs.fre.1,pLMBin,phiLMBin) results #extracting the AIC value AIC(results) #extract fitted values fitted(results)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLELMBin(x=No.D.D,freq=Obs.fre.1,p=0.1,phi=.3) pLMBin=bbmle::coef(parameters)[1] #assigning the estimated probability value phiLMBin <- bbmle::coef(parameters)[2] #assigning the estimated phi value #fitting when the random variable,frequencies,probability and phi are given results <- fitLMBin(No.D.D,Obs.fre.1,pLMBin,phiLMBin) results #extracting the AIC value AIC(results) #extract fitted values fitted(results)
The function will fit the McDonald Generalized Beta Binomial Distribution when random variables, corresponding frequencies and shape parameters are given. It will provide the expected frequencies, chi-squared test statistics value, p value, degree of freedom and over dispersion value so that it can be seen if this distribution fits the data.
fitMcGBB(x,obs.freq,a,b,c)fitMcGBB(x,obs.freq,a,b,c)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing a. |
b |
single value for shape parameter beta representing b. |
c |
single value for shape parameter gamma representing c. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of fitMcGBB gives the class format fitMB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitMB fitted values of dMcGBB.
NegLL Negative Log Likelihood value.
a estimated value for alpha parameter as a.
b estimated value for beta parameter as b.
c estimated value for gamma parameter as c.
AIC AIC value.
over.dis.para over dispersion value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted can be used to
extract specific outputs.
Manoj C, Wijekoon P, Yapa RD (2013). “The McDonald generalized beta-binomial distribution: A new binomial mixture distribution and simulation based comparison with its nested distributions in handling overdispersion.” International journal of statistics and probability, 2(2), 24. Janiffer NM, Islam A, Luke O, others (2014). “Estimating Equations for Estimation of Mcdonald Generalized Beta—Binomial Parameters.” Open Journal of Statistics, 4(09), 702. Roozegar R, Tahmasebi S, Jafari AA (2017). “The McDonald Gompertz distribution: properties and applications.” Communications in Statistics-Simulation and Computation, 46(5), 3341–3355.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEMcGBB(x=No.D.D,freq=Obs.fre.1,a=0.1,b=0.1,c=3.2) aMcGBB <- bbmle::coef(parameters)[1] #assigning the estimated a bMcGBB <- bbmle::coef(parameters)[2] #assigning the estimated b cMcGBB <- bbmle::coef(parameters)[3] #assigning the estimated c #fitting when the random variable,frequencies,shape parameter values are given. results <- fitMcGBB(No.D.D,Obs.fre.1,aMcGBB,bMcGBB,cMcGBB) results #extracting the expected frequencies fitted(results) #extracting the residuals residuals(results) ## End(Not run)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEMcGBB(x=No.D.D,freq=Obs.fre.1,a=0.1,b=0.1,c=3.2) aMcGBB <- bbmle::coef(parameters)[1] #assigning the estimated a bMcGBB <- bbmle::coef(parameters)[2] #assigning the estimated b cMcGBB <- bbmle::coef(parameters)[3] #assigning the estimated c #fitting when the random variable,frequencies,shape parameter values are given. results <- fitMcGBB(No.D.D,Obs.fre.1,aMcGBB,bMcGBB,cMcGBB) results #extracting the expected frequencies fitted(results) #extracting the residuals residuals(results) ## End(Not run)
The function will fit the Multiplicative Binomial distribution when random variables, corresponding frequencies, probability of success and theta parameter are given. It will provide the expected frequencies, chi-squared test statistics value, p value and degree of freedom value so that it can be seen if this distribution fits the data.
fitMultiBin(x,obs.freq,p,theta)fitMultiBin(x,obs.freq,p,theta)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
p |
single value for probability of success. |
theta |
single value for theta parameter. |
The output of fitMultiBin gives the class format fitMuB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitMuB fitted probability values of dMultiBin.
NegLL Negative Log Likelihood value.
p estimated probability value.
theta estimated theta parameter value.
AIC AIC value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted
can be used to extract specific outputs.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEMultiBin(x=No.D.D,freq=Obs.fre.1,p=0.1,theta=.3) pMultiBin <- bbmle::coef(parameters)[1] #assigning the estimated probability value thetaMultiBin <- bbmle::coef(parameters)[2] #assigning the estimated theta value #fitting when the random variable,frequencies,probability and theta are given results <- fitMultiBin(No.D.D,Obs.fre.1,pMultiBin,thetaMultiBin) results #extracting the AIC value AIC(results) #extract fitted values fitted(results)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating the parameters using maximum log likelihood value and assigning it parameters <- EstMLEMultiBin(x=No.D.D,freq=Obs.fre.1,p=0.1,theta=.3) pMultiBin <- bbmle::coef(parameters)[1] #assigning the estimated probability value thetaMultiBin <- bbmle::coef(parameters)[2] #assigning the estimated theta value #fitting when the random variable,frequencies,probability and theta are given results <- fitMultiBin(No.D.D,Obs.fre.1,pMultiBin,thetaMultiBin) results #extracting the AIC value AIC(results) #extract fitted values fitted(results)
The function will fit the Triangular Binomial distribution when random variables, corresponding frequencies and mode parameter are given. It will provide the expected frequencies, chi-squared test statistics value, p value, degree of freedom and over dispersion value so that it can be seen if this distribution fits the data.
fitTriBin(x,obs.freq,mode)fitTriBin(x,obs.freq,mode)
x |
vector of binomial random variables. |
obs.freq |
vector of frequencies. |
mode |
single value for mode. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of fitTriBin gives the class format fitTB and fit consisting a list
bin.ran.var binomial random variables.
obs.freq corresponding observed frequencies.
exp.freq corresponding expected frequencies.
statistic chi-squared test statistics value.
df degree of freedom.
p.value probability value by chi-squared test statistic.
fitTB fitted probability values of dTriBin.
NegLL Negative Log Likelihood value.
mode estimated mode value.
AIC AIC value.
over.dis.para over dispersion value.
call the inputs of the function.
Methods summary, print, AIC, residuals and fitted
can be used to extract specific outputs.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Karlis D, Xekalaki E (2008). The polygonal distribution. Springer. Okagbue HI, Edeki SO, Opanuga AA, Oguntunde PE, Adeosun ME (2014). “Using the Average of the Extreme Values of a Triangular Distribution for a Transformation, and Its Approximant via the Continuous Uniform Distribution.” British Journal of Mathematics and Computer Science, 4(24), 3497.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies modeTriBin <- EstMLETriBin(No.D.D,Obs.fre.1)$mode #assigning the extracted the mode value #fitting when the random variable,frequencies,mode value are given. results <- fitTriBin(No.D.D,Obs.fre.1,modeTriBin) results #extract AIC value AIC(results) #extract fitted values fitted(results)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies modeTriBin <- EstMLETriBin(No.D.D,Obs.fre.1)$mode #assigning the extracted the mode value #fitting when the random variable,frequencies,mode value are given. results <- fitTriBin(No.D.D,Obs.fre.1,modeTriBin) results #extract AIC value AIC(results) #extract fitted values fitted(results)
Using a three step algorithm to generate overdispersed binomial outcome data. When the number of frequencies, binomial random variable, probability of success and overdispersion are given.
GenerateBOD(N,n,pi,rho)GenerateBOD(N,n,pi,rho)
N |
single value for number of total frequencies |
n |
single value for binomial random variable |
pi |
single value for probability of success |
rho |
single value for overdispersion parameter |
The generated binomial random variables are overdispersed based on for the probability of
success .
Step 1: Solve the following equation for a given ,
For where is the cumulative distribution function of the
standard bivariate normal random variable with correlation coefficient , and denotes
the quantile of the standard normal distribution.
Step 2: Generate $n$-dimensional multivariate normal random variables,
with mean and constant correlation matrix for where the elements of
are for .
Step 3: Now for each define if , or
otherwise. Then, it can be showed that the random variable
is overdispersed relative to the Binomial distribution.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of GenerateBOD gives a vector of overdispersed binomial random variables
Manoj C, Wijekoon P, Yapa RD (2013). “The McDonald generalized beta-binomial distribution: A new binomial mixture distribution and simulation based comparison with its nested distributions in handling overdispersion.” International journal of statistics and probability, 2(2), 24.
N <- 500 # Number of observations n <- 10 # Dimension of multivariate normal random variables pi <- 0.5 # Probability threshold rho <- 0.1 # Dispersion parameter # Generate overdispersed binomial variables New_overdispersed_data <- GenerateBOD(N, n, pi, rho) table(New_overdispersed_data)N <- 500 # Number of observations n <- 10 # Dimension of multivariate normal random variables pi <- 0.5 # Probability threshold rho <- 0.1 # Dispersion parameter # Generate overdispersed binomial variables New_overdispersed_data <- GenerateBOD(N, n, pi, rho) table(New_overdispersed_data)
The number of male children among the first 12 children of family size 13 in 6115 families taken from the hospital records in the nineteenth century Saxony (Sokal & Rohlf(1994), Lindsey (1995), p. 59). The thirteenth child is ignored to assuage the effect of families non-randomly stopping when a desired gender is reached.
Male_ChildrenMale_Children
A data frame with 2 columns and 13 rows.
No_of_MalesNo of Male children among first 12 children of family size 13
freqObserved frequencies for corresponding male children
Extracted from
Borges, P., Rodrigues, J., Balakrishnan, N. and Bazan, J., 2014. A COM-Poisson type generalization of the binomial distribution and its properties and applications. Statistics & Probability Letters, 87, pp.158-166.
Available at: doi:10.1016/j.spl.2014.01.019
Male_Children$No_of_Males # extracting the binomial random variables sum(Male_Children$freq) # summing all the frequenciesMale_Children$No_of_Males # extracting the binomial random variables sum(Male_Children$freq) # summing all the frequencies
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Beta Distribution bounded between [0,1].
mazBETA(r,a,b)mazBETA(r,a,b)
r |
vector of moments. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
The probability density function and cumulative density function of a unit bounded beta distribution with random variable P are given by
;
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as is
incomplete beta integrals and is the beta function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of mazBETA gives the moments about zero in vector form.
Johnson NL, Kotz S, Balakrishnan N (1995). Continuous univariate distributions, volume 2, volume 289. John wiley and sons. Trenkler G (1996). “Continuous univariate distributions.” Computational Statistics and Data Analysis, 21(1), 119–119.
or
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Beta.html
#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dBETA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dBETA(seq(0,1,by=0.01),2,3)$pdf #extracting the pdf values dBETA(seq(0,1,by=0.01),2,3)$mean #extracting the mean dBETA(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pBETA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pBETA(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazBETA(1.4,3,2) #acquiring the moment about zero values mazBETA(2,3,2)-mazBETA(1,3,2)^2 #acquiring the variance for a=3,b=2 #only the integer value of moments is taken here because moments cannot be decimal mazBETA(1.9,5.5,6)#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dBETA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dBETA(seq(0,1,by=0.01),2,3)$pdf #extracting the pdf values dBETA(seq(0,1,by=0.01),2,3)$mean #extracting the mean dBETA(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pBETA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pBETA(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazBETA(1.4,3,2) #acquiring the moment about zero values mazBETA(2,3,2)-mazBETA(1,3,2)^2 #acquiring the variance for a=3,b=2 #only the integer value of moments is taken here because moments cannot be decimal mazBETA(1.9,5.5,6)
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for Gamma Distribution bounded between [0,1].
mazGAMMA(r,c,l)mazGAMMA(r,c,l)
r |
vector of moments. |
c |
single value for shape parameter c. |
l |
single value for shape parameter l. |
The probability density function and cumulative density function of a unit bounded Gamma distribution with random variable P are given by
;
;
The mean the variance are denoted by
The moments about zero is denoted as
Defined as is the gamma function.
Defined as is the Lower incomplete gamma function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of mazGAMMA gives the moments about zero in vector form.
Olshen AC (1938). “Transformations of the pearson type III distribution.” The Annals of Mathematical Statistics, 9(3), 176–200.
#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dGAMMA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dGAMMA(seq(0,1,by=0.01),5,6)$pdf #extracting the pdf values dGAMMA(seq(0,1,by=0.01),5,6)$mean #extracting the mean dGAMMA(seq(0,1,by=0.01),5,6)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pGAMMA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pGAMMA(seq(0,1,by=0.01),5,6) #acquiring the cumulative probability values mazGAMMA(1.4,5,6) #acquiring the moment about zero values mazGAMMA(2,5,6)-mazGAMMA(1,5,6)^2 #acquiring the variance for a=5,b=6 #only the integer value of moments is taken here because moments cannot be decimal mazGAMMA(1.9,5.5,6)#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dGAMMA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dGAMMA(seq(0,1,by=0.01),5,6)$pdf #extracting the pdf values dGAMMA(seq(0,1,by=0.01),5,6)$mean #extracting the mean dGAMMA(seq(0,1,by=0.01),5,6)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pGAMMA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pGAMMA(seq(0,1,by=0.01),5,6) #acquiring the cumulative probability values mazGAMMA(1.4,5,6) #acquiring the moment about zero values mazGAMMA(2,5,6)-mazGAMMA(1,5,6)^2 #acquiring the variance for a=5,b=6 #only the integer value of moments is taken here because moments cannot be decimal mazGAMMA(1.9,5.5,6)
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Generalized Beta Type-1 Distribution bounded between [0,1].
mazGBeta1(r,a,b,c)mazGBeta1(r,a,b,c)
r |
vector of moments |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
c |
single value for shape parameter gamma representing as c. |
The probability density function and cumulative density function of a unit bounded Generalized Beta Type-1 Distribution with random variable P are given by
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as is Beta function.
Defined as is Gaussian Hypergeometric function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output mazGBeta1 gives the moments about zero in vector form.
Manoj C, Wijekoon P, Yapa RD (2013). “The McDonald generalized beta-binomial distribution: A new binomial mixture distribution and simulation based comparison with its nested distributions in handling overdispersion.” International journal of statistics and probability, 2(2), 24. Janiffer NM, Islam A, Luke O, others (2014). “Estimating Equations for Estimation of Mcdonald Generalized Beta—Binomial Parameters.” Open Journal of Statistics, 4(09), 702. Roozegar R, Tahmasebi S, Jafari AA (2017). “The McDonald Gompertz distribution: properties and applications.” Communications in Statistics-Simulation and Computation, 46(5), 3341–3355.
#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGBeta1(seq(0,1,by=0.001),a[i],1,2*a[i])$pdf,col = col[i]) } dGBeta1(seq(0,1,by=0.01),2,3,1)$pdf #extracting the pdf values dGBeta1(seq(0,1,by=0.01),2,3,1)$mean #extracting the mean dGBeta1(seq(0,1,by=0.01),2,3,1)$var #extracting the variance pGBeta1(0.04,2,3,4) #acquiring the cdf values for a=2,b=3,c=4 mazGBeta1(1.4,3,2,2) #acquiring the moment about zero values mazGBeta1(2,3,2,2)-mazGBeta1(1,3,2,2)^2 #acquiring the variance for a=3,b=2,c=2 #only the integer value of moments is taken here because moments cannot be decimal mazGBeta1(3.2,3,2,2)#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGBeta1(seq(0,1,by=0.001),a[i],1,2*a[i])$pdf,col = col[i]) } dGBeta1(seq(0,1,by=0.01),2,3,1)$pdf #extracting the pdf values dGBeta1(seq(0,1,by=0.01),2,3,1)$mean #extracting the mean dGBeta1(seq(0,1,by=0.01),2,3,1)$var #extracting the variance pGBeta1(0.04,2,3,4) #acquiring the cdf values for a=2,b=3,c=4 mazGBeta1(1.4,3,2,2) #acquiring the moment about zero values mazGBeta1(2,3,2,2)-mazGBeta1(1,3,2,2)^2 #acquiring the variance for a=3,b=2,c=2 #only the integer value of moments is taken here because moments cannot be decimal mazGBeta1(3.2,3,2,2)
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Gaussian Hypergeometric Generalized Beta distribution bounded between [0,1].
mazGHGBeta(r,n,a,b,c)mazGHGBeta(r,n,a,b,c)
r |
vector of moments. |
n |
single value for no of binomial trials. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
c |
single value for shape parameter lambda representing as c. |
The probability density function and cumulative density function of a unit bounded Gaussian Hypergeometric Generalized Beta Distribution with random variable P are given by
;
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as as the beta function.
Defined as as the Gaussian Hypergeometric function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of mazGHGBeta give the moments about zero in vector form.
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2007). “A generalization of the beta–binomial distribution.” Journal of the Royal Statistical Society Series C: Applied Statistics, 56(1), 51–61. Pearson JW (2009). Computation of hypergeometric functions. Ph.D. thesis, University of Oxford.
#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGHGBeta(seq(0,1,by=0.001),7,1+a[i],0.3,1+a[i])$pdf,col = col[i]) } dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$pdf #extracting the pdf values dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$mean #extracting the mean dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(6) a <- c(.1,.2,.3,1.5,2.1,3) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:6) { lines(seq(0.01,1,by=0.001),pGHGBeta(seq(0.01,1,by=0.001),7,1+a[i],0.3,1+a[i]),col=col[i]) } pGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659) #acquiring the cumulative probability values mazGHGBeta(1.4,7,1.6312,0.3913,0.6659) #acquiring the moment about zero values #acquiring the variance for a=1.6312,b=0.3913,c=0.6659 mazGHGBeta(2,7,1.6312,0.3913,0.6659)-mazGHGBeta(1,7,1.6312,0.3913,0.6659)^2 #only the integer value of moments is taken here because moments cannot be decimal mazGHGBeta(1.9,15,5,6,1)#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGHGBeta(seq(0,1,by=0.001),7,1+a[i],0.3,1+a[i])$pdf,col = col[i]) } dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$pdf #extracting the pdf values dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$mean #extracting the mean dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(6) a <- c(.1,.2,.3,1.5,2.1,3) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:6) { lines(seq(0.01,1,by=0.001),pGHGBeta(seq(0.01,1,by=0.001),7,1+a[i],0.3,1+a[i]),col=col[i]) } pGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659) #acquiring the cumulative probability values mazGHGBeta(1.4,7,1.6312,0.3913,0.6659) #acquiring the moment about zero values #acquiring the variance for a=1.6312,b=0.3913,c=0.6659 mazGHGBeta(2,7,1.6312,0.3913,0.6659)-mazGHGBeta(1,7,1.6312,0.3913,0.6659)^2 #only the integer value of moments is taken here because moments cannot be decimal mazGHGBeta(1.9,15,5,6,1)
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Kumaraswamy Distribution bounded between [0,1].
mazKUM(r,a,b)mazKUM(r,a,b)
r |
vector of moments. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
The probability density function and cumulative density function of a unit bounded Kumaraswamy Distribution with random variable P are given by
;
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as is the beta function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of mazKUM gives the moments about zero in vector form.
Kumaraswamy P (1980). “A generalized probability density function for double-bounded random processes.” Journal of hydrology, 46(1-2), 79–88. Jones MC (2009). “Kumaraswamy’s distribution: A beta-type distribution with some tractability advantages.” Statistical methodology, 6(1), 70–81.
#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,6)) for (i in 1:4) { lines(seq(0,1,by=0.01),dKUM(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dKUM(seq(0,1,by=0.01),2,3)$pdf #extracting the probability values dKUM(seq(0,1,by=0.01),2,3)$mean #extracting the mean dKUM(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pKUM(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pKUM(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazKUM(1.4,3,2) #acquiring the moment about zero values mazKUM(2,2,3)-mazKUM(1,2,3)^2 #acquiring the variance for a=2,b=3 #only the integer value of moments is taken here because moments cannot be decimal mazKUM(1.9,5.5,6)#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,6)) for (i in 1:4) { lines(seq(0,1,by=0.01),dKUM(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dKUM(seq(0,1,by=0.01),2,3)$pdf #extracting the probability values dKUM(seq(0,1,by=0.01),2,3)$mean #extracting the mean dKUM(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pKUM(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pKUM(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazKUM(1.4,3,2) #acquiring the moment about zero values mazKUM(2,2,3)-mazKUM(1,2,3)^2 #acquiring the variance for a=2,b=3 #only the integer value of moments is taken here because moments cannot be decimal mazKUM(1.9,5.5,6)
These functions provide the ability for generating probability density values, cumulative probability density values and moments about zero values for the Triangular Distribution bounded between [0,1].
mazTRI(r,mode)mazTRI(r,mode)
r |
vector of moments. |
mode |
single value for mode. |
Setting and in the Triangular distribution
a unit bounded Triangular distribution can be obtained. The probability density function
and cumulative density function of a unit bounded Triangular distribution with random
variable P are given by
;
;
;
;
The mean and the variance are denoted by
Moments about zero is denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of mazTRI give the moments about zero in vector form.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Johnson NL, Kotz S, Balakrishnan N (1995). Continuous univariate distributions, volume 2, volume 289. John wiley and sons. Karlis D, Xekalaki E (2008). The polygonal distribution. Springer. Okagbue HI, Edeki SO, Opanuga AA, Oguntunde PE, Adeosun ME (2014). “Using the Average of the Extreme Values of a Triangular Distribution for a Transformation, and Its Approximant via the Continuous Uniform Distribution.” British Journal of Mathematics and Computer Science, 4(24), 3497.
#plotting the random variables and probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Probability density graph",xlab="Random variable", ylab="Probability density values",xlim = c(0,1),ylim = c(0,3)) for (i in 1:4) { lines(seq(0,1,by=0.01),dTRI(seq(0,1,by=0.01),x[i])$pdf,col = col[i]) } dTRI(seq(0,1,by=0.05),0.3)$pdf #extracting the pdf values dTRI(seq(0,1,by=0.01),0.3)$mean #extracting the mean dTRI(seq(0,1,by=0.01),0.3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Cumulative density graph",xlab="Random variable", ylab="Cumulative density values",xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pTRI(seq(0,1,by=0.01),x[i]),col = col[i]) } pTRI(seq(0,1,by=0.05),0.3) #acquiring the cumulative probability values mazTRI(1.4,.3) #acquiring the moment about zero values mazTRI(2,.3)-mazTRI(1,.3)^2 #variance for when is mode 0.3 #only the integer value of moments is taken here because moments cannot be decimal mazTRI(1.9,0.5)#plotting the random variables and probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Probability density graph",xlab="Random variable", ylab="Probability density values",xlim = c(0,1),ylim = c(0,3)) for (i in 1:4) { lines(seq(0,1,by=0.01),dTRI(seq(0,1,by=0.01),x[i])$pdf,col = col[i]) } dTRI(seq(0,1,by=0.05),0.3)$pdf #extracting the pdf values dTRI(seq(0,1,by=0.01),0.3)$mean #extracting the mean dTRI(seq(0,1,by=0.01),0.3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Cumulative density graph",xlab="Random variable", ylab="Cumulative density values",xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pTRI(seq(0,1,by=0.01),x[i]),col = col[i]) } pTRI(seq(0,1,by=0.05),0.3) #acquiring the cumulative probability values mazTRI(1.4,.3) #acquiring the moment about zero values mazTRI(2,.3)-mazTRI(1,.3)^2 #variance for when is mode 0.3 #only the integer value of moments is taken here because moments cannot be decimal mazTRI(1.9,0.5)
These functions provide the ability for generating probability density values, cumulative probability density values and moments about zero values for the Uniform Distribution bounded between [0,1].
mazUNI(r)mazUNI(r)
r |
vector of moments |
Setting and in the Uniform Distribution
a unit bounded Uniform Distribution can be obtained. The probability density function
and cumulative density function of a unit bounded Uniform Distribution with random
variable P are given by
The mean and the variance are denoted as
Moments about zero is denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of mazUNI gives the moments about zero in vector form.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Johnson NL, Kotz S, Balakrishnan N (1995). Continuous univariate distributions, volume 2, volume 289. John wiley and sons.
or
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Uniform.html
#plotting the random variables and probability values plot(seq(0,1,by=0.01),dUNI(seq(0,1,by=0.01))$pdf,type = "l",main="Probability density graph", xlab="Random variable",ylab="Probability density values") dUNI(seq(0,1,by=0.05))$pdf #extract the pdf values dUNI(seq(0,1,by=0.01))$mean #extract the mean dUNI(seq(0,1,by=0.01))$var #extract the variance #plotting the random variables and cumulative probability values plot(seq(0,1,by=0.01),pUNI(seq(0,1,by=0.01)),type = "l",main="Cumulative density graph", xlab="Random variable",ylab="Cumulative density values") pUNI(seq(0,1,by=0.05)) #acquiring the cumulative probability values mazUNI(c(1,2,3)) #acquiring the moment about zero values #only the integer value of moments is taken here because moments cannot be decimal mazUNI(1.9)#plotting the random variables and probability values plot(seq(0,1,by=0.01),dUNI(seq(0,1,by=0.01))$pdf,type = "l",main="Probability density graph", xlab="Random variable",ylab="Probability density values") dUNI(seq(0,1,by=0.05))$pdf #extract the pdf values dUNI(seq(0,1,by=0.01))$mean #extract the mean dUNI(seq(0,1,by=0.01))$var #extract the variance #plotting the random variables and cumulative probability values plot(seq(0,1,by=0.01),pUNI(seq(0,1,by=0.01)),type = "l",main="Cumulative density graph", xlab="Random variable",ylab="Cumulative density values") pUNI(seq(0,1,by=0.05)) #acquiring the cumulative probability values mazUNI(c(1,2,3)) #acquiring the moment about zero values #only the integer value of moments is taken here because moments cannot be decimal mazUNI(1.9)
This function will calculate the negative log likelihood value when the vector of binomial random variable and vector of corresponding frequencies are given with the input parameters.
NegLLAddBin(x,freq,p,alpha)NegLLAddBin(x,freq,p,alpha)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
p |
single value for probability of success. |
alpha |
single value for alpha parameter. |
The output of NegLLAddBin will produce a single numeric value.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506. Morel JG, Neerchal NK (2012). Overdispersion models in SAS. SAS Publishing.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLAddBin(No.D.D,Obs.fre.1,.5,.03) #acquiring the negative log likelihood valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLAddBin(No.D.D,Obs.fre.1,.5,.03) #acquiring the negative log likelihood value
This function will calculate the Negative Log Likelihood value when the vector of binomial random variables and vector of corresponding frequencies are given with the shape parameters a and b.
NegLLBetaBin(x,freq,a,b)NegLLBetaBin(x,freq,a,b)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of NegLLBetaBin will produce a single numeric value.
Young-Xu Y, Chan KA (2008). “Pooling overdispersed binomial data to estimate event rate.” BMC medical research methodology, 8, 1–12. Trenkler G (1996). “Continuous univariate distributions.” Computational Statistics and Data Analysis, 21(1), 119–119. HUGHES G, MADDEN L (1993). “Using the beta-binomial distribution to describe aggegated patterns of disease incidence.” Phytopathology, 83(7), 759–763.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLBetaBin(No.D.D,Obs.fre.1,.3,.4) #acquiring the negative log likelihood valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLBetaBin(No.D.D,Obs.fre.1,.3,.4) #acquiring the negative log likelihood value
This function will calculate the negative log likelihood value when the vector of binomial random variables and vector of corresponding frequencies are given with the input parameters.
NegLLBetaCorrBin(x,freq,cov,a,b)NegLLBetaCorrBin(x,freq,cov,a,b)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
cov |
single value for covariance. |
a |
single value for alpha parameter. |
b |
single value for beta parameter. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of NegLLBetaCorrBin will produce a single numeric value.
Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLBetaCorrBin(No.D.D,Obs.fre.1,0.001,9.03,10) #acquiring the negative log likelihood valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLBetaCorrBin(No.D.D,Obs.fre.1,0.001,9.03,10) #acquiring the negative log likelihood value
This function will calculate the negative log likelihood value when the vector of binomial random variables and vector of corresponding frequencies are given with the input parameters.
NegLLCOMPBin(x,freq,p,v)NegLLCOMPBin(x,freq,p,v)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
p |
single value for probability of success. |
v |
single value for v. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of NegLLCOMPBin will produce a single numeric value.
Borges P, Rodrigues J, Balakrishnan N, Bazan J (2014). “A COM–Poisson type generalization of the binomial distribution and its properties and applications.” Statistics and Probability Letters, 87, 158–166.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLCOMPBin(No.D.D,Obs.fre.1,.5,.03) #acquiring the negative log likelihood valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLCOMPBin(No.D.D,Obs.fre.1,.5,.03) #acquiring the negative log likelihood value
This function will calculate the negative log likelihood value when the vector of binomial random variables and vector of corresponding frequencies are given with the input parameters.
NegLLCorrBin(x,freq,p,cov)NegLLCorrBin(x,freq,p,cov)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
p |
single value for probability of success. |
cov |
single value for covariance. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of NegLLCorrBin will produce a single numeric value.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506. Morel JG, Neerchal NK (2012). Overdispersion models in SAS. SAS Publishing.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLCorrBin(No.D.D,Obs.fre.1,.5,.03) #acquiring the negative log likelihood valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLCorrBin(No.D.D,Obs.fre.1,.5,.03) #acquiring the negative log likelihood value
This function will calculate the Negative Log Likelihood value when the vector of binomial random variables and vector of corresponding frequencies are given with the shape parameters l and c.
NegLLGammaBin(x,freq,c,l)NegLLGammaBin(x,freq,c,l)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
c |
single value for shape parameter c. |
l |
single value for shape parameter l. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of NegLLGammaBin will produce a single numeric value.
Grassia A (1977). “On a family of distributions with argument between 0 and 1 obtained by transformation of the gamma and derived compound distributions.” Australian Journal of Statistics, 19(2), 108–114.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLGammaBin(No.D.D,Obs.fre.1,.3,.4) #acquiring the negative log likelihood valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLGammaBin(No.D.D,Obs.fre.1,.3,.4) #acquiring the negative log likelihood value
This function will calculate the negative log likelihood value when the vector of binomial random variables and vector of corresponding frequencies are given with the shape parameters a,b and c.
NegLLGHGBB(x,freq,a,b,c)NegLLGHGBB(x,freq,a,b,c)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing a. |
b |
single value for shape parameter beta representing b. |
c |
single value for shape parameter lambda representing c. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of NegLLGHGBB will produce a single numeric value.
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2007). “A generalization of the beta–binomial distribution.” Journal of the Royal Statistical Society Series C: Applied Statistics, 56(1), 51–61. Pearson JW (2009). Computation of hypergeometric functions. Ph.D. thesis, University of Oxford.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLGHGBB(No.D.D,Obs.fre.1,.2,.3,1) #acquiring the negative log likelihood valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLGHGBB(No.D.D,Obs.fre.1,.2,.3,1) #acquiring the negative log likelihood value
This function will calculate the Negative Log Likelihood value when the vector of binomial random variables and vector of corresponding frequencies are given with the shape parameters l and c.
NegLLGrassiaIIBin(x,freq,a,b)NegLLGrassiaIIBin(x,freq,a,b)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
a |
single value for shape parameter a. |
b |
single value for shape parameter b. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of NegLLGrassiaIIBin will produce a single numeric value.
Grassia A (1977). “On a family of distributions with argument between 0 and 1 obtained by transformation of the gamma and derived compound distributions.” Australian Journal of Statistics, 19(2), 108–114.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLGrassiaIIBin(No.D.D,Obs.fre.1,.3,.4) #acquiring the negative log likelihood valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLGrassiaIIBin(No.D.D,Obs.fre.1,.3,.4) #acquiring the negative log likelihood value
This function will calculate the Negative Log Likelihood value when the vector of binomial random variables and vector of corresponding frequencies are given with the shape parameters a and b and iterations it.
NegLLKumBin(x,freq,a,b,it=25000)NegLLKumBin(x,freq,a,b,it=25000)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
it |
number of iterations to converge as a proper probability function replacing infinity. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of NegLLKumBin will produce a single numeric value.
Xiaohu L, Yanyan H, Xueyan Z (2011). “The Kumaraswamy binomial distribution.” Chinese Journal of Applied Probability and Statistics, 27(5), 511–521.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: NegLLKumBin(No.D.D,Obs.fre.1,1.3,4.4) #acquiring the negative log likelihood value ## End(Not run)No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies ## Not run: NegLLKumBin(No.D.D,Obs.fre.1,1.3,4.4) #acquiring the negative log likelihood value ## End(Not run)
This function will calculate the negative log likelihood value when the vector of binomial random variable and vector of corresponding frequencies are given with the input parameters.
NegLLLMBin(x,freq,p,phi)NegLLLMBin(x,freq,p,phi)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
p |
single value for probability of success. |
phi |
single value for phi parameter. |
The output of NegLLLMBin will produce a single numeric value.
Elamir EA (2013). “Multiplicative-Binomial Distribution: Some Results on Characterization, Inference and Random Data Generation.” Journal of Statistical Theory and Applications, 12(1), 92–105.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLLMBin(No.D.D,Obs.fre.1,.5,3) #acquiring the negative log likelihood valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLLMBin(No.D.D,Obs.fre.1,.5,3) #acquiring the negative log likelihood value
This function will calculate the negative log likelihood value when the vector of binomial random variables and vector of corresponding frequencies are given with the shape parameters a,b and c.
NegLLMcGBB(x,freq,a,b,c)NegLLMcGBB(x,freq,a,b,c)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
c |
single value for shape parameter gamma representing as c. |
The output of NegLLMcGBB will produce a single numeric value.
Manoj C, Wijekoon P, Yapa RD (2013). “The McDonald generalized beta-binomial distribution: A new binomial mixture distribution and simulation based comparison with its nested distributions in handling overdispersion.” International journal of statistics and probability, 2(2), 24. Janiffer NM, Islam A, Luke O, others (2014). “Estimating Equations for Estimation of Mcdonald Generalized Beta—Binomial Parameters.” Open Journal of Statistics, 4(09), 702. Roozegar R, Tahmasebi S, Jafari AA (2017). “The McDonald Gompertz distribution: properties and applications.” Communications in Statistics-Simulation and Computation, 46(5), 3341–3355.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLMcGBB(No.D.D,Obs.fre.1,.2,.3,1) #acquiring the negative log likelihood valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLMcGBB(No.D.D,Obs.fre.1,.2,.3,1) #acquiring the negative log likelihood value
This function will calculate the negative log likelihood value when the vector of binomial random variable and vector of corresponding frequencies are given with the input parameters.
NegLLMultiBin(x,freq,p,theta)NegLLMultiBin(x,freq,p,theta)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
p |
single value for probability of success. |
theta |
single value for theta parameter. |
The output of NegLLMultiBin will produce a single numeric value.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506.
No.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLMultiBin(No.D.D,Obs.fre.1,.5,3) #acquiring the negative log likelihood valueNo.D.D <- 0:7 #assigning the random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLMultiBin(No.D.D,Obs.fre.1,.5,3) #acquiring the negative log likelihood value
This function will calculate the Negative Log Likelihood value when the vector of binomial random variables and vector of corresponding frequencies are given with the mode value.
NegLLTriBin(x,freq,mode)NegLLTriBin(x,freq,mode)
x |
vector of binomial random variables. |
freq |
vector of frequencies. |
mode |
single value for mode. |
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of NegLLTriBin will produce a single numeric value.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Karlis D, Xekalaki E (2008). The polygonal distribution. Springer. Okagbue HI, Edeki SO, Opanuga AA, Oguntunde PE, Adeosun ME (2014). “Using the Average of the Extreme Values of a Triangular Distribution for a Transformation, and Its Approximant via the Continuous Uniform Distribution.” British Journal of Mathematics and Computer Science, 4(24), 3497.
No.D.D <- 0:7 #assigning the Random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLTriBin(No.D.D,Obs.fre.1,.023) #acquiring the Negative log likelihood valueNo.D.D <- 0:7 #assigning the Random variables Obs.fre.1 <- c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies NegLLTriBin(No.D.D,Obs.fre.1,.023) #acquiring the Negative log likelihood value
After fitting the distribution using this function we can extract the overdispersion value. This function works for fitTriBin, fitBetaBin, fitKumBin, fitGHGBB and fitMcGBB for Binomial Mixture Distributions. Similarly, Alternate Binomial Distributions also support this function for fitAddBin,fitBetaCorrBin, fitCOMPBin, fitCorrBin and fitMultiBin.
Overdispersion(object)Overdispersion(object)
object |
An object from one of the classes of fitTB,fitBB,fitKB,fitGB,fitMB. |
Note : Only objects from classes of above mentioned classes can be used.
The output of Overdispersion gives a single value which is the
overdispersion.
No.D.D=0:7 #assigning the random variables Obs.fre.1=c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating mode value for given data results<-EstMLETriBin(No.D.D,Obs.fre.1) results mode<-results$mode #fitting the Triangular Bionomial distribution for estimated parameters TriBin<-fitTriBin(No.D.D,Obs.fre.1,mode) TriBin #extracting the overdispersion Overdispersion(TriBin)No.D.D=0:7 #assigning the random variables Obs.fre.1=c(47,54,43,40,40,41,39,95) #assigning the corresponding frequencies #estimating mode value for given data results<-EstMLETriBin(No.D.D,Obs.fre.1) results mode<-results$mode #fitting the Triangular Bionomial distribution for estimated parameters TriBin<-fitTriBin(No.D.D,Obs.fre.1,mode) TriBin #extracting the overdispersion Overdispersion(TriBin)
These functions provide the ability for generating probability function values and cumulative probability function values for the Additive Binomial Distribution.
pAddBin(x,n,p,alpha)pAddBin(x,n,p,alpha)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
p |
single value for probability of success. |
alpha |
single value for alpha parameter. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
The alpha is in between
The mean and the variance are denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pAddBin gives cumulative probability values in vector form.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506. Morel JG, Neerchal NK (2012). Overdispersion models in SAS. SAS Publishing.
#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Additive 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,dAddBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dAddBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dAddBin(0:10,10,0.58,0.022)$pdf #extracting the probability values dAddBin(0:10,10,0.58,0.022)$mean #extracting the mean dAddBin(0:10,10,0.58,0.022)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Additive 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,pAddBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pAddBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pAddBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Additive 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,dAddBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dAddBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dAddBin(0:10,10,0.58,0.022)$pdf #extracting the probability values dAddBin(0:10,10,0.58,0.022)$mean #extracting the mean dAddBin(0:10,10,0.58,0.022)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Additive 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,pAddBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pAddBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pAddBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Beta Distribution bounded between [0,1].
pBETA(p,a,b)pBETA(p,a,b)
p |
vector of probabilities. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
The probability density function and cumulative density function of a unit bounded beta distribution with random variable P are given by
;
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as is
incomplete beta integrals and is the beta function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pBETA gives the cumulative density values in vector form.
Johnson NL, Kotz S, Balakrishnan N (1995). Continuous univariate distributions, volume 2, volume 289. John wiley and sons. Trenkler G (1996). “Continuous univariate distributions.” Computational Statistics and Data Analysis, 21(1), 119–119.
or
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Beta.html
#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dBETA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dBETA(seq(0,1,by=0.01),2,3)$pdf #extracting the pdf values dBETA(seq(0,1,by=0.01),2,3)$mean #extracting the mean dBETA(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pBETA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pBETA(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazBETA(1.4,3,2) #acquiring the moment about zero values mazBETA(2,3,2)-mazBETA(1,3,2)^2 #acquiring the variance for a=3,b=2 #only the integer value of moments is taken here because moments cannot be decimal mazBETA(1.9,5.5,6)#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dBETA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dBETA(seq(0,1,by=0.01),2,3)$pdf #extracting the pdf values dBETA(seq(0,1,by=0.01),2,3)$mean #extracting the mean dBETA(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pBETA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pBETA(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazBETA(1.4,3,2) #acquiring the moment about zero values mazBETA(2,3,2)-mazBETA(1,3,2)^2 #acquiring the variance for a=3,b=2 #only the integer value of moments is taken here because moments cannot be decimal mazBETA(1.9,5.5,6)
These functions provide the ability for generating probability function values and cumulative probability function values for the Beta-Binomial Distribution.
pBetaBin(x,n,a,b)pBetaBin(x,n,a,b)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
Mixing Beta distribution with Binomial distribution will create the Beta-Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
Defined as B(a,b) is the beta function.
The output of pBetaBin gives cumulative probability values in vector form.
Young-Xu Y, Chan KA (2008). “Pooling overdispersed binomial data to estimate event rate.” BMC medical research methodology, 8, 1–12. Trenkler G (1996). “Continuous univariate distributions.” Computational Statistics and Data Analysis, 21(1), 119–119. HUGHES G, MADDEN L (1993). “Using the beta-binomial distribution to describe aggegated patterns of disease incidence.” Phytopathology, 83(7), 759–763.
#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.2) plot(0,0,main="Beta-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,dBetaBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dBetaBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } dBetaBin(0:10,10,4,.2)$pdf #extracting the pdf values dBetaBin(0:10,10,4,.2)$mean #extracting the mean dBetaBin(0:10,10,4,.2)$var #extracting the variance dBetaBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pBetaBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pBetaBin(0:10,10,a[i],a[i]),col = col[i]) } pBetaBin(0:10,10,4,.2) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.2) plot(0,0,main="Beta-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,dBetaBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dBetaBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } dBetaBin(0:10,10,4,.2)$pdf #extracting the pdf values dBetaBin(0:10,10,4,.2)$mean #extracting the mean dBetaBin(0:10,10,4,.2)$var #extracting the variance dBetaBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pBetaBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pBetaBin(0:10,10,a[i],a[i]),col = col[i]) } pBetaBin(0:10,10,4,.2) #acquiring the cumulative probability values
These functions provide the ability for generating probability function values and cumulative probability function values for the Beta-Correlated Binomial Distribution.
pBetaCorrBin(x,n,cov,a,b)pBetaCorrBin(x,n,cov,a,b)
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. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
The Correlation is in between
where
The mean and the variance are denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pBetaCorrBin gives cumulative probability values in vector form.
Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506.
#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#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
These functions provide the ability for generating probability function values and cumulative probability function values for the COM Poisson Binomial Distribution.
pCOMPBin(x,n,p,v)pCOMPBin(x,n,p,v)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
p |
single value for probability of success. |
v |
single value for v. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pCOMPBin gives cumulative probability values in vector form.
Borges P, Rodrigues J, Balakrishnan N, Bazan J (2014). “A COM–Poisson type generalization of the binomial distribution and its properties and applications.” Statistics and Probability Letters, 87, 158–166.
#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="COM Poisson 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,dCOMPBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dCOMPBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dCOMPBin(0:10,10,0.58,0.022)$pdf #extracting the pdf values dCOMPBin(0:10,10,0.58,0.022)$mean #extracting the mean dCOMPBin(0:10,10,0.58,0.022)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="COM Poisson 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,pCOMPBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pCOMPBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pCOMPBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="COM Poisson 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,dCOMPBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dCOMPBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dCOMPBin(0:10,10,0.58,0.022)$pdf #extracting the pdf values dCOMPBin(0:10,10,0.58,0.022)$mean #extracting the mean dCOMPBin(0:10,10,0.58,0.022)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="COM Poisson 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,pCOMPBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pCOMPBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pCOMPBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values
These functions provide the ability for generating probability function values and cumulative probability function values for the Correlated Binomial Distribution.
pCorrBin(x,n,p,cov)pCorrBin(x,n,p,cov)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
p |
single value for probability of success. |
cov |
single value for covariance. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
The Correlation is in between
where
The mean and the variance are denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pCorrBin gives cumulative probability values in vector form.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506. Morel JG, Neerchal NK (2012). Overdispersion models in SAS. SAS Publishing.
#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="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,dCorrBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dCorrBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dCorrBin(0:10,10,0.58,0.022)$pdf #extracting the pdf values dCorrBin(0:10,10,0.58,0.022)$mean #extracting the mean dCorrBin(0:10,10,0.58,0.022)$var #extracting the variance dCorrBin(0:10,10,0.58,0.022)$corr #extracting the correlation dCorrBin(0:10,10,0.58,0.022)$mincorr #extracting the minimum correlation value dCorrBin(0:10,10,0.58,0.022)$maxcorr #extracting the maximum correlation value #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="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,pCorrBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pCorrBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pCorrBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="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,dCorrBin(0:10,10,a[i],b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dCorrBin(0:10,10,a[i],b[i])$pdf,col = col[i],pch=16) } dCorrBin(0:10,10,0.58,0.022)$pdf #extracting the pdf values dCorrBin(0:10,10,0.58,0.022)$mean #extracting the mean dCorrBin(0:10,10,0.58,0.022)$var #extracting the variance dCorrBin(0:10,10,0.58,0.022)$corr #extracting the correlation dCorrBin(0:10,10,0.58,0.022)$mincorr #extracting the minimum correlation value dCorrBin(0:10,10,0.58,0.022)$maxcorr #extracting the maximum correlation value #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="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,pCorrBin(0:10,10,a[i],b[i]),col = col[i],lwd=2.85) points(0:10,pCorrBin(0:10,10,a[i],b[i]),col = col[i],pch=16) } pCorrBin(0:10,10,0.58,0.022) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for Gamma Distribution bounded between [0,1].
pGAMMA(p,c,l)pGAMMA(p,c,l)
p |
vector of probabilities. |
c |
single value for shape parameter c. |
l |
single value for shape parameter l. |
The probability density function and cumulative density function of a unit bounded Gamma distribution with random variable P are given by
;
;
The mean the variance are denoted by
The moments about zero is denoted as
Defined as is the gamma function.
Defined as is the Lower incomplete gamma function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pGAMMA gives the cumulative density values in vector form.
Olshen AC (1938). “Transformations of the pearson type III distribution.” The Annals of Mathematical Statistics, 9(3), 176–200.
#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dGAMMA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dGAMMA(seq(0,1,by=0.01),5,6)$pdf #extracting the pdf values dGAMMA(seq(0,1,by=0.01),5,6)$mean #extracting the mean dGAMMA(seq(0,1,by=0.01),5,6)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pGAMMA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pGAMMA(seq(0,1,by=0.01),5,6) #acquiring the cumulative probability values mazGAMMA(1.4,5,6) #acquiring the moment about zero values mazGAMMA(2,5,6)-mazGAMMA(1,5,6)^2 #acquiring the variance for a=5,b=6 #only the integer value of moments is taken here because moments cannot be decimal mazGAMMA(1.9,5.5,6)#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,4)) for (i in 1:4) { lines(seq(0,1,by=0.01),dGAMMA(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dGAMMA(seq(0,1,by=0.01),5,6)$pdf #extracting the pdf values dGAMMA(seq(0,1,by=0.01),5,6)$mean #extracting the mean dGAMMA(seq(0,1,by=0.01),5,6)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pGAMMA(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pGAMMA(seq(0,1,by=0.01),5,6) #acquiring the cumulative probability values mazGAMMA(1.4,5,6) #acquiring the moment about zero values mazGAMMA(2,5,6)-mazGAMMA(1,5,6)^2 #acquiring the variance for a=5,b=6 #only the integer value of moments is taken here because moments cannot be decimal mazGAMMA(1.9,5.5,6)
These functions provide the ability for generating probability function values and cumulative probability function values for the Gamma Binomial Distribution.
pGammaBin(x,n,c,l)pGammaBin(x,n,c,l)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
c |
single value for shape parameter c. |
l |
single value for shape parameter l. |
Mixing Gamma distribution with Binomial distribution will create the the Gamma Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
The output of pGammaBin gives cumulative probability values in vector form.
Grassia A (1977). “On a family of distributions with argument between 0 and 1 obtained by transformation of the gamma and derived compound distributions.” Australian Journal of Statistics, 19(2), 108–114.
#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.2) plot(0,0,main="Gamma-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,dGammaBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dGammaBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } dGammaBin(0:10,10,4,.2)$pdf #extracting the pdf values dGammaBin(0:10,10,4,.2)$mean #extracting the mean dGammaBin(0:10,10,4,.2)$var #extracting the variance dGammaBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pGammaBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pGammaBin(0:10,10,a[i],a[i]),col = col[i]) } pGammaBin(0:10,10,4,.2) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.2) plot(0,0,main="Gamma-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,dGammaBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dGammaBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } dGammaBin(0:10,10,4,.2)$pdf #extracting the pdf values dGammaBin(0:10,10,4,.2)$mean #extracting the mean dGammaBin(0:10,10,4,.2)$var #extracting the variance dGammaBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pGammaBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pGammaBin(0:10,10,a[i],a[i]),col = col[i]) } pGammaBin(0:10,10,4,.2) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Generalized Beta Type-1 Distribution bounded between [0,1].
pGBeta1(p,a,b,c)pGBeta1(p,a,b,c)
p |
vector of probabilities. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
c |
single value for shape parameter gamma representing as c. |
The probability density function and cumulative density function of a unit bounded Generalized Beta Type-1 Distribution with random variable P are given by
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as is Beta function.
Defined as is Gaussian Hypergeometric function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output pGBeta1 gives the cumulative density values in vector form.
Manoj C, Wijekoon P, Yapa RD (2013). “The McDonald generalized beta-binomial distribution: A new binomial mixture distribution and simulation based comparison with its nested distributions in handling overdispersion.” International journal of statistics and probability, 2(2), 24. Janiffer NM, Islam A, Luke O, others (2014). “Estimating Equations for Estimation of Mcdonald Generalized Beta—Binomial Parameters.” Open Journal of Statistics, 4(09), 702. Roozegar R, Tahmasebi S, Jafari AA (2017). “The McDonald Gompertz distribution: properties and applications.” Communications in Statistics-Simulation and Computation, 46(5), 3341–3355.
#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGBeta1(seq(0,1,by=0.001),a[i],1,2*a[i])$pdf,col = col[i]) } dGBeta1(seq(0,1,by=0.01),2,3,1)$pdf #extracting the pdf values dGBeta1(seq(0,1,by=0.01),2,3,1)$mean #extracting the mean dGBeta1(seq(0,1,by=0.01),2,3,1)$var #extracting the variance pGBeta1(0.04,2,3,4) #acquiring the cdf values for a=2,b=3,c=4 mazGBeta1(1.4,3,2,2) #acquiring the moment about zero values mazGBeta1(2,3,2,2)-mazGBeta1(1,3,2,2)^2 #acquiring the variance for a=3,b=2,c=2 #only the integer value of moments is taken here because moments cannot be decimal mazGBeta1(3.2,3,2,2)#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGBeta1(seq(0,1,by=0.001),a[i],1,2*a[i])$pdf,col = col[i]) } dGBeta1(seq(0,1,by=0.01),2,3,1)$pdf #extracting the pdf values dGBeta1(seq(0,1,by=0.01),2,3,1)$mean #extracting the mean dGBeta1(seq(0,1,by=0.01),2,3,1)$var #extracting the variance pGBeta1(0.04,2,3,4) #acquiring the cdf values for a=2,b=3,c=4 mazGBeta1(1.4,3,2,2) #acquiring the moment about zero values mazGBeta1(2,3,2,2)-mazGBeta1(1,3,2,2)^2 #acquiring the variance for a=3,b=2,c=2 #only the integer value of moments is taken here because moments cannot be decimal mazGBeta1(3.2,3,2,2)
These functions provide the ability for generating probability function values and cumulative probability function values for the Gaussian Hypergeometric Generalized Beta Binomial distribution.
pGHGBB(x,n,a,b,c)pGHGBB(x,n,a,b,c)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
a |
single value for shape parameter alpha value representing a. |
b |
single value for shape parameter beta value representing b. |
c |
single value for shape parameter lambda value representing c. |
Mixing Gaussian Hypergeometric Generalized Beta distribution with Binomial distribution will create the Gaussian Hypergeometric Generalized Beta Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
Defined as is the beta function.
Defined as is the Gaussian Hypergeometric function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pGHGBB gives cumulative probability function values in vector form.
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2007). “A generalization of the beta–binomial distribution.” Journal of the Royal Statistical Society Series C: Applied Statistics, 56(1), 51–61. Pearson JW (2009). Computation of hypergeometric functions. Ph.D. thesis, University of Oxford.
#plotting the random variables and probability values col <- rainbow(6) a <- c(.1,.2,.3,1.5,2.1,3) plot(0,0,main="GHGBB probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,7),ylim = c(0,0.9)) for (i in 1:6) { lines(0:7,dGHGBB(0:7,7,1+a[i],0.3,1+a[i])$pdf,col = col[i],lwd=2.85) points(0:7,dGHGBB(0:7,7,1+a[i],0.3,1+a[i])$pdf,col = col[i],pch=16) } dGHGBB(0:7,7,1.3,0.3,1.3)$pdf #extracting the pdf values dGHGBB(0:7,7,1.3,0.3,1.3)$mean #extracting the mean dGHGBB(0:7,7,1.3,0.3,1.3)$var #extracting the variance dGHGBB(0:7,7,1.3,0.3,1.3)$over.dis.par #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,7),ylim = c(0,1)) for (i in 1:4) { lines(0:7,pGHGBB(0:7,7,1+a[i],0.3,1+a[i]),col = col[i]) points(0:7,pGHGBB(0:7,7,1+a[i],0.3,1+a[i]),col = col[i]) } pGHGBB(0:7,7,1.3,0.3,1.3) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(6) a <- c(.1,.2,.3,1.5,2.1,3) plot(0,0,main="GHGBB probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,7),ylim = c(0,0.9)) for (i in 1:6) { lines(0:7,dGHGBB(0:7,7,1+a[i],0.3,1+a[i])$pdf,col = col[i],lwd=2.85) points(0:7,dGHGBB(0:7,7,1+a[i],0.3,1+a[i])$pdf,col = col[i],pch=16) } dGHGBB(0:7,7,1.3,0.3,1.3)$pdf #extracting the pdf values dGHGBB(0:7,7,1.3,0.3,1.3)$mean #extracting the mean dGHGBB(0:7,7,1.3,0.3,1.3)$var #extracting the variance dGHGBB(0:7,7,1.3,0.3,1.3)$over.dis.par #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,7),ylim = c(0,1)) for (i in 1:4) { lines(0:7,pGHGBB(0:7,7,1+a[i],0.3,1+a[i]),col = col[i]) points(0:7,pGHGBB(0:7,7,1+a[i],0.3,1+a[i]),col = col[i]) } pGHGBB(0:7,7,1.3,0.3,1.3) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Gaussian Hypergeometric Generalized Beta distribution bounded between [0,1].
pGHGBeta(p,n,a,b,c)pGHGBeta(p,n,a,b,c)
p |
vector of probabilities. |
n |
single value for no of binomial trials. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
c |
single value for shape parameter lambda representing as c. |
The probability density function and cumulative density function of a unit bounded Gaussian Hypergeometric Generalized Beta Distribution with random variable P are given by
;
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as as the beta function.
Defined as as the Gaussian Hypergeometric function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pGHGBeta gives the cumulative density values in vector form.
Rodriguez-Avi J, Conde-Sanchez A, Saez-Castillo AJ, Olmo-Jimenez MJ (2007). “A generalization of the beta–binomial distribution.” Journal of the Royal Statistical Society Series C: Applied Statistics, 56(1), 51–61. Pearson JW (2009). Computation of hypergeometric functions. Ph.D. thesis, University of Oxford.
#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGHGBeta(seq(0,1,by=0.001),7,1+a[i],0.3,1+a[i])$pdf,col = col[i]) } dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$pdf #extracting the pdf values dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$mean #extracting the mean dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(6) a <- c(.1,.2,.3,1.5,2.1,3) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:6) { lines(seq(0.01,1,by=0.001),pGHGBeta(seq(0.01,1,by=0.001),7,1+a[i],0.3,1+a[i]),col=col[i]) } pGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659) #acquiring the cumulative probability values mazGHGBeta(1.4,7,1.6312,0.3913,0.6659) #acquiring the moment about zero values #acquiring the variance for a=1.6312,b=0.3913,c=0.6659 mazGHGBeta(2,7,1.6312,0.3913,0.6659)-mazGHGBeta(1,7,1.6312,0.3913,0.6659)^2 #only the integer value of moments is taken here because moments cannot be decimal mazGHGBeta(1.9,15,5,6,1)#plotting the random variables and probability values col <- rainbow(5) a <- c(.1,.2,.3,1.5,2.15) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,10)) for (i in 1:5) { lines(seq(0,1,by=0.001),dGHGBeta(seq(0,1,by=0.001),7,1+a[i],0.3,1+a[i])$pdf,col = col[i]) } dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$pdf #extracting the pdf values dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$mean #extracting the mean dGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(6) a <- c(.1,.2,.3,1.5,2.1,3) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:6) { lines(seq(0.01,1,by=0.001),pGHGBeta(seq(0.01,1,by=0.001),7,1+a[i],0.3,1+a[i]),col=col[i]) } pGHGBeta(seq(0,1,by=0.01),7,1.6312,0.3913,0.6659) #acquiring the cumulative probability values mazGHGBeta(1.4,7,1.6312,0.3913,0.6659) #acquiring the moment about zero values #acquiring the variance for a=1.6312,b=0.3913,c=0.6659 mazGHGBeta(2,7,1.6312,0.3913,0.6659)-mazGHGBeta(1,7,1.6312,0.3913,0.6659)^2 #only the integer value of moments is taken here because moments cannot be decimal mazGHGBeta(1.9,15,5,6,1)
These functions provide the ability for generating probability function values and cumulative probability function values for the Grassia-II-Binomial Distribution.
pGrassiaIIBin(x,n,a,b)pGrassiaIIBin(x,n,a,b)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
a |
single value for shape parameter a. |
b |
single value for shape parameter b. |
Mixing Gamma distribution with Binomial distribution will create the the Grassia-II-Binomial distribution, only when (1-p)=e^(-lambda) of the Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
The output of pGrassiaIIBin gives cumulative probability values in vector form.
Grassia A (1977). “On a family of distributions with argument between 0 and 1 obtained by transformation of the gamma and derived compound distributions.” Australian Journal of Statistics, 19(2), 108–114.
#plotting the random variables and probability values col <- rainbow(5) a <- c(0.3,0.4,0.5,0.6,0.8) plot(0,0,main="Grassia II 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,dGrassiaIIBin(0:10,10,2*a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dGrassiaIIBin(0:10,10,2*a[i],a[i])$pdf,col = col[i],pch=16) } dGrassiaIIBin(0:10,10,4,.2)$pdf #extracting the pdf values dGrassiaIIBin(0:10,10,4,.2)$mean #extracting the mean dGrassiaIIBin(0:10,10,4,.2)$var #extracting the variance dGrassiaIIBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(0.3,0.4,0.5,0.6) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pGrassiaIIBin(0:10,10,2*a[i],a[i]),col = col[i]) points(0:10,pGrassiaIIBin(0:10,10,2*a[i],a[i]),col = col[i]) } pGrassiaIIBin(0:10,10,4,.2) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(0.3,0.4,0.5,0.6,0.8) plot(0,0,main="Grassia II 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,dGrassiaIIBin(0:10,10,2*a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dGrassiaIIBin(0:10,10,2*a[i],a[i])$pdf,col = col[i],pch=16) } dGrassiaIIBin(0:10,10,4,.2)$pdf #extracting the pdf values dGrassiaIIBin(0:10,10,4,.2)$mean #extracting the mean dGrassiaIIBin(0:10,10,4,.2)$var #extracting the variance dGrassiaIIBin(0:10,10,4,.2)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(0.3,0.4,0.5,0.6) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pGrassiaIIBin(0:10,10,2*a[i],a[i]),col = col[i]) points(0:10,pGrassiaIIBin(0:10,10,2*a[i],a[i]),col = col[i]) } pGrassiaIIBin(0:10,10,4,.2) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moment about zero values for the Kumaraswamy Distribution bounded between [0,1].
pKUM(p,a,b)pKUM(p,a,b)
p |
vector of probabilities. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
The probability density function and cumulative density function of a unit bounded Kumaraswamy Distribution with random variable P are given by
;
;
The mean and the variance are denoted by
The moments about zero is denoted as
Defined as is the beta function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pKUM gives the cumulative density values in vector form.
Kumaraswamy P (1980). “A generalized probability density function for double-bounded random processes.” Journal of hydrology, 46(1-2), 79–88. Jones MC (2009). “Kumaraswamy’s distribution: A beta-type distribution with some tractability advantages.” Statistical methodology, 6(1), 70–81.
#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,6)) for (i in 1:4) { lines(seq(0,1,by=0.01),dKUM(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dKUM(seq(0,1,by=0.01),2,3)$pdf #extracting the probability values dKUM(seq(0,1,by=0.01),2,3)$mean #extracting the mean dKUM(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pKUM(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pKUM(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazKUM(1.4,3,2) #acquiring the moment about zero values mazKUM(2,2,3)-mazKUM(1,2,3)^2 #acquiring the variance for a=2,b=3 #only the integer value of moments is taken here because moments cannot be decimal mazKUM(1.9,5.5,6)#plotting the random variables and probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Probability density graph",xlab="Random variable",ylab="Probability density values", xlim = c(0,1),ylim = c(0,6)) for (i in 1:4) { lines(seq(0,1,by=0.01),dKUM(seq(0,1,by=0.01),a[i],a[i])$pdf,col = col[i]) } dKUM(seq(0,1,by=0.01),2,3)$pdf #extracting the probability values dKUM(seq(0,1,by=0.01),2,3)$mean #extracting the mean dKUM(seq(0,1,by=0.01),2,3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative density graph",xlab="Random variable",ylab="Cumulative density values", xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pKUM(seq(0,1,by=0.01),a[i],a[i]),col = col[i]) } pKUM(seq(0,1,by=0.01),2,3) #acquiring the cumulative probability values mazKUM(1.4,3,2) #acquiring the moment about zero values mazKUM(2,2,3)-mazKUM(1,2,3)^2 #acquiring the variance for a=2,b=3 #only the integer value of moments is taken here because moments cannot be decimal mazKUM(1.9,5.5,6)
These functions provide the ability for generating probability function values and cumulative probability function values for the Kumaraswamy Binomial Distribution.
pKumBin(x,n,a,b,it=25000)pKumBin(x,n,a,b,it=25000)
x |
vector of binomial random variables. |
n |
single value for no of binomial trial. |
a |
single value for shape parameter alpha representing a. |
b |
single value for shape parameter beta representing b. |
it |
number of iterations to converge as a proper probability function replacing infinity. |
Mixing Kumaraswamy distribution with Binomial distribution will create the Kumaraswamy Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
Defined as is the beta function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pKumBin gives cumulative probability values in vector form.
Xiaohu L, Yanyan H, Xueyan Z (2011). “The Kumaraswamy binomial distribution.” Chinese Journal of Applied Probability and Statistics, 27(5), 511–521.
## Not run: #plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,.85) plot(0,0,main="Kumaraswamy 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,dKumBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dKumBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } ## End(Not run) dKumBin(0:10,10,4,2)$pdf #extracting the pdf values dKumBin(0:10,10,4,2)$mean #extracting the mean dKumBin(0:10,10,4,2)$var #extracting the variance dKumBin(0:10,10,4,2)$over.dis.para #extracting the over dispersion value ## Not run: #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(1,2,5,10,.85) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:5) { lines(0:10,pKumBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pKumBin(0:10,10,a[i],a[i]),col = col[i]) } ## End(Not run) pKumBin(0:10,10,4,2) #acquiring the cumulative probability values## Not run: #plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,.85) plot(0,0,main="Kumaraswamy 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,dKumBin(0:10,10,a[i],a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dKumBin(0:10,10,a[i],a[i])$pdf,col = col[i],pch=16) } ## End(Not run) dKumBin(0:10,10,4,2)$pdf #extracting the pdf values dKumBin(0:10,10,4,2)$mean #extracting the mean dKumBin(0:10,10,4,2)$var #extracting the variance dKumBin(0:10,10,4,2)$over.dis.para #extracting the over dispersion value ## Not run: #plotting the random variables and cumulative probability values col <- rainbow(5) a <- c(1,2,5,10,.85) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:5) { lines(0:10,pKumBin(0:10,10,a[i],a[i]),col = col[i]) points(0:10,pKumBin(0:10,10,a[i],a[i]),col = col[i]) } ## End(Not run) pKumBin(0:10,10,4,2) #acquiring the cumulative probability values
Cochran(1936) provided a data that comprise the number of tomato spotted wilt virus(TSWV) infected tomato plants in the field trials in Australia. The field map was divided into 160 'quadrats'. 9 tomato plants in each quadrat. then the numbers of TSWV infected tomato plants were counted in each quadrat. Number of infected plants out of 9 plants per quadrat can be treated as a binomial variable. the collection of all such responses from all 160 quadrats would form "binomial outcome data" below provided is a data set similar to Cochran plant disease incidence data. Marcus R(1984). orange trees infected with citrus tristeza virus (CTV) in an orchard in central Israel. We divided the field map into 84 "quadrats" of 4 rows x 3 columns and counted the total number (1981 + 1982) of infected trees out of a maximum of n = 12 in each quadrat
Plant_DiseaseDataPlant_DiseaseData
A data frame with 2 columns and 10 rows
Dis.plantDiseased Plants
freObserved frequencies
Extracted from
Hughes, G., 1993. Using the Beta-Binomial Distribution to Describe Aggregated Patterns of Disease Incidence. Phytopathology, 83(9), p.759.
Available at: doi:10.1094/Phyto-83-759.
Plant_DiseaseData$Dis.plant # extracting the binomial random variables sum(Plant_DiseaseData$fre) # summing all the frequenciesPlant_DiseaseData$Dis.plant # extracting the binomial random variables sum(Plant_DiseaseData$fre) # summing all the frequencies
These functions provide the ability for generating probability function values and cumulative probability function values for the Lovinson Multiplicative Binomial Distribution.
pLMBin(x,n,p,phi)pLMBin(x,n,p,phi)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
p |
single value for probability of success. |
phi |
single value for phi. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
here is
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pLMBin gives cumulative probability values in vector form.
Elamir EA (2013). “Multiplicative-Binomial Distribution: Some Results on Characterization, Inference and Random Data Generation.” Journal of Statistical Theory and Applications, 12(1), 92–105.
#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Lovinson Multiplicative 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,dLMBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dLMBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],pch=16) } dLMBin(0:10,10,.58,10.022)$pdf #extracting the pdf values dLMBin(0:10,10,.58,10.022)$mean #extracting the mean dLMBin(0:10,10,.58,10.022)$var #extracting the variance #plotting random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Lovinson Multiplicative 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,pLMBin(0:10,10,a[i],1+b[i]),col = col[i],lwd=2.85) points(0:10,pLMBin(0:10,10,a[i],1+b[i]),col = col[i],pch=16) } pLMBin(0:10,10,.58,10.022) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Lovinson Multiplicative 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,dLMBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dLMBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],pch=16) } dLMBin(0:10,10,.58,10.022)$pdf #extracting the pdf values dLMBin(0:10,10,.58,10.022)$mean #extracting the mean dLMBin(0:10,10,.58,10.022)$var #extracting the variance #plotting random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Lovinson Multiplicative 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,pLMBin(0:10,10,a[i],1+b[i]),col = col[i],lwd=2.85) points(0:10,pLMBin(0:10,10,a[i],1+b[i]),col = col[i],pch=16) } pLMBin(0:10,10,.58,10.022) #acquiring the cumulative probability values
These functions provide the ability for generating probability function values and cumulative probability function values for the McDonald Generalized Beta Binomial Distribution.
pMcGBB(x,n,a,b,c)pMcGBB(x,n,a,b,c)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
a |
single value for shape parameter alpha representing as a. |
b |
single value for shape parameter beta representing as b. |
c |
single value for shape parameter gamma representing as c. |
Mixing Generalized Beta Type-1 Distribution with Binomial distribution the probability function value and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
The output of pMcGBB gives cumulative probability function values in vector form.
Manoj C, Wijekoon P, Yapa RD (2013). “The McDonald generalized beta-binomial distribution: A new binomial mixture distribution and simulation based comparison with its nested distributions in handling overdispersion.” International journal of statistics and probability, 2(2), 24. Janiffer NM, Islam A, Luke O, others (2014). “Estimating Equations for Estimation of Mcdonald Generalized Beta—Binomial Parameters.” Open Journal of Statistics, 4(09), 702. Roozegar R, Tahmasebi S, Jafari AA (2017). “The McDonald Gompertz distribution: properties and applications.” Communications in Statistics-Simulation and Computation, 46(5), 3341–3355.
#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.6) plot(0,0,main="Mcdonald generalized beta-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,dMcGBB(0:10,10,a[i],2.5,a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dMcGBB(0:10,10,a[i],2.5,a[i])$pdf,col = col[i],pch=16) } dMcGBB(0:10,10,4,2,1)$pdf #extracting the pdf values dMcGBB(0:10,10,4,2,1)$mean #extracting the mean dMcGBB(0:10,10,4,2,1)$var #extracting the variance dMcGBB(0:10,10,4,2,1)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pMcGBB(0:10,10,a[i],a[i],2),col = col[i]) points(0:10,pMcGBB(0:10,10,a[i],a[i],2),col = col[i]) } pMcGBB(0:10,10,4,2,1) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(1,2,5,10,0.6) plot(0,0,main="Mcdonald generalized beta-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,dMcGBB(0:10,10,a[i],2.5,a[i])$pdf,col = col[i],lwd=2.85) points(0:10,dMcGBB(0:10,10,a[i],2.5,a[i])$pdf,col = col[i],pch=16) } dMcGBB(0:10,10,4,2,1)$pdf #extracting the pdf values dMcGBB(0:10,10,4,2,1)$mean #extracting the mean dMcGBB(0:10,10,4,2,1)$var #extracting the variance dMcGBB(0:10,10,4,2,1)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(4) a <- c(1,2,5,10) plot(0,0,main="Cumulative probability function graph",xlab="Binomial random variable", ylab="Cumulative probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:4) { lines(0:10,pMcGBB(0:10,10,a[i],a[i],2),col = col[i]) points(0:10,pMcGBB(0:10,10,a[i],a[i],2),col = col[i]) } pMcGBB(0:10,10,4,2,1) #acquiring the cumulative probability values
These functions provide the ability for generating probability function values and cumulative probability function values for the Multiplicative Binomial Distribution.
pMultiBin(x,n,p,theta)pMultiBin(x,n,p,theta)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
p |
single value for probability of success. |
theta |
single value for theta. |
The probability function and cumulative function can be constructed and are denoted below
The cumulative probability function is the summation of probability function values.
here is
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pMultiBin gives cumulative probability values in vector form.
Johnson NL, Kemp AW, Kotz S (2005). Univariate discrete distributions, volume 444. John Wiley and Sons. Kupper LL, Haseman JK (1978). “The use of a correlated binomial model for the analysis of certain toxicological experiments.” Biometrics, 69–76. Paul SR (1985). “A three-parameter generalization of the binomial distribution.” History and Philosophy of Logic, 14(6), 1497–1506.
#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Multiplicative 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,dMultiBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dMultiBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],pch=16) } dMultiBin(0:10,10,.58,10.022)$pdf #extracting the pdf values dMultiBin(0:10,10,.58,10.022)$mean #extracting the mean dMultiBin(0:10,10,.58,10.022)$var #extracting the variance #plotting random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Multiplicative 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,pMultiBin(0:10,10,a[i],1+b[i]),col = col[i],lwd=2.85) points(0:10,pMultiBin(0:10,10,a[i],1+b[i]),col = col[i],pch=16) } pMultiBin(0:10,10,.58,10.022) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Multiplicative 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,dMultiBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],lwd=2.85) points(0:10,dMultiBin(0:10,10,a[i],1+b[i])$pdf,col = col[i],pch=16) } dMultiBin(0:10,10,.58,10.022)$pdf #extracting the pdf values dMultiBin(0:10,10,.58,10.022)$mean #extracting the mean dMultiBin(0:10,10,.58,10.022)$var #extracting the variance #plotting random variables and cumulative probability values col <- rainbow(5) a <- c(0.58,0.59,0.6,0.61,0.62) b <- c(0.022,0.023,0.024,0.025,0.026) plot(0,0,main="Multiplicative 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,pMultiBin(0:10,10,a[i],1+b[i]),col = col[i],lwd=2.85) points(0:10,pMultiBin(0:10,10,a[i],1+b[i]),col = col[i],pch=16) } pMultiBin(0:10,10,.58,10.022) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moments about zero values for the Triangular Distribution bounded between [0,1].
pTRI(p,mode)pTRI(p,mode)
p |
vector of probabilities. |
mode |
single value for mode. |
Setting and in the Triangular distribution
a unit bounded Triangular distribution can be obtained. The probability density function
and cumulative density function of a unit bounded Triangular distribution with random
variable P are given by
;
;
;
;
The mean and the variance are denoted by
Moments about zero is denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pTRI gives the cumulative density values in vector form.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Johnson NL, Kotz S, Balakrishnan N (1995). Continuous univariate distributions, volume 2, volume 289. John wiley and sons. Karlis D, Xekalaki E (2008). The polygonal distribution. Springer. Okagbue HI, Edeki SO, Opanuga AA, Oguntunde PE, Adeosun ME (2014). “Using the Average of the Extreme Values of a Triangular Distribution for a Transformation, and Its Approximant via the Continuous Uniform Distribution.” British Journal of Mathematics and Computer Science, 4(24), 3497.
#plotting the random variables and probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Probability density graph",xlab="Random variable", ylab="Probability density values",xlim = c(0,1),ylim = c(0,3)) for (i in 1:4) { lines(seq(0,1,by=0.01),dTRI(seq(0,1,by=0.01),x[i])$pdf,col = col[i]) } dTRI(seq(0,1,by=0.05),0.3)$pdf #extracting the pdf values dTRI(seq(0,1,by=0.01),0.3)$mean #extracting the mean dTRI(seq(0,1,by=0.01),0.3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Cumulative density graph",xlab="Random variable", ylab="Cumulative density values",xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pTRI(seq(0,1,by=0.01),x[i]),col = col[i]) } pTRI(seq(0,1,by=0.05),0.3) #acquiring the cumulative probability values mazTRI(1.4,.3) #acquiring the moment about zero values mazTRI(2,.3)-mazTRI(1,.3)^2 #variance for when is mode 0.3 #only the integer value of moments is taken here because moments cannot be decimal mazTRI(1.9,0.5)#plotting the random variables and probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Probability density graph",xlab="Random variable", ylab="Probability density values",xlim = c(0,1),ylim = c(0,3)) for (i in 1:4) { lines(seq(0,1,by=0.01),dTRI(seq(0,1,by=0.01),x[i])$pdf,col = col[i]) } dTRI(seq(0,1,by=0.05),0.3)$pdf #extracting the pdf values dTRI(seq(0,1,by=0.01),0.3)$mean #extracting the mean dTRI(seq(0,1,by=0.01),0.3)$var #extracting the variance #plotting the random variables and cumulative probability values col <- rainbow(4) x <- seq(0.2,0.8,by=0.2) plot(0,0,main="Cumulative density graph",xlab="Random variable", ylab="Cumulative density values",xlim = c(0,1),ylim = c(0,1)) for (i in 1:4) { lines(seq(0,1,by=0.01),pTRI(seq(0,1,by=0.01),x[i]),col = col[i]) } pTRI(seq(0,1,by=0.05),0.3) #acquiring the cumulative probability values mazTRI(1.4,.3) #acquiring the moment about zero values mazTRI(2,.3)-mazTRI(1,.3)^2 #variance for when is mode 0.3 #only the integer value of moments is taken here because moments cannot be decimal mazTRI(1.9,0.5)
These functions provide the ability for generating probability function values and cumulative probability function values for the Triangular Binomial distribution.
pTriBin(x,n,mode)pTriBin(x,n,mode)
x |
vector of binomial random variables |
n |
single value for no of binomial trials |
mode |
single value for mode |
Mixing unit bounded Triangular distribution with Binomial distribution will create Triangular Binomial distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
Defined as is incomplete beta integrals
and is the beta function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pTriBin gives cumulative probability function values in vector form.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Karlis D, Xekalaki E (2008). The polygonal distribution. Springer. Okagbue HI, Edeki SO, Opanuga AA, Oguntunde PE, Adeosun ME (2014). “Using the Average of the Extreme Values of a Triangular Distribution for a Transformation, and Its Approximant via the Continuous Uniform Distribution.” British Journal of Mathematics and Computer Science, 4(24), 3497.
#plotting the random variables and probability values col <- rainbow(7) x <- seq(0.1,0.7,by=0.1) plot(0,0,main="Triangular binomial probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,10),ylim = c(0,.3)) for (i in 1:7) { lines(0:10,dTriBin(0:10,10,x[i])$pdf,col = col[i],lwd=2.85) points(0:10,dTriBin(0:10,10,x[i])$pdf,col = col[i],pch=16) } dTriBin(0:10,10,.4)$pdf #extracting the pdf values dTriBin(0:10,10,.4)$mean #extracting the mean dTriBin(0:10,10,.4)$var #extracting the variance dTriBin(0:10,10,.4)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(7) x <- seq(0.1,0.7,by=0.1) plot(0,0,main="Triangular binomial probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:7) { lines(0:10,pTriBin(0:10,10,x[i]),col = col[i],lwd=2.85) points(0:10,pTriBin(0:10,10,x[i]),col = col[i],pch=16) } pTriBin(0:10,10,.4) #acquiring the cumulative probability values#plotting the random variables and probability values col <- rainbow(7) x <- seq(0.1,0.7,by=0.1) plot(0,0,main="Triangular binomial probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,10),ylim = c(0,.3)) for (i in 1:7) { lines(0:10,dTriBin(0:10,10,x[i])$pdf,col = col[i],lwd=2.85) points(0:10,dTriBin(0:10,10,x[i])$pdf,col = col[i],pch=16) } dTriBin(0:10,10,.4)$pdf #extracting the pdf values dTriBin(0:10,10,.4)$mean #extracting the mean dTriBin(0:10,10,.4)$var #extracting the variance dTriBin(0:10,10,.4)$over.dis.para #extracting the over dispersion value #plotting the random variables and cumulative probability values col <- rainbow(7) x <- seq(0.1,0.7,by=0.1) plot(0,0,main="Triangular binomial probability function graph",xlab="Binomial random variable", ylab="Probability function values",xlim = c(0,10),ylim = c(0,1)) for (i in 1:7) { lines(0:10,pTriBin(0:10,10,x[i]),col = col[i],lwd=2.85) points(0:10,pTriBin(0:10,10,x[i]),col = col[i],pch=16) } pTriBin(0:10,10,.4) #acquiring the cumulative probability values
These functions provide the ability for generating probability density values, cumulative probability density values and moments about zero values for the Uniform Distribution bounded between [0,1].
pUNI(p)pUNI(p)
p |
vector of probabilities. |
Setting and in the Uniform Distribution
a unit bounded Uniform Distribution can be obtained. The probability density function
and cumulative density function of a unit bounded Uniform Distribution with random
variable P are given by
The mean and the variance are denoted as
Moments about zero is denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pUNI gives the cumulative density values in vector form.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Johnson NL, Kotz S, Balakrishnan N (1995). Continuous univariate distributions, volume 2, volume 289. John wiley and sons.
or
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Uniform.html
#plotting the random variables and probability values plot(seq(0,1,by=0.01),dUNI(seq(0,1,by=0.01))$pdf,type = "l",main="Probability density graph", xlab="Random variable",ylab="Probability density values") dUNI(seq(0,1,by=0.05))$pdf #extract the pdf values dUNI(seq(0,1,by=0.01))$mean #extract the mean dUNI(seq(0,1,by=0.01))$var #extract the variance #plotting the random variables and cumulative probability values plot(seq(0,1,by=0.01),pUNI(seq(0,1,by=0.01)),type = "l",main="Cumulative density graph", xlab="Random variable",ylab="Cumulative density values") pUNI(seq(0,1,by=0.05)) #acquiring the cumulative probability values mazUNI(c(1,2,3)) #acquiring the moment about zero values #only the integer value of moments is taken here because moments cannot be decimal mazUNI(1.9)#plotting the random variables and probability values plot(seq(0,1,by=0.01),dUNI(seq(0,1,by=0.01))$pdf,type = "l",main="Probability density graph", xlab="Random variable",ylab="Probability density values") dUNI(seq(0,1,by=0.05))$pdf #extract the pdf values dUNI(seq(0,1,by=0.01))$mean #extract the mean dUNI(seq(0,1,by=0.01))$var #extract the variance #plotting the random variables and cumulative probability values plot(seq(0,1,by=0.01),pUNI(seq(0,1,by=0.01)),type = "l",main="Cumulative density graph", xlab="Random variable",ylab="Cumulative density values") pUNI(seq(0,1,by=0.05)) #acquiring the cumulative probability values mazUNI(c(1,2,3)) #acquiring the moment about zero values #only the integer value of moments is taken here because moments cannot be decimal mazUNI(1.9)
These functions provide the ability for generating probability function values and cumulative probability function values for the Uniform Binomial Distribution.
pUniBin(x,n)pUniBin(x,n)
x |
vector of binomial random variables. |
n |
single value for no of binomial trials. |
Mixing unit bounded uniform distribution with binomial distribution will create the Uniform Binomial Distribution. The probability function and cumulative probability function can be constructed and are denoted below.
The cumulative probability function is the summation of probability function values.
The mean, variance and over dispersion are denoted as
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
The output of pUniBin gives cumulative probability function values in vector form.
Horsnell G (1957). “Economical acceptance sampling schemes.” Journal of the Royal Statistical Society. Series A (General), 120(2), 148–201. Okagbue HI, Edeki SO, Opanuga AA, Oguntunde PE, Adeosun ME (2014). “Using the Average of the Extreme Values of a Triangular Distribution for a Transformation, and Its Approximant via the Continuous Uniform Distribution.” British Journal of Mathematics and Computer Science, 4(24), 3497.
#plotting the binomial random variables and probability values plot(0:10,dUniBin(0:10,10)$pdf,type="l",main="Uniform binomial probability function graph", xlab=" Binomial random variable",ylab="Probability function values") points(0:10,dUniBin(0:10,10)$pdf) dUniBin(0:300,300)$pdf #extracting the pdf values dUniBin(0:10,10)$mean #extracting the mean dUniBin(0:10,10)$var #extracting the variance dUniBin(0:10,10)$over.dis.para #extracting the over dispersion #plotting the binomial random variables and cumulative probability values plot(0:10,pUniBin(0:10,10),type="l",main="Cumulative probability function graph", xlab=" Binomial random variable",ylab="Cumulative probability function values") points(0:10,pUniBin(0:10,10)) pUniBin(0:15,15) #acquiring the cumulative probability values#plotting the binomial random variables and probability values plot(0:10,dUniBin(0:10,10)$pdf,type="l",main="Uniform binomial probability function graph", xlab=" Binomial random variable",ylab="Probability function values") points(0:10,dUniBin(0:10,10)$pdf) dUniBin(0:300,300)$pdf #extracting the pdf values dUniBin(0:10,10)$mean #extracting the mean dUniBin(0:10,10)$var #extracting the variance dUniBin(0:10,10)$over.dis.para #extracting the over dispersion #plotting the binomial random variables and cumulative probability values plot(0:10,pUniBin(0:10,10),type="l",main="Cumulative probability function graph", xlab=" Binomial random variable",ylab="Cumulative probability function values") points(0:10,pUniBin(0:10,10)) pUniBin(0:15,15) #acquiring the cumulative probability values
Jenkins and Johnson (1975) compiled a chronology of incidents of international terrorism from 1/1968 through 04/1974. During this period 507 incidents are recorded in the world, where 64 incidents occurred in the United States and 65 ones in Argentina.
Terror_data_ARGTerror_data_ARG
A data frame with 2 columns and 9 rows
IncidentsNo of Incidents Occurred
freObserved frequencies
Extracted from
Li, X. H., Huang, Y. Y., & Zhao, X. Y. (2011). The Kumaraswamy Binomial Distribution. Chinese Journal of Applied Probability and Statistics, 27(5), 511-521.
Terror_data_ARG$Incidents #extracting the binomial random variables sum(Terror_data_ARG$fre) #summing all the frequenciesTerror_data_ARG$Incidents #extracting the binomial random variables sum(Terror_data_ARG$fre) #summing all the frequencies
Jenkins and Johnson (1975) compiled a chronology of incidents of international terrorism from 1/1968 through 04/1974. During this period 507 incidents are recorded in the world, where 64 incidents occurred in the United States and 65 ones in Argentina.
Terror_data_USATerror_data_USA
A data frame with 2 columns and 9 rows
IncidentsNo of Incidents Occurred
freObserved frequencies
Extracted from
Li, X. H., Huang, Y. Y., & Zhao, X. Y. (2011). The Kumaraswamy Binomial Distribution. Chinese Journal of Applied Probability and Statistics, 27(5), 511-521.
Terror_data_USA$Incidents #extracting the binomial random variables sum(Terror_data_USA$fre) #summing all the frequenciesTerror_data_USA$Incidents #extracting the binomial random variables sum(Terror_data_USA$fre) #summing all the frequencies