Learn R Programming

sn (version 0.4-3)

sn.mle: Maximum likelihood estimation for skew-normal models

Description

Fits a skew-normal (SN) distribution to data, or fits a linear regression model with skew-normal errors, using maximum likelihood estimation.

Usage

sn.mle(X, y, cp, plot.it=TRUE, trace=FALSE, method="L-BFGS-B",
          control=list(iter.max=100, abs.tol=1e-5))

Arguments

y
a vector contaning the observed variable. This is the response variable in case of linear regression. Missing values (NAs) are not allowed.
X
a matrix of explanatory variables. If X is missing, then a one-column matrix of all 1's is created. If X is supplied, then it must include a column of 1's. Missing values (NAs) are not allowed.
cp
a vector of initial values for the centred parameters, with length(cp)=ncol(X)+2
plot.it
logical value, If plot.it=TRUE (default), a plot of the nonparametric estimate of variable y (or the residuals, in the case of regression), and the parametric fit is superimposed. See below for details.
trace
logical value which controls printing of the algorithm convergence. If trace=TRUE, details are printed. Default value is FALSE.
method
this parameter is just passed to the optimizer optim; see the documentation of this function for its usage. Default value is "L-BFGS-B".
control
this parameter is just passed to the optimizer optim; see the documentation of this function for its usage.

Value

  • a list containing the following components:
  • calla string containing the calling statement
  • cpa vector of length ncol(X)+2 with the centred parameters
  • logLthe log-likelihood at convergence
  • sea vector of standard errors for the cp component
  • infothe observed information matrix for the cp component
  • optimthe list returned by the optimizer optim; see the documentation of this function for explanation of its components.

Side Effects

If plot.it=TRUE and a graphical device is active, a plot is produced, as described above.

Background

Background information on the SN distribution is given by Azzalini (1985). See Azzalini and Capitanio (1999) for a more detailed discussion of the centred parametrization.

Details

The optimizer optim is used, supplying the gradient of the log-likelihood. Convergence is generally fast and reliable, but inspection of the returned message from optim is always appropriate. In suspect cases, re-run the function changing the starting cp vector.

If plotting operates, the function sm.density of the library sm is searched; this library is associated with the book by Bowman and Azzalini (1997). If sm.density is not found, an histogram is plotted.

References

Azzalini, A. (1985). A class of distributions which includes the normal ones. Scand. J. Statist. 12, 171-178.

Azzalini, A. and Capitanio, A. (1999). Statistical applications of the multivariate skew-normal distribution. J.Roy.Statist.Soc. B 61, 579--602.

Bowman, A.W. and Azzalini, A. (1997). Applied Smoothing Techniques for Data Analysis: the Kernel Approach with S-Plus Illustrations. Oxford University Press, Oxford.

See Also

dsn, sn.em, msn.mle, optim, sn.mmle, sn.mle.grouped

Examples

Run this code
data(ais, package="sn")
attach(ais)
a<-sn.mle(y=bmi)
#
a<-sn.mle(X=cbind(1,lbm),y=bmi)
#
b<-sn.mle(X=model.matrix(~lbm+sex), y=bmi)

Run the code above in your browser using DataLab