Learn R Programming

sn (version 0.4-3)

msn.fit: Fitting multivariate skew-normal distributions

Description

Fits a multivariate skew-normal (MSN) distribution to data, or fits a linear regression model with multivariate skew-normal errors, using maximum likelihood estimation. The outcome is then displayed in graphical form.

Usage

msn.fit(X, y, freq, plot.it=TRUE, trace=FALSE,  ...)

Arguments

y
a matrix or a vector. If y is a matrix, its rows refer to observations, and its columns to components of the multivariate distribution. If y is a vector, it is converted to a one-column matrix, and a scalar skew-normal distribut
X
a matrix of covariate values. If missing, a one-column matrix of 1's is created; otherwise, it must have the same number of rows of y.
freq
a vector of weights. If missing, a one-column matrix of 1's is created; otherwise it must have the same number of rows of y.
plot.it
logical value which controls the graphical output (default=TRUE); see below for description.
trace
logical value which controls printing of the algorithm convergence. If trace=TRUE, details are printed. Default value is FALSE.
...
additional parameters passed to msn.mle; in practice, the start, the algorithm and the control parameters can be passed.

Value

  • A list containing the following components:
  • calla string containing the calling statement.
  • dpa list containing the direct parameters beta, Omega, alpha. Here, beta is a matrix of regression coefficients with dim(beta)=c(nrow(X),ncol(y)), Omega is a covariance matrix of order ncol(y), alpha is a vector of shape parameters of length ncol(y).
  • logLlog-likelihood evaluated at dp.
  • sea list containing the components beta, alpha, info. Here, beta and alpha are the standard errors for the corresponding point estimates; info is the observed information matrix for the working parameter, as explained below.
  • algorithmsee the documentation of msn.mle for its explanation
  • test.normalitya list of with elements test and p.value, which are the value of the likelihood ratio test statistic for normality (i.e. test that all components of the shape parameter are 0), and the corresponding p-value.

Side Effects

Graphical output is produced if (plot.it & missing(freq))=TRUE and a suitable device is active. Three plots are produced, and the programs pauses between each two of them, waiting for the key to be pressed.

The first plot uses the variable y if X is missing, otherwise it uses the residuals from the regression. The form of this plot depends on the value of k=ncol(y); if k=1, an histogram is plotted with the fitted distribution superimposed. If k>1, a matrix of scatterplots is produced, with superimposed the corresponding bivariate densities of the fitted distribution.

The second plot has two panels, each representing a QQ-plot of Mahalanobis distances. The first of these refers to the fitting of a multivariate normal distribution, a standard statistical procedure; the second panel gives the corresponding QQ-plot of suitable Mahalanobis distances for the multivariate skew-normal fit.

The third plot is similar to the previous one, except that PP-plots are produced.

Background

The multivariate skew-normal distribution is discussed by Azzalini and Dalla Valle (1996); the (Omega,alpha) parametrization adopted here is the one of Azzalini and Capitanio (1999).

Details

For computing the maximum likelihood estimates, msn.fit invokes msn.mle which does the actual computational work; then, msn.fit displays the results in graphical form. The documentation of msn.mle gives details of the numerical procedure for maximum likelihood estimation.

Although the function accepts a vector y as input, the use of sn.mle is recommended in the scalar case.

References

Azzalini, A. and Dalla Valle, A. (1996). The multivariate skew-normal distribution. Biometrika 83, 715--726.

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

See Also

msn.mle, mst.fit, dmsn,

Examples

Run this code
data(ais, package="sn")
attach(ais)
# a simple-sample case
b <- msn.fit(y=cbind(Ht,Wt))
#
# a regression case:
a <- msn.fit(X=cbind(1,Ht,Wt), y=bmi, control=list(x.tol=1e-6))
#
# refine the previous outcome
a1 <- msn.fit(X=cbind(1,Ht,Wt), y=bmi, control=list(x.tol=1e-9), start=a$dp)

Run the code above in your browser using DataLab