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)
Arguments
r: vector of moments.
a: single value for shape parameter alpha representing as a.
b: single value for shape parameter beta representing as b.
Returns
The output of mazBETA gives the moments about zero in vector form.
Details
The probability density function and cumulative density function of a unit bounded beta distribution with random variable P are given by
gP(p)=B(a,b)pa−1(1−p)b−1
; 0≤p≤1
GP(p)=B(a,b)Bp(a,b)
; 0≤p≤1
a,b>0
The mean and the variance are denoted by
E[P]=a+bavar[P]=(a+b)2(a+b+1)ab
The moments about zero is denoted as
E[Pr]=i=0∏r−1(a+b+ia+i)
r=1,2,3,...
Defined as Bp(a,b)=∫0pta−1(1−t)b−1dt is incomplete beta integrals and B(a,b) is the beta function.
NOTE : If input parameters are not in given domain conditions necessary error messages will be provided to go further.
Examples
#plotting the random variables and probability valuescol <- 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 in1: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 valuesdBETA(seq(0,1,by=0.01),2,3)$mean #extracting the meandBETA(seq(0,1,by=0.01),2,3)$var #extracting the variance#plotting the random variables and cumulative probability valuescol <- 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 in1: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 valuesmazBETA(1.4,3,2)#acquiring the moment about zero valuesmazBETA(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 decimalmazBETA(1.9,5.5,6)