Learn R Programming

sn (version 2.1.1)

SUNdistr-op: Operations on SUNdistr-class objects

Description

Given an object of SUNdistr-class, or possibly two such things in some cases, the functions perform various operations, and produce a new object of the same class.

Usage

affineTransSUNdistr(object, a, A, name, compNames, HcompNames, drop = TRUE)
conditionalSUNdistr(object, comp, values, eventType = "=", name, drop = TRUE) 
convolutionSUNdistr(object1, object2, name, compNames, HcompNames) 
joinSUNdistr(object1, object2, name, compNames, HcompNames) 
marginalSUNdistr(object, comp, name, drop=TRUE)

Value

an object of SUNdistr-class

Arguments

object, object1, object2

objects of class SUNdistr

a

a numeric vector; see ‘Details’

A

a numeric matrix; see ‘Details’

name

an optional character string with the name of the returned distribution

compNames

an optional vector of character strings with the names of the component variables of the returned distribution

HcompNames

an optional vector of character strings with the names of the hidden variables of the returned distribution

drop

a logical value (default: TRUE) relevant only in the case m=1. When both m=1 and drop=TRUE, the returned object is of class either SECdistrUv or SECdistrMv, depending on the dimension of the returned object, and family "SN" or "ESN", as appropriate.

comp

a vector of integers representing the selected components

values

a numeric vector which identifies the conditioning event

eventType

a single character value which indicates the type of the conditioning event, as described in the ‘Details’ section; possible values are "=" (default) and ">"

Author

Adelchi Azzalini

Details

For an object which represents the distribution of a multivariate SUN random variable \(Y\) of dimension d, say, a number of operations are possible, producing a new object of the same class. This object could have been created by makeSUNdistr or it could be the outcome from some previous call to one of the functions described here.

The function affineTransSUNdistr computes the distribution of \(a+A'Y\), provided A is a full-rank matrix with nrow(A)=d and length(a)=ncol(A). See equation (7.6) of Azzalini & Capitanio (2014).

The function marginalSUNdistr builds a SUN distribution from the components selected by the comp vector.

A conditional distribution can be computed using conditionalSUNdistr for two type of events, selected by eventType. The "=" case corresponds to the event \(Y_1=y_1\) where \(Y_1\) is the subset of components identified by the comp argument, \(y_1\) is vector specified by the values argument and the equality sign must hold for each component. See equation (7.6) of Azzalini & Capitanio (2014).

If conditionalSUNdistr is used with eventType=">", the conditiong refers to the event \(Y_1>y_1\), where the inequality must be interpreted components-wise; see Arellano-Valle & Azzalini (2021) for the underlying mathematical result. If the conditional distribution is required for the reverse inequality condition, "<" say, this is equivalent to consideration of the event \(-Y_1>-y_1\). The corresponding distribution can be obtained in two steps: first a new variable is constructed reversing the sign of the required components using affineTransSUNdistr; then conditionalSUNdistr is applied to this new variable with the ">" condition and values \(-y_1\). More complex conditions, where the "<" and ">" signs are mixed for different component varables, can be handled similarly, by introducing a square matrix A for affineTransSUNdistr having an appropriate combination of 1s' and -1's on its main diagonal, and 0's elsewhere, and matching changes of sign to the components of \(y_1\).

Functions convolutionSUNdistr and joinSUNdistr operate under the assumptions that object1 and object2 refer to independent variables. Specifically, convolutionSUNdistr computes the convolution of the two objects (i.e. the distribution of the sum of two independent variables), which must have the same dimension d. Function joinSUNdistr combines two objects into a joint distribution.

If the arguments name, compNames and HcompNames are missing, they are composed from the supplied arguments.

References

Arellano-Valle, R. B. and Azzalini, A. (2021). Some properties of the unified skew-normal distribution. Statistical Papers, tools:::Rd_expr_doi("https://doi.org/10.1007/s00362-021-01235-2") and arXiv:2011.06316

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

See Also

SUNdistr-base, makeSUNdistr, SUNdistr-class

Examples

Run this code
xi <- c(1, 0, -1)
Omega <- matrix(c(2,1,1, 1,3,1, 1,1,4), 3, 3)
Delta <- matrix(c(0.72,0.20, 0.51,0.42, 0.88, 0.94), 3, 2, byrow=TRUE)
Gamma <- matrix(c(1, 0.8, 0.8, 1), 2, 2)
dp3 <- list(xi=xi, Omega=Omega, Delta=Delta, tau=c(-0.5, 0), Gamma=Gamma)
sun3 <- makeSUNdistr(dp=dp3, name="SUN3", compNames=c("x", "w", "z"))
#
a <- c(1,-2)
A <- matrix(1:6, 3, 2)
sun2at <- affineTransSUNdistr(sun3, a, A, "SUN2at", compNames=c("at1", "at2"))
sun2m <- marginalSUNdistr(sun3, comp=c(1,3), name="SUN2m")
sun1c <- conditionalSUNdistr(sun3, comp=c(1,3), values=c(1.1, 0.8),
            eventType=">", name="SUN1c", drop=FALSE)
#
Omega <- matrix(c(5, 1, 1, 6), 2, 2)
Delta <- matrix(c(0.30, 0.50, 0.50, 0.85), 2, 2, byrow=TRUE)
Gamma <- matrix(c(1, 0.18, 0.18, 1), 2, 2)
tau <- c(0.4, -0.8)
dp2 <- list(x=c(1, 0), Omega=Omega, Delta=Delta, tau=tau, Gamma=Gamma)
sun2 <-  makeSUNdistr(dp=dp2, name="SUN2", compNames=c("u", "v"))
#
sun2conv <- convolutionSUNdistr(sun2, sun2m, name="SUN2sum")
sun5 <- joinSUNdistr(sun3, sun2)

Run the code above in your browser using DataLab