Density and random generation for the univariate skew-normal distribution.

dskewnorm(x, location = 0, scale = 1, shape = 0, log = FALSE)
rskewnorm(n, location = 0, scale = 1, shape = 0)

Arguments

x

vector of quantiles.

n

number of observations. Same as runif.

location

The location parameter \(\xi\). A vector.

scale

The scale parameter \(\omega\). A positive vector.

shape

The shape parameter. It is called \(\alpha\) in skewnormal.

log

Logical. If log=TRUE then the logarithm of the density is returned.

Details

See skewnormal, which currently only estimates the shape parameter. More generally here, \(Z = \xi + \omega Y\) where \(Y\) has a standard skew-normal distribution (see skewnormal), \(\xi\) is the location parameter and \(\omega\) is the scale parameter.

Value

dskewnorm gives the density, rskewnorm generates random deviates.

References

http://tango.stat.unipd.it/SN.

Author

T. W. Yee

Note

The default values of all three parameters corresponds to the skew-normal being the standard normal distribution.

See also

Examples

if (FALSE)  N <- 200  # Grid resolution
shape <- 7; x <- seq(-4, 4, len = N)
#> Error: object 'N' not found
plot(x, dskewnorm(x, shape = shape), type = "l", col = "blue", las = 1,
     ylab = "", lty = 1, lwd = 2)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'x' not found
abline(v = 0, h = 0, col = "grey")
#> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): plot.new has not been called yet
lines(x, dnorm(x), col = "orange", lty = 2, lwd = 2)
#> Error: object 'x' not found
legend("topleft", leg = c(paste("Blue = dskewnorm(x, ", shape,")", sep = ""),
       "Orange = standard normal density"), lty = 1:2, lwd = 2,
       col = c("blue", "orange"))  # \dontrun{}
#> Error in (function (s, units = "user", cex = NULL, font = NULL, vfont = NULL,     ...) {    if (!is.null(vfont))         vfont <- c(typeface = pmatch(vfont[1L], Hershey$typeface),             fontindex = pmatch(vfont[2L], Hershey$fontindex))    .External.graphics(C_strWidth, as.graphicsAnnot(s), pmatch(units,         c("user", "figure", "inches")), cex, font, vfont, ...)})(dots[[1L]][[1L]], cex = dots[[2L]][[1L]], font = dots[[3L]][[1L]],     units = "user"): plot.new has not been called yet