contourmvd: Contour Plot of a Bivariate Density

View source: R/contourmvd.R

contourmvdR Documentation

Contour Plot of a Bivariate Density

Description

Contour plot of the probability density of a multivariate distribution with 2 variables:

  • generalized Gaussian distribution (MGGD) with mean vector mu, dispersion matrix Sigma and shape parameter beta

  • Cauchy distribution (MCD) with location parameter mu and scatter matrix Sigma

  • t distribution (MTD) with location parameter mu, scatter matrix Sigma and degrees of freedom nu

This function uses the contour function.

Usage

contourmvd(mu, Sigma, beta = NULL, nu = NULL,
                  distribution = c("mggd", "mcd", "mtd"),
                  xlim = c(mu[1] + c(-10, 10)*Sigma[1, 1]),
                  ylim = c(mu[2] + c(-10, 10)*Sigma[2, 2]),
                  zlim = NULL, npt = 30, nx = npt, ny = npt,
                  main = NULL, sub = NULL, nlevels = 10,
                  levels = pretty(zlim, nlevels), tol = 1e-6, ...)

Arguments

mu

length 2 numeric vector.

Sigma

symmetric, positive-definite square matrix of order 2. The dispersion matrix.

beta

numeric. If distribution = "mggd", the shape parameter of the MGGD. NULL if dist is "mcd" or "mtd".

nu

numeric. If distribution = "mtd", the degrees of freedom of the MTD. NULL if distribution is "mggd" or "mcd".

distribution

character string. The probability distribution. It can be "mggd" (multivariate generalized Gaussian distribution) "mcd" (multivariate Cauchy) or "mtd" (multivariate t).

xlim, ylim

x-and y- limits.

zlim

z- limits. If NULL, it is the range of the values of the density on the x and y values within xlim and ylim.

npt

number of points for the discretisation.

nx, ny

number of points for the discretisation among the x- and y- axes.

main, sub

main and sub title, as for title. If omitted, the main title is set to "Multivariate generalised Gaussian density", "Multivariate Cauchy density" or "Multivariate t density".

nlevels, levels

arguments to be passed to the contour function.

tol

tolerance (relative to largest variance) for numerical lack of positive-definiteness in Sigma, for the estimation of the density. See dmggd, dmcd or dmtd.

...

additional arguments to plot.window, title, Axis and box, typically graphical parameters such as cex.axis.

Value

Returns invisibly the probability density function.

Author(s)

Pierre Santagostini, Nizar Bouhlel

References

E. Gomez, M. Gomez-Villegas, H. Marin. A Multivariate Generalization of the Power Exponential Family of Distribution. Commun. Statist. 1998, Theory Methods, col. 27, no. 23, p 589-600. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/03610929808832115")}

S. Kotz and Saralees Nadarajah (2004), Multivariate t Distributions and Their Applications, Cambridge University Press.

See Also

plotmvd: plot of a bivariate generalised Gaussian, Cauchy or t density.

dmggd: probability density of a multivariate generalised Gaussian distribution.

dmcd: probability density of a multivariate Cauchy distribution.

dmtd: probability density of a multivariate t distribution.

Examples

mu <- c(1, 4)
Sigma <- matrix(c(0.8, 0.2, 0.2, 0.2), nrow = 2)

# Bivariate generalized Gaussian distribution
beta <- 0.74
contourmvd(mu, Sigma, beta = beta, distribution = "mggd")

# Bivariate Cauchy distribution
contourmvd(mu, Sigma, distribution = "mcd")

# Bivariate t distribution
nu <- 1
contourmvd(mu, Sigma, nu = nu, distribution = "mtd")


multvardiv documentation built on April 3, 2025, 6:08 p.m.