~ubuntu-branches/ubuntu/trusty/r-cran-sn/trusty

« back to all changes in this revision

Viewing changes to man/sn.em.Rd

  • Committer: Package Import Robot
  • Author(s): Dirk Eddelbuettel
  • Date: 2014-01-14 06:28:00 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140114062800-yntgbps6kq5et10c
Tags: 1.0-0-1
* New upstream release

* debian/control: Add (Build-)Depends on r-cran-numderiv nomnormt (>= 1.3-1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
\name{sn.em}
2
 
\alias{sn.em}
3
 
\title{
4
 
Fitting Skew-normal variables using the EM algorithm
5
 
}
6
 
\description{
7
 
Fits a skew-normal (SN) distribution to data, or fits a linear regression
8
 
model with skew-normal errors, using the EM algorithm to locate the MLE
9
 
estimate. The estimation procedure can be global or it can fix some
10
 
components of the parameters vector.
11
 
}
12
 
\usage{
13
 
sn.em(X, y, fixed, p.eps=0.0001, l.eps=0.01, trace=FALSE, data=FALSE)
14
 
}
15
 
\arguments{
16
 
\item{y}{
17
 
a vector contaning the observed variable. This is the response
18
 
variable in case of linear regression.
19
 
}
20
 
\item{X}{
21
 
a matrix of explanatory variables. If \code{X} is missing, then a one-column
22
 
matrix of all 1's is created. If \code{X} is supplied, and an intercept term
23
 
is required, then it must include a column of 1's.
24
 
}
25
 
\item{fixed}{
26
 
a vector of length 3, indicating which components of the
27
 
parameter vector must be regarded as fixed. In \code{fixed=c(NA,NA,NA)},
28
 
which is the default setting, a global maximization is performed.
29
 
If the 3rd component is given a value, then maximization is performed
30
 
keeping that value fixed for the shape parameter. If the 3rd and 2nd
31
 
parameters are fixed, then the scale and the shape parameter are
32
 
kept fixed. No other patterns of the fixed values are allowed.
33
 
}
34
 
\item{p.eps}{
35
 
numerical value which regulates the parameter convergence tolerance.
36
 
}
37
 
\item{l.eps}{
38
 
numerical value which regulates the log-likelihood convergence tolerance.
39
 
}
40
 
\item{trace}{
41
 
logical value which controls printing of the algorithm convergence.
42
 
If \code{trace=TRUE}, details are printed. Default value is \code{F}.
43
 
}
44
 
\item{data}{
45
 
logical value. If \code{data=TRUE}, the returned list includes the original
46
 
data. Default value is \code{data=FALSE}.
47
 
}}
48
 
\value{
49
 
a list with the following components:
50
 
 
51
 
\item{dp}{
52
 
a vector of the direct parameters, as explained in the references below.
53
 
}
54
 
\item{cp}{
55
 
a vector of the centred parameters, as explained in the references below.
56
 
}
57
 
\item{logL}{
58
 
the log-likelihood at congergence.
59
 
}
60
 
\item{data}{
61
 
optionally (if \code{data=TRUE}), a list containing \code{X} and \code{y,} as supplied
62
 
on input, and a vector of \code{residuals}, which should have an approximate
63
 
SN distribution with \code{location=0} and \code{scale=1}, in the direct
64
 
parametrization.
65
 
}}
66
 
\details{
67
 
The function works using the direct parametrization; on convergence,
68
 
the output is then given in both parametrizations.
69
 
 
70
 
 
71
 
This function is based on the EM algorithm; it is generally quite slow,
72
 
but it appears to be very robust.
73
 
See \code{sn.mle} for an alternative method, which also returns standard
74
 
errors.
75
 
}
76
 
\section{Background}{
77
 
Background information on the SN distribution is given by Azzalini (1985).
78
 
See  Azzalini and Capitanio (1999) for a more detailed discussion of
79
 
the direct and centred parametrizations.
80
 
}
81
 
\references{
82
 
Azzalini, A. (1985).
83
 
A class of distributions which includes the normal ones.
84
 
\emph{Scand. J. Statist.}
85
 
\bold{12}, 171-178.
86
 
 
87
 
 
88
 
Azzalini, A. and Capitanio, A. (1999).
89
 
Statistical applications of the multivariate skew-normal distribution.
90
 
\emph{J.Roy.Statist.Soc. B}
91
 
\bold{61}, 579--602.
92
 
}
93
 
\seealso{
94
 
\code{\link{dsn}}, \code{\link{sn.mle}}, \code{\link{cp.to.dp}}
95
 
}
96
 
\examples{
97
 
data(ais, package="sn")
98
 
attach(ais)
99
 
#
100
 
a<-sn.em(y=bmi)
101
 
#
102
 
a<-sn.em(X=cbind(1,lbm,lbm^2),y=bmi)
103
 
#
104
 
M<-model.matrix(~lbm+I(ais$sex))
105
 
b<-sn.em(M,bmi)
106
 
#
107
 
fit <- sn.em(y=bmi, fixed=c(NA, 2, 3), l.eps=0.001)
108
 
}
109
 
\keyword{regression}
110
 
\keyword{distribution}
111
 
% Converted by Sd2Rd version 0.3-3.