# Qpenalty: Penalty function for log-likelihood of 'selm' models In sn: The Skew-Normal and Related Distributions Such as the Skew-t

## Description

Penalty function for the log-likelihood of `selm` models when `method="MPLE"`. `Qpenalty` is the default function; `MPpenalty` is an example of a user-defined function effectively corresponding to a prior distributio on `alpha`.

## Usage

 ```1 2 3``` ```Qpenalty(alpha_etc, nu = NULL, der = 0) MPpenalty(alpha, der = 0) ```

## Arguments

 `alpha_etc, alpha` in the univariate case, a single value `alpha`; in the multivariate case, a two-component list whose first component is the vector `alpha`, the second one is matrix `cov2cor(Omega)`. `nu` degrees of freedom, only required if `selm` is called with `family="ST"`. `der` a numeric value in the set 0,1,2 which indicates the required numer of derivatives of the function. In the multivariate case the function will only be called with `der` equal to 0 or 1.

## Details

The penalty is a function of `alpha`, but its expression may depend on other ingredients, specifically `nu` and `cov2cor(Omega)`. See ‘Details’ of `selm` for additional information.

The penalty mechanism allows to introduce a prior distribution π for α by setting Q=-log(π), leading to a maximum a posteriori estimate in the stated sense.

As a simple illustration of this mechanism, function `MPpenalty` implements the ‘matching prior’ distribution for the univariate SN distribution studied by Cabras et al. (2012); a brief summary of the proposal is provided in Section 3.2 of Azzalini and Capitanio (2014). Note that, besides `alpha=+/-Inf`, this choice also penalizes `alpha=0` with `Q=Inf`, effectively removing `alpha=0` from the parameter space.

Starting from the code of function `MPpenalty`, a user should be able to introduce an alternative prior distribution if so desired.

## Value

A positive number `Q` representing the penalty, possibly with attributes `attr(Q, "der1")` and `attr(Q, "der2")`, depending onthe input value `der`.

## References

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

Cabras, S., Racugno, W., Castellanos, M. E., and Ventura, L. (2012). A matching prior for the shape parameter of the skew-normal distribution. Scand. J. Statist. 39, 236–247.

`selm` function
 ```1 2 3 4``` ```data(frontier) m2 <- selm(frontier ~ 1) # no penalty m2a <- selm(frontier ~ 1, method="MPLE") # penalty="Qpenalty" is implied here m2b <- selm(frontier ~ 1, method="MPLE", penalty="MPpenalty") ```