sn.mle {sn} | R Documentation |
Fits a skew-normal (SN) distribution to data, or fits a linear regression model with skew-normal errors, using maximum likelihood estimation.
sn.mle(X, y, cp, plot.it=TRUE, trace=FALSE, method="L-BFGS-B", control=list(maxit=100))
y |
a vector contaning the observed variable. This is the response
variable in case of linear regression.
Missing values (NA s) 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 (NA s) 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.
|
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 package 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.
To fit a skew-normal distribution to grouped data by exact maximum likelihood
estimation, use sn.mle.grouped
.
a list containing the following components:
call |
a string containing the calling statement |
cp |
a vector of length ncol(X)+2 with the centred parameters
|
logL |
the log-likelihood at convergence |
se |
a vector of standard errors for the cp component
|
info |
the observed information matrix for the cp component
|
optim |
the list returned by the optimizer optim ; see the documentation
of this function for explanation of its components.
|
If plot.it=TRUE
and a graphical device is active, a plot is produced,
as described above.
Background information on the SN distribution is given by Azzalini (1985). See also Azzalini and Capitanio (1999), for an additional discussion of the centred parametrization.
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.
dsn
, sn.em
, msn.mle
,
optim
, sn.mmle
, sn.mle.grouped
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)