Title: | Moran-Downton Bivariate Exponential Distribution |
---|---|
Description: | Provides 3D plots of the Moran-Downton bivariate exponential distribution (MDBED), generates bivariate random values, and also provides values of the joint and conditional PDFs and CDFs. Nagao M, Kadoya M (1971) <http://hdl.handle.net/2433/124795>. Balakrishna N, Lai CD (2009) <doi:10.1007/b101765>. |
Authors: | Luis F. Duque <[email protected]> |
Maintainer: | Luis F. Duque <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2025-01-28 02:53:16 UTC |
Source: | https://github.com/lfduquey/mdbed |
This function builds a 3D plot of the joint CDF of the BED. The required inputs are the correlation coefficient and the scale parameters of the marginal distributions. This function also allows several characteristics of the plot to be set.
CDF_3dPlot( rho, Betax, Betay, xlabel = "x", ylabel = "y", zlabel = "Joint CDF", title = "BED", angle = 45, GS = 0.5 )
CDF_3dPlot( rho, Betax, Betay, xlabel = "x", ylabel = "y", zlabel = "Joint CDF", title = "BED", angle = 45, GS = 0.5 )
rho |
Correlation coefficient between marginal distributions of x and y. |
Betax |
Scale parameter of the marginal distribution of x. |
Betay |
Scale parameter of the marginal distribution of y. |
xlabel |
Label of the x-axis. |
ylabel |
Label of the y-axis. |
zlabel |
Label of the z-axis. |
title |
Title of the figure. |
angle |
Angle of the 3D projection (Default value 45). |
GS |
Grid spacing; value between 0 and 1 (Default value 0.5). |
Based on the function wireframe
of the lattice
package.
A 3D plot of the joint CDF of the BED is provided.
Luis F. Duque <[email protected]> <[email protected]>
CDF_3dPlot(rho=0.85,Betax=1,Betay=1)
CDF_3dPlot(rho=0.85,Betax=1,Betay=1)
This function computes the conditional PDF and CDF of Y given X=x of the BED based on the equations of the conditional moments of the Moran-Downton model.
CondBED(rho,Betax,Betay,x)
CondBED(rho,Betax,Betay,x)
rho |
Correlation coefficient between the marginal distributions of x and y. |
Betax |
Scale parameter of the marginal distribution of x. |
Betay |
Scale parameter of the marginal distribution of y. |
x |
a value or vector of values of the marginal distribution of x. |
This function computes the conditional PDF and CDF of Y given X=x. The conditional density is computed based on the conditional moments of the Moran-Downton model described in Eqs. 21 and 22 in Nagao and Kadoya (1971). The conditional CDF is computed via numerical integration of the conditional PDF based on the Riemann sum method.
A list with a dataframe, named Conditional_Statistics, and a sublist, named Condyx, is provided. Conditional_Statistics contains the values of x with its conditional moments, and Condyx contains several dataframes with the values of the conditional PDF and CDF of each conditional distribution associated to each value of x. For each conditional distribution, the values of the conditional quantiles (yc) with its respective density values (fyx) and its associated cumulative conditional probability values (Fyx) are provided.The first dataframe of Condyx corresponds to the first value of x shown in Conditional_Statistics, the second dataframe corresponds to the second value of x shown in Conditional_Statistics and so on.
Luis F. Duque <[email protected]> <[email protected]>
Nagao M, Kadoya M (1971). “Two-variate Exponential Distribution and Its Numerical Table for Engineering Application.” Bulletin of the Disaster Prevention Research Institute, 20(3), 34.
Data<-rBED(n=50,Betax=1,Betay=1,rho=0.85) Conyx<-CondBED(rho=0.85,Betax=1,Betay=1,x=Data[,1])
Data<-rBED(n=50,Betax=1,Betay=1,rho=0.85) Conyx<-CondBED(rho=0.85,Betax=1,Betay=1,x=Data[,1])
This function builds the contour plot of the BED. The required inputs are the correlation coefficient, the scale parameters of the marginal distributions, and the values of the cumulative joint probabilities associated to the contours (Default values 5%, 25%, 75%, and 95%). This function also allows pair of values to be plotted on the contour plot.
Contour_Plot( rho, Betax, Betay, Pr = c(5, 25, 75, 95), xlabel = "x", ylabel = "y", title = "BED", Rvalues = FALSE, n = 1000 )
Contour_Plot( rho, Betax, Betay, Pr = c(5, 25, 75, 95), xlabel = "x", ylabel = "y", title = "BED", Rvalues = FALSE, n = 1000 )
rho |
Correlation coefficient between marginal distributions of x and y. |
Betax |
Scale parameter of the marginal distribution of x. |
Betay |
Scale parameter of the marginal distribution of y. |
Pr |
A value or vector of values specifing the cumulative joint probability associated to the contour plot. Default values 5%, 25%, 75%, and 95%. |
xlabel |
Label of the x-axis. |
ylabel |
Label of the y-axis. |
title |
Title of the figure. |
Rvalues |
True or False variable (Optional). If TRUE is specified, pairs (x,y) are plotted on the contour plot. If FALSE is specifed, only the contours are plotted. Default FALSE. |
n |
Numbers of pairs (x,y) to be plotted if Rvalues is specified as TRUE. Default value 1000. |
The Contour plot of the BED is provided.
Luis F. Duque <[email protected]> <[email protected]>
Contour_Plot(rho=0.5,Betax=1,Betay=1)
Contour_Plot(rho=0.5,Betax=1,Betay=1)
Given the values of the parameters, this function provides the joint density value of the BED for a positive pair or pairs (x,y). The required inputs are the correlation coefficient, the scale parameters of the marginal distributions, and the pair/s (x,y).
dBED(rho,Betax,Betay,x,y)
dBED(rho,Betax,Betay,x,y)
rho |
Correlation coefficient between the marginal distributions of x and y. |
Betax |
Scale parameter of the marginal distribution of x. |
Betay |
Scale parameter of the marginal distribution of y. |
x |
A value or set of values (vector) of the marginal distribution of x. It must be the same size of y. |
y |
A value or set of values (vector) of the marginal distribution of y. It must be the same size of x. |
The values of the joint density function are computed based on Eq.18 described in Nagao and Kadoya (1971).
The value of the joint PDF of the pair/s (x,y).
The equation of the PDF is based on the Bessel function. Therefore, for very extreme values this function may reaches infinity. It might generate NA values.
Luis F. Duque <[email protected]> <[email protected]>
Nagao M, Kadoya M (1971). “Two-variate Exponential Distribution and Its Numerical Table for Engineering Application.” Bulletin of the Disaster Prevention Research Institute, 20(3), 34.
dBED(rho=0.85,Betax=1,Betay=1,x=0.6,y=0.8)
dBED(rho=0.85,Betax=1,Betay=1,x=0.6,y=0.8)
Given the values of the parameters, this function provides the value of the joint CDF of the BED for a positive pair or pairs (x,y). The required inputs are the correlation coefficient, the scale parameters of the marginal distributions, and the pair/s (x,y).
pBED(rho,Betax,Betay,x,y)
pBED(rho,Betax,Betay,x,y)
rho |
Correlation coefficient between the marginal distributions of x and y. |
Betax |
Scale parameter of the marginal distribution of x. |
Betay |
Scale parameter of the marginal distribution of y. |
x |
A value or set of values (vector) of the marginal distribution of x. It must be the same size of y. |
y |
A value or set of values (vector) of the marginal distribution of y. It must be the same size of x. |
The values of the joint density function are computed based on Eq.10.54 described in Balakrishna and Lai (2009).
The value of the joint CDF of the pair/s (x,y).
Luis F. Duque <[email protected]> <[email protected]>
Balakrishna N, Lai CD (2009). Continuous bivariate distributions, Second edition. Springer Science \& Business Media, New York. ISBN 9780387096131, doi:10.1007/b101765.
pBED(rho=0.85,Betax=1,Betay=1, x=0.6,y=0.8)
pBED(rho=0.85,Betax=1,Betay=1, x=0.6,y=0.8)
This function builds a 3D plot of the joint PDF of the BED. The required inputs are the correlation coefficient and the scale parameters of the marginal distributions. This function also allows several characteristics of the plot to be set.
PDF_3dPlot( rho, Betax, Betay, xlabel = "x", ylabel = "y", zlabel = "Joint PDF", title = "BED", angle = -35, GS = 0.5 )
PDF_3dPlot( rho, Betax, Betay, xlabel = "x", ylabel = "y", zlabel = "Joint PDF", title = "BED", angle = -35, GS = 0.5 )
rho |
Correlation coefficient between the marginals distributions of and y. |
Betax |
Scale parameter of the marginal distribution of x. |
Betay |
Scale parameter of the marginal distribution of y. |
xlabel |
Label of the x-axis. |
ylabel |
Label of the y-axis. |
zlabel |
Label of the z-axis. |
title |
Title of the figure. |
angle |
Angle of the 3D projection. |
GS |
Grid spacing; value between 0 and 1 (Default value 0.5) |
Based on the function persp
of the graphics
package.
A 3D plot of the joint PDF of the BED is provided.
Luis F. Duque <[email protected]> <[email protected]>
PDF_3dPlot(rho=0.85,Betax=1,Betay=1)
PDF_3dPlot(rho=0.85,Betax=1,Betay=1)
This function generates jointly random values from the BED. The required inputs are the n values to be generated, the correlation coefficient, and the scale parameters of the marginal distributions.
rBED(rho,Betax,Betay,n)
rBED(rho,Betax,Betay,n)
rho |
Correlation coefficient. |
Betax |
Scale parameter of the marginal distribution of x. |
Betay |
Scale parameter of the marginal distribution of y. |
n |
Number of random values to be generated. |
The bivariate generator generates jointly exponential random values based on the conditional distribution of Y given X=x based on Eq.18 described in Nagao and Kadoya (1971). Thus, it first generates random values of X; then, the conditional moments associated with the values of x are computed. Finally, the random values of Y are obtained by drawing a random value from each conditional distribution associated with each value of x.
A dataframe with n random values generated.
The equation of the conditional PDF used to generate the bivariate values is based on the Bessel
function. Therefore, for very extreme values this function may reach infinity. It may
generate NA values. The rBED
function is set to avoid this problem for values of n lower than
100000.
Luis F. Duque <[email protected]> <[email protected]>
Nagao M, Kadoya M (1971). “Two-variate Exponential Distribution and Its Numerical Table for Engineering Application.” Bulletin of the Disaster Prevention Research Institute, 20(3), 34.
rBED(n=100,Betax=1,Betay=1,rho=0.85)
rBED(n=100,Betax=1,Betay=1,rho=0.85)