Package 'MDBED'

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

Help Index


3D plot of the joint CDF of the bivariate exponential distribution (BED) based on the Moran-Downton model

Description

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.

Usage

CDF_3dPlot(
  rho,
  Betax,
  Betay,
  xlabel = "x",
  ylabel = "y",
  zlabel = "Joint CDF",
  title = "BED",
  angle = 45,
  GS = 0.5
)

Arguments

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).

Details

Based on the function wireframe of the lattice package.

Value

A 3D plot of the joint CDF of the BED is provided.

Author(s)

Luis F. Duque <[email protected]> <[email protected]>

Examples

CDF_3dPlot(rho=0.85,Betax=1,Betay=1)

Conditional distribution of Y given X=x of the bivariate exponential distribution (BED) based on the Moran-Downton model

Description

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.

Usage

CondBED(rho,Betax,Betay,x)

Arguments

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.

Details

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.

Value

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.

Author(s)

Luis F. Duque <[email protected]> <[email protected]>

References

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.

Examples

Data<-rBED(n=50,Betax=1,Betay=1,rho=0.85)
Conyx<-CondBED(rho=0.85,Betax=1,Betay=1,x=Data[,1])

Contour plot of the bivariate exponential distribution (BED) based on the Moran-Downton model

Description

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.

Usage

Contour_Plot(
  rho,
  Betax,
  Betay,
  Pr = c(5, 25, 75, 95),
  xlabel = "x",
  ylabel = "y",
  title = "BED",
  Rvalues = FALSE,
  n = 1000
)

Arguments

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.

Value

The Contour plot of the BED is provided.

Author(s)

Luis F. Duque <[email protected]> <[email protected]>

Examples

Contour_Plot(rho=0.5,Betax=1,Betay=1)

Joint density function of the bivariate exponential distribution (BED) based on the Moran-Downton model

Description

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).

Usage

dBED(rho,Betax,Betay,x,y)

Arguments

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.

Details

The values of the joint density function are computed based on Eq.18 described in Nagao and Kadoya (1971).

Value

The value of the joint PDF of the pair/s (x,y).

Note

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.

Author(s)

Luis F. Duque <[email protected]> <[email protected]>

References

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.

Examples

dBED(rho=0.85,Betax=1,Betay=1,x=0.6,y=0.8)

Joint CDF of the bivariate exponential distribution (BED) based on the Moran-Downton model

Description

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).

Usage

pBED(rho,Betax,Betay,x,y)

Arguments

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.

Details

The values of the joint density function are computed based on Eq.10.54 described in Balakrishna and Lai (2009).

Value

The value of the joint CDF of the pair/s (x,y).

Author(s)

Luis F. Duque <[email protected]> <[email protected]>

References

Balakrishna N, Lai CD (2009). Continuous bivariate distributions, Second edition. Springer Science \& Business Media, New York. ISBN 9780387096131, doi:10.1007/b101765.

Examples

pBED(rho=0.85,Betax=1,Betay=1, x=0.6,y=0.8)

3D plot of the joint PDF of the bivariate exponential distribution (BED) based on the Moran-Downton model

Description

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.

Usage

PDF_3dPlot(
  rho,
  Betax,
  Betay,
  xlabel = "x",
  ylabel = "y",
  zlabel = "Joint PDF",
  title = "BED",
  angle = -35,
  GS = 0.5
)

Arguments

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)

Details

Based on the function persp of the graphics package.

Value

A 3D plot of the joint PDF of the BED is provided.

Author(s)

Luis F. Duque <[email protected]> <[email protected]>

Examples

PDF_3dPlot(rho=0.85,Betax=1,Betay=1)

Bivariate generator of the bivariate exponential distribution (BED) based on the Moran-Downton model

Description

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.

Usage

rBED(rho,Betax,Betay,n)

Arguments

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.

Details

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.

Value

A dataframe with n random values generated.

Note

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.

Author(s)

Luis F. Duque <[email protected]> <[email protected]>

References

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.

Examples

rBED(n=100,Betax=1,Betay=1,rho=0.85)