plot2D.SymmModulated: Plotting symmetry-modulated distributions

View source: R/gg.sn.R

symm-modulated-distrR Documentation

Plotting symmetry-modulated distributions

Description

Plotting bivariate symmetry-modulated distributions, AKA skew-symmetric distributions

Usage

plot2D.SymmModulated(range, npt=rep(101,2), xi=c(0,0), Omega, f0, G0, w, 
  par.f0, par.G0, odd="check", ...)  

Arguments

range

a two-column matrix whose column-wise range is taken as the plotting intervals on the coordinated axes forming a bivariate grid of points over which the density is plotted.

npt

a numeric vector with two elements representing the number of equally-spaced points on each axis spanning the range described above; default value is rep(101,2).

xi

a numeric vector representing the location parameter; if must have length 1 for dSymmModulated and rSymmModulated, length 2 for plot2D.SymmModulated).

f0

a character string denoting the symmetric density to be modulated; admissible values for dSymmModulated and dSymmModulated are "beta", "cauchy", "logistic" (or "logis"), "normal" (or "norm"), "t", "uniform"; for the other functions the possible values are "cauchy", "normal" (or "norm"), "t"; the meaning of the names is described in the ‘Details’ section.

G0

a character string denoting the symmetric distribution used in the modulating factor; admissible values are "beta", "cauchy", "logistic" (or "logis"), "normal" (or "norm"), "t", "uniform", with meaning described in the ‘Details’ section.

w

the name (not as a character string) of a user-defined function which satisfies the condition w(-z)=-w(z) for all z; see the ‘Details’ section for additional specifications.

par.f0, par.G0

parameters required by f0 and G0, when they are of type "beta" or "t", otherwise ignored.

odd

a character string, with possible values "check" (default), "assume", "force", for regulation of the behaviour about the condition that w is an odd function, as explained in the ‘Details’ section.

Omega

a symmetric positive-definite matrix which regulates the dependence structure of f0 and so of the final density.

...

optional parameters regulating the function w and, for plot2D.SymmModulated only, graphical parameters to be supplied to function geom_contour.

Value

An invisible list containing the x and y coordinates, the corresponding density values, and the ggplot2 plot object, gg.obj.

Background

Background information for plot2D.SymmModulated, as well as related functions related to user-defined ‘symmetry-modulated’ distributions, are provided in symm-modulated-distr.

Details

For the bivariate case only, plot2D.SymmModulated computes a density over a grid of coordinates and produces a contour plot. The plotting methods and their arguments match those of package sn, but the rendering is different, since it is produced using package ggplot2.

The distribution names used in f0 and G0 have, in the univariate case, the same meaning as described in the Distributions page, with the following exceptions, to achive symmetry about 0: "uniform" denotes a uniform distribution over the interval (-1, 1); "beta" denotes the a symmetric Beta distribution with support over the interval (-1, 1) and a common value of the shape parameters.

In the multivariate case, the available options "normal" and "t" for f0 refer to densities computed by dmnorm and dmt with 0 location and correlation matrix \bar\Omega, implied by \Omega. Argument G0 has the same meaning as in the univariate case.

Options "beta" and "t" for f0 and G0 require the specification of a shape parameter, via the arguments par.f0 and par.G0, respectively. For "beta" the parameter represents the common value of the shape parameters of Beta; for "t", it represents df of TDist and dmt.

Function w most be of the form w <- function(z, ...) where ... are optional additional parameters and z represents valued of the standardized form of the density; in the univariate case, x and z are related by z=(x-xi)/omega and an analogous fact holds in the multivariate setting. The function must satisfy the condition w(-z)=-w(z). It is assumed that the function is vectorized and, in the multivariate case, it will be called with z representing a matrix with d columns, if d denotes the dimensionality of the random variable.

Argument odd regulates the behaviour with respect to the condition w(-z)=-w(z). If its value is "assume", the condition is just assumed to hold, and no action is taken. If the value is "check" (deafult), a limited check is performed; namely, in case of densities, the check is at 0 and the supplied x points, while for random numbers the check is at 0 and the generated points. The value "force" ensures that the condition is satisfied by actually constructing a modified version of the user-supplied function w, such that the required condition is enforced.

Author(s)

Adelchi Azzalini

References

Arellano-Valle, R. B., Gómez, H. W. and Quintana, F. A. (2004). A new class of skew-normal distributions. Comm. Stat., Theory & Methods, 58, 111-121.

Azzalini, A. and Capitanio, A. (2003). Distributions generated by perturbation of symmetry with emphasis on a multivariate skew-t distribution. J.Roy. Statist. Soc. B 65, 367–389. Full version of the paper at https://arXiv.org/abs/0911.2342

Azzalini, A. with the collaboration of Capitanio, A. (2014). The Skew-Normal and Related Families. Cambridge University Press, IMS Monographs series.

Wang, J., Boyer, J. and Genton, M. G. (2004). A skew-symmetric representation of multivariate distributions. Statistica Sinica, 14, 1259-1270.

See Also

symm-modulated-distr, Distributions, Beta, TDist, dmnorm, dmt, geom_contour

Examples

# example 1D - it actually refers to a univariate case, which is the
# univariate analogue of the bivariate distribution on pp.372-3 of
# Azzalini & Capitanio (2003)    
wTrigs <- function(z, p, q) sin(z * p)/(1 + cos(z * q))
x <- seq(-1, 1, length=101)
y <- dSymmModulated(x, 0, 1, f0="beta", G0="logistic", w=wTrigs, par.f0=2,
        par.G0=NULL, p=5, q=0.5)   
ggplot(data.frame(x, y), aes(x, y)) + geom_line(linetype=1, colour=4)
#
# example 2D - this really illustrates plot2D.SymmModulated
range <- cbind(c(-3,3), c(-3,3))
wMvTrigs <- function(z, p, q) sin(z %*% p)/(1 + cos(z %*% q))
plot2D.SymmModulated(range, xi=c(0,0), Omega=diag(2), f0="normal", G0="normal",
    w=wMvTrigs, par.f0=NULL, par.G0=NULL, p=c(2,3), q=c(1,1), col=4)
# w(.) as in (1.6) of Azzalini & Capitanio (2014, p.4) and the plot is as in the
# bottom-right panel of their Figure 1.1.      

gg.sn documentation built on Dec. 2, 2026, 5:07 p.m.