sn/0000755000176200001440000000000014413063772010701 5ustar liggesuserssn/NAMESPACE0000644000176200001440000000623114267531703012123 0ustar liggesusers importFrom(stats, dnorm, dt, dcauchy, dbeta, dlogis, dunif, dchisq, dmultinom, pnorm, pt, pcauchy, pbeta, plogis, punif, pf, pgamma, pweibull, qnorm, qchisq, qt, qf, qcauchy, rnorm, runif, rbeta, rcauchy, rlogis, rt, rchisq, is.empty.model, .getXlevels, as.formula, contrasts, approxfun, uniroot, integrate, optim, nlminb, splinefun, optimize, model.matrix, model.offset, model.response, model.weights, lm.wfit, terms, model.frame, printCoefmat, delete.response, resid, weighted.mean, median, quantile, var, cov2cor, residuals, fitted, weights, na.pass ) importFrom(graphics, plot, Axis, abline, axis, box, boxplot, contour, hist, lines, mtext, panel.smooth, par, points, rug, strheight, text, title) importFrom(grDevices, dev.interactive, devAskNewPage, extendrange, contourLines) importFrom(utils, packageDescription) importFrom(mnormt, dmnorm, pmnorm, rmnorm, dmt, pmt, rmt, pd.solve, biv.nt.prob, mom.mtruncnorm) importFrom(numDeriv, grad, hessian) import(methods) import(stats4) #----------------------------- S3method(weights, selm) S3method(weights, mselm) S3method(coef, selm) S3method(coef, mselm) S3method(plot, selm) S3method(plot, mselm) S3method(fitted, selm) S3method(fitted, mselm) S3method(residuals, selm) S3method(residuals, mselm) S3method(profile, selm) S3method(confint, selm) S3method(predict, selm) S3method(sd, default) S3method(logLik, fitdistr.grouped) S3method(plot, fitdistr.grouped, plot.fitdistr.grouped) S3method(summary, fitdistr.grouped, summary.fitdistr.grouped) S3method(print, fitdistr.grouped, print.fitdistr.grouped) S3method(coef, fitdistr.grouped) S3method(vcov, fitdistr.grouped) S3method(fitted, fitdistr.grouped, fitted.fitdistr.grouped) #----------------------------- export( T.Owen, zeta, sn.cumulants, st.cumulants, dsn, psn, qsn, rsn, dst, pst, qst, rst, dsc, psc, qsc, rsc, dmsn, pmsn, rmsn, dmst, pmst, rmst, dmsc, pmsc, rmsc, makeSECdistr, modeSECdistr, marginalSECdistr, affineTransSECdistr, conditionalSECdistr, dp2cp, cp2dp, dp2op, op2dp, sn.infoUv, sn.infoMv, st.infoUv, st.infoMv, selm, MPpenalty, Qpenalty, extractSECdistr, selm.fit, sn.mple, st.mple, msn.mle, msn.mple, mst.mple, vech, vech2mat, duplicationMatrix, coef.selm, plot.selm, residuals.selm, fitted.selm, coef.mselm, plot.mselm, residuals.mselm, fitted.mselm, profile.selm, confint.selm, predict.selm, sd.default, sd, dSymmModulated, rSymmModulated, dmSymmModulated, rmSymmModulated, plot2D.SymmModulated, fournum, st.prelimFit, mst.prelimFit, galton_moors2alpha_nu, pprodt2, pprodn2, qprodt2, tr, blockDiag, dsun, psun, rsun, sunMean, sunVcov, sunMardia, makeSUNdistr, # plot.SUNdistr, summary.SUNdistr, affineTransSUNdistr, marginalSUNdistr, conditionalSUNdistr, joinSUNdistr, convolutionSUNdistr, convertSN2SUNdistr, convertCSN2SUNpar, fitdistr.grouped, plot.fitdistr.grouped, spread.grouped ) exportMethods(show, plot, summary, coef, logLik, residuals, fitted, mean, vcov, sd, profile, confint, predict) exportClasses(SECdistrUv, SECdistrMv, summary.SECdistrUv, summary.SECdistrMv, selm, mselm, summary.selm, summary.mselm, SUNdistr, summary.SUNdistr) sn/data/0000755000176200001440000000000014413055323011603 5ustar liggesuserssn/data/ais.rda0000644000176200001440000001350714413055323013055 0ustar liggesusersy]]'vjYx˼Iٷ73oc'NbӴ#"Ħ MUQE@ J Ql*)9a)G-{~ܳLmd)eiK[[ۦ7նiݛsWmXo_+};6}K {5>ظ>݀sSxNʵfšWn^vorX--?ݦwqwm~~ [߇wN~c$c/댨-QC]Ӡڸ'}͵i֟V_3>}*O?V%xru毿0o{0/mL|i3Oa#\}>Qjvw:?+77:٨(u_n_sFE ۵[P?tKh[o ?U@ ߽mrUގF\ٯNl"]oxnvߝʷm3{:Z'mKRR; Z4^ۥ'zɕC=+h߅=GO#/4\vSvwu__ڨ(7 vK/QN;tŸP|w#GwS߭zD+z;h~߭6z^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s&7%T#%nWǹ-O,ߟ'+bUWև}<;C_ʧnx2V/ZgʝCs}_r/p~r!g).?aos8gdߏ=>] grg8s uMWۮ} @0 C@mv`Oqb'oBzƳ #[}C&ۮ9'Eٸ͇|o#Q^c/><ƞƯ9m |O;cz5q^1oz3=#.LXQ| /LVGy4u;C#Nx=_LJQ['<_iwxX㷰&_jYc7U_%LMCDS"ꠅѿ=$!/P}+C&LZ|%Ax4atb5L&X_J  i:аϾi^[Bt:Y+qRɹe?]N'sn/man/0000755000176200001440000000000014413055323011445 5ustar liggesuserssn/man/st.prelimFit.Rd0000644000176200001440000001121414267302223014314 0ustar liggesusers% file sn/man/st.prelimFit.Rd % This file is a component of the package 'sn' for R % copyright (C) 2013-2020 Adelchi Azzalini % \name{st.prelimFit} \alias{st.prelimFit} \alias{mst.prelimFit} \title{ Compute preliminary estimates for a linear model with ST-distributed error term } \description{ For a univariate or multivariate linear model where the error term is assumed to have skew-\emph{t} (ST) distribution and the location parameter is a linear function of a set of explanatory values, the functions compute preliminary estimates to be used as initial values for a subsequent maximization of the likelihood function. These functions are mainly intended for internal package use.} \usage{ st.prelimFit(x, y, w, quick = TRUE, verbose = 0, max.nu = 30, SN=FALSE) mst.prelimFit(x, y, w, quick = TRUE, verbose = 0, max.nu = 30, SN=FALSE) } \arguments{ \item{x}{design matrix of numeric values. It may be missing; if present, the first column must contain all 1's.} \item{y}{vector of observations of length \code{n}, or a matrix with \code{n} rows.} \item{w}{a vector of non-negative integer weights of length \code{n}; if missing, a vector of all 1's is generated.} \item{quick}{logical value which regulates whether a very quick estimate is produced (default value \code{TRUE}); see \sQuote{Details} for additional information.} \item{verbose}{an integer value which regulates the amount of messages printed out; default value is 0.} \item{max.nu}{threshold for the estimated degrees of freedom} \item{SN}{logical value (default value: \code{FALSE}); if \code{TRUE}, a \acronym{SN} distribution is assumed.} } \details{ The underlying methodology is the one presented by Azzalini and Salehi (2020). In its essence, it is based on the selection of parameter values achieving the best matching between certain quantile-based summaries of the ST distribution and the corresponding empirical quantities for the sample or, in the presence of explanatory variables, the same quantities computed from the residuals after fitting a median regression. Argument \code{quick} selects whether the above-described matching is performed in a quick or in an accurate way. Since the output values of this function are intended to be only initial values for subsequent likelihood maximization, this explains the default option \code{quick=TRUE}. Other possible values are \code{FALSE} and \code{NULL}; the latter simply sets \code{alpha=0} and \code{nu=10}. Since the methodology hinges on some selected sample quantiles, it can occasionally be spoiled by poor behaviour of these basic quantiles, especially for small or moderate sample sizes. The more visible effect of such situation is a very large value of the estimated degrees of freedom, which then hampers rather than help a subsequent likelihood maximization. It is therefore appropriate to set an upper limit \code{max.nu} to this component. Argument \code{x} may be missing. In this case, a one-column matrix with all elements 1 is created. } \value{ A call to \code{st.prelimFit} returns a list with these components: \item{dp}{a vector of estimates in the DP parameterization} \item{residuals}{a vector of residual values} \item{logLik}{the corresponding log-likelihood value} A call to \code{mst.prelimFit} returns a list with these components: \item{dp}{a list with the estimates in the DP parameterization} \item{shrink.steps}{the number of shrinking steps applied to the original estimate of the scale matrix to obtain an admissible matrix} \item{dp.matrix}{a numeric matrix formed by the component-wise DP estimates} \item{logLik}{the corresponding log-likelihood value} } \references{ Azzalini, A. and Salehi, M. (2020). Some computational aspects of maximum likelihood estimation of the skew-\emph{t} distribution. In: \emph{Computational and Methodological Statistics and Biostatistics}, edited by Andriëtte Bekker, Ding-Geng Chen and Johannes T. Ferreira. Springer. DOI: 10.1007/978-3-030-42196-0 % https://www.springer.com/gp/book/9783030421953#aboutBook } \author{ Adelchi Azzalini} \note{These functions are mainly intended to be called by \code{\link{selm}}, but they could be of interest for people developing their own procedures.} \seealso{\code{\link[sn]{selm}} and either \code{\link{dst}} or \code{\link{dmst}} for explanation of the DP parameters} \examples{ data(barolo) attach(barolo) A75 <- (reseller=="A" & volume==75) log.price <- log(price[A75], 10) prelimFit <- st.prelimFit(y=log.price) detach(barolo) # data(ais) attach(ais) prelim32 <- mst.prelimFit(y=cbind(BMI, LBM), x=cbind(1, Ht, Wt)) detach(ais) } \keyword{robust} % \keyword{ ~kwd2 }% __ONLY ONE__ keyword per line sn/man/summary.SECdistr.Rd0000644000176200001440000001416113057037024015114 0ustar liggesusers% file sn/man/summary.SECdistr.Rd % This file is a component of the package 'sn' for R % copyright (C) 2013-2015 Adelchi Azzalini %--------------------- \name{summary.SECdistr} \alias{summary.SECdistr} \alias{summary.SECdistrUv} \alias{summary.SECdistrMv} \alias{summary,SECdistrUv-method} \alias{summary,SECdistrMv-method} \title{Summary of a \acronym{SEC} distribution object} \description{Produce a summary of an object of class either \code{"SECdistrUv"} or \code{"SECdistrMv"}, which refer to a univariate or a multivariate \acronym{SEC} distribution, respectively. Both types of objects can be produced by \code{makeSECditr}. } \usage{ \S4method{summary}{SECdistrUv}(object, cp.type = "auto", probs) \S4method{summary}{SECdistrMv}(object, cp.type = "auto") } \arguments{ \item{object}{an object of class \code{"SECdistrUv"} or \code{"SECdistrMv"}.} \item{cp.type}{a character string to select the required variance of \acronym{CP} parameterization; possible values are \code{"proper"}, \code{"pseudo"}, \code{"auto"} (default). For a description of these codes, see \code{\link{dp2cp}}.} \item{probs}{in the univariate case, a vector of probabilities for which the corresponding quantiles are required. If missing, the vector \code{c(0.05, 0.25, 0.50, 0.75, 0.95)} is used.} } \details{For a description of the \acronym{DP}, \acronym{CP} and pseudo-\acronym{CP} parameter sets included in the returned object, see \code{\link{dp2cp}}. The \code{aux} slot of the returned object includes other summary quantities, as described next. In the univariate case, the reported quantile-based measures of skewness and kurtosis refer to the Bowley and Moors measures, respectively; see Groeneveld (2006) and Moors (1988) for their specifications. In the multivariate case, the Mardia's measures of skewness and kurtosis are computed from the expressions given on p.153 and p.178 of Azzalini and Capitanio (2014). In the univariate case, \code{delta} is a simple transformation of the slant parameter \code{alpha}; it takes values in \eqn{(-1, 1)}. In the multivariate case, \code{delta} is a vector with components of similar type; they correspond to the matching terms of the univariate components. The \code{alpha*} and \code{delta*} coefficients are univariate comprehensive summary quantities of slant; see pp.132-3 of Azzalini and Capitanio (2014) for their expressions. These quantities play an important role in \acronym{SEC} distributions; for instance, the Mardia's measures of multivariare skewness and kurtosis depend on the vector of slant parameters only via \code{delta*} or, equivalently, via \code{alpha*}. The mode, which is unique for all these distributions, is computed by a numerical line search between the \acronym{DP} location and the \acronym{CP} location (or the pseudo-\acronym{DP} location, when the latter does exists). This line search is univariate also in the multivariate case, using Propositions 5.14 and 6.2 of Azzalini and Capitanio (2014); see also Problem 5.14. The examples below illustrate how extract various components from \code{aux} and other slots of the returned object. } \value{A list with the following components: \item{family}{name of the family within the \acronym{SEC} class, character} \item{dp}{\acronym{DP} parameters, a list or a vector} \item{name}{the name of the distribution, character string} \item{compNames}{in the multivariate case the names of the components, a character vector} \item{cp}{\acronym{CP} parameters, a list or a vector} \item{cp.type}{the name of the selected variant of the \acronym{CP} set} \item{aux}{a list with auxiliary ingredients (mode, coefficients of skewness and kurtosis, in the parametric and non-parametric variants, and more); see Section \sQuote{Details} for more information.} The list items \code{dp} and \code{cp} are vectors if \code{class(object)} is \code{SECdistrUv} (univariate distribution); they are lists if \code{class(object)} is \code{SECdistrMv} (multivariate distribution). } \author{Adelchi Azzalini} %\note{%% ~~further notes~~} %% ~Make other sections like Warning with \section{Warning }{....} ~ \seealso{ \code{\link{makeSECdistr}} for building a \acronym{SEC} distribution \code{\link{extractSECdistr}} for extracting a \acronym{SEC} distribution from a \code{\link{selm}} fit methods \code{\link[base]{mean}} and \code{\link[sn]{sd}} for computing the mean and the standard deviation of \code{\link{SECdistrUv-class}} objects, methods \code{\link[base]{mean}} and \code{\link[stats]{vcov}} for computing the mean vector and the variance matrix of \code{\link{SECdistrMv-class}} objects \code{\link[sn]{modeSECdistr}} for computing the mode directly } \references{ Azzalini, A. with the collaboration of Capitanio, A. (2014). \emph{The Skew-Normal and Related Families}. Cambridge University Press, IMS Monographs series. Moors, I. J. A. (1988). A quantile alternative for kurtosis. \emph{The Statistician} \bold{37}, 25-32. Groeneveld, R. A. (2006). Skewness, Bowley's measures of. In volume \bold{12}, 7771-3, of \emph{Encyclopedia of Statistical Sciences}, 2nd edition, edited by Kotz et al. Wiley, New York. } \examples{ f3 <- makeSECdistr(dp=c(3,2,5), family="SC") summary(f3) s <- summary(f3, probs=(1:9)/10) print(slotNames(s)) print(names(slot(s,"aux"))) # the components of the 'aux' slot slot(s, "aux")$mode # the same of modeSECdistr(object=f3) slot(s, "aux")$q.measures # quantile-based measures of skewness and kurtosis # dp3 <- list(xi=1:3, Omega=toeplitz(1/(1:3)), alpha=c(-3, 8, 5), nu=6) st3 <- makeSECdistr(dp=dp3, family="ST", name="ST3", compNames=c("U", "V", "W")) s <- summary(st3) dp <- slot(s, "dp") # the same of slot(st3, "dp") slot(s, "cp")$var.cov # the same of vcov(st3) slot(s, "aux")$delta.star # comprehensive coefficient of shape slot(s, "aux")$mardia # Mardia's measures of skewness and kurtosis # dp2 <- list(xi=rep(0,2), Omega=matrix(c(2,2,2,4),2,2), alpha=c(3,-5), tau=-1) esn2 <- makeSECdistr(dp=dp2, family="ESN", name="ESN-2d") summary(esn2) } \keyword{multivariate} \keyword{distribution} sn/man/zeta.Rd0000644000176200001440000000453614164642612012715 0ustar liggesusers% file sn/man/zeta.Rd % This file is a component of the package 'sn' for R % copyright (C) 1998,2013 Adelchi Azzalini %--------------------- \name{zeta} \alias{zeta} \title{Function \eqn{\log(2\,\Phi(x))}{log(2 Phi(x))} and its derivatives} \description{The function \code{log(2*pnorm(x))} and its derivatives, including inverse Mills ratio.} \usage{zeta(k, x)} \arguments{ \item{k}{an integer number between 0 and 5.} \item{x}{a numeric vector. Missing values (\code{NA}s) and \code{Inf}s are allowed.} } \value{a vector representing the \code{k}-th order derivative evaluated at \code{x}.} \details{ For \code{k} between 0 and 5, the derivative of order \code{k} of \eqn{\log(2\,\Phi(x))}{log(2\Phi(x))} is evaluated, where \eqn{\Phi(x)} denotes the \eqn{N(0,1)} cumulative distribution function. The derivative of order \code{k=0} refers to the function itself. If \code{k} is not an integer within \code{0,..., 5}, \code{NULL} is returned. } \section{Background}{ The computation for \code{k>1} is reduced to the case \code{k=1}, making use of expressions given by Azzalini and Capitanio (1999); see especially Section 4 of the full-length version of the paper. The main facts are summarized in Section 2.1.4 of Azzalini and Capitanio (2014). For numerical stability, the evaluation of \code{zeta(1,x)} when \code{x < -50} makes use of the asymptotic expansion (26.2.13) of Abramowitz and Stegun (1964). \code{zeta(1,-x)} equals \code{dnorm(x)/pnorm(-x)} (in principle, apart from the above-mentioned asymptotic expansion), called the \emph{inverse Mills ratio}. } \references{ Abramowitz, M. and Stegun, I. A., editors (1964). \emph{Handbook of Mathematical Functions}. Dover Publications. Azzalini, A. and Capitanio, A. (1999). Statistical applications of the multivariate skew normal distribution. \emph{J.Roy.Statist.Soc. B} \bold{61}, 579--602. Full-length version available at \url{https://arXiv.org/abs/0911.2093} Azzalini, A. with the collaboration of Capitanio, A. (2014). \emph{The Skew-Normal and Related Families}. Cambridge University Press, IMS Monographs series. } \examples{ y <- zeta(2,seq(-20,20,by=0.5)) # for(k in 0:5) curve(zeta(k,x), from=-1.5, to=5, col = k+2, add = k > 0) legend(3.5, -0.5, legend=as.character(0:5), col=2:7, lty=1) } \keyword{math} \concept{Mills ratio} sn/man/summary.SUNdistr-class.Rd0000644000176200001440000000312114025671652016253 0ustar liggesusers% file sn/man/summary.SUNdistr-class.Rd % This file is a component of the package 'sn' for R % copyright (C) 2021 Adelchi Azzalini %--------------------- \name{summary.SUNdistr-class} \Rdversion{1.1} \docType{class} \encoding{UTF-8} \alias{summary.SUNdistr-class} \alias{show,summary.SUNdistr-method} \title{Class \code{summary.SUNdistr}} \description{Summaries of objects of classes \code{SUNdistr}} \section{Objects from the Class}{ Objects can be created by calls of type \code{summary(object)} when \code{object} is of class \code{"SUNdistr"}.} \section{Slots}{ \describe{ \item{\code{dp}:}{a list of parameters} \item{name}{the name of the distribution, a character string} \item{compNames}{the names of the components, a character vector} \item{HcompNames}{the names of the hidden components, a character vector} \item{mean}{the mean value, a vector} \item{var.cov}{the variance-covariance matrix} \item{gamma1}{the marginal indices of asymmetry, a vector} \item{cum3}{the third order cumulants, a three-dimensional array} \item{mardia}{the Mardia's measures of multivariate asymmetry and skewness, a vector of length two} } } \section{Methods}{ \describe{ \item{show}{\code{signature(object = "summary.SUNdistr")}: ... } } } %\references{%% ~~put references to the literature/web site here~~} \author{Adelchi Azzalini} % \note{%% ~~further notes~~} %% ~Make other sections like Warning with \section{Warning }{....} ~ \seealso{ \code{\link{summary.SUNdistr}}, \code{\link{makeSUNdistr}}} % \examples{showClass("summary.SUNdistrMv")} \keyword{classes} sn/man/matrix-op.Rd0000644000176200001440000000470314026332730013660 0ustar liggesusers% file sn/man/vech.Rd % This file is a component of the package 'sn' for R % copyright (C) 1998,2013 Adelchi Azzalini %--------------------- \name{matrix-op} \encoding{UTF-8} \alias{vech} \alias{vech2mat} \alias{duplicationMatrix} \alias{tr} \alias{blockDiag} \title{vech, tr and other matrix operators} \description{vech and other matrix operators} \usage{ vech(A) vech2mat(v) duplicationMatrix(n) tr(x) blockDiag(...) } \arguments{ \item{A}{a (symmetric) square numeric matrix.} \item{v}{a numeric vector such that \code{length(v)=n*(n+1)/2} for some positive integer \code{n}.} \item{n}{a positive integer number; default is \code{n=1}.} \item{x}{a square numeric matrix.} \item{...}{an abitrary numer of matrices or objects coercible into matrices.} } \value{a vector in case of \code{vech}, a scalar in case of \code{tr}, otherwise a matrix.} \section{Details}{% For a square matrix \code{A}, \code{vech(A)} returns the vector formed by the lower triangular portion of the matrix, including the diagonal; usually, this only makes sense for a symmetric matrix of numeric values. If \code{v=vech(M)} where \code{M} is a symmetric numeric matrix, \code{vech2mat(v)} performs the inverse operation and returns the original matrix \code{M}; this explain the requirement on \code{length(v)}. For a positive integer \code{n}, \code{D=duplicationMatrix(n)} is a matrix of dimension \code{(n^2, n*(n+1)/2)} such that \code{D \%*\% vech(M)} returns the \code{vec}-form of a symmetric matrix \code{M} of order \code{n}, that is, the vector which stacks the columns of \code{M}; for more information, see Section 3.8 of Magnus and Neudecker (1988). For a square numeric matrix \code{x}, \code{tr(x)} returns its trace. \code{blockDiag(...)} creates a block-diagonal matrix from a set of matrices or objects coercible into matrices. Generally, this is useful only for numeric objects. } \section{Author}{Adelchi Azzalini; the original Octave code of \code{duplicationMatrix} is by Kurt Hornik.} \references{ Magnus, Jan R. and Neudecker, Heinz (1988). \emph{Matrix differential calculus with application in statistics and econometrics}. Wiley series in probability and statistics. } \examples{ M <- toeplitz(1:4) v <- vech(M) vech2mat(v) - M D <- duplicationMatrix(ncol(M)) # D %*% vech(M) - as.vector(M), must be a one-column matrix of 0s tr(outer(1:4,2:5)) blockDiag(M[1:2,], 1:2, diag(5:6)) } \keyword{math} \concept{matrix operator} \concept{duplication matrix} sn/man/dsn.Rd0000644000176200001440000001313414407333421012523 0ustar liggesusers% file sn/man/dsn.Rd % This file is a component of the package 'sn' for R % copyright (C) 1998-2013 Adelchi Azzalini %--------------------- \name{dsn} \alias{dsn} \alias{psn} \alias{qsn} \alias{rsn} \title{Skew-Normal Distribution} \description{Density function, distribution function, quantiles and random number generation for the skew-normal (\acronym{SN}) and the extended skew-normal (\acronym{ESN}) distribution.} \usage{ dsn(x, xi=0, omega=1, alpha=0, tau=0, dp=NULL, log=FALSE) psn(x, xi=0, omega=1, alpha=0, tau=0, dp=NULL, engine, ...) qsn(p, xi=0, omega=1, alpha=0, tau=0, dp=NULL, tol=1e-8, solver="NR", ...) rsn(n=1, xi=0, omega=1, alpha=0, tau=0, dp=NULL) } \arguments{ \item{x}{vector of quantiles. Missing values (\code{NA}'s) and \code{Inf}'s are allowed.} \item{p}{vector of probabilities. Missing values (\code{NA}'s) are allowed} \item{xi}{vector of location parameters.} \item{omega}{vector of scale parameters; must be positive.} \item{alpha}{vector of slant parameter(s); \code{+/- Inf} is allowed. For \code{psn}, it must be of length 1 if \code{engine="T.Owen"}. For \code{qsn}, it must be of length 1.} \item{tau}{a single value representing the `hidden mean' parameter of the \acronym{ESN} distribution; \code{tau=0} (default) corresponds to a \acronym{SN} distribution.} \item{dp}{a vector of length 3 (in the \acronym{SN} case) or 4 (in the \acronym{ESN} case), whose components represent the individual parameters described above. If \code{dp} is specified, the individual parameters cannot be set.} \item{n}{a positive integer representing the sample size.} \item{tol}{a scalar value which regulates the accuracy of the result of \code{qsn}, measured on the probability scale.} \item{log}{logical flag used in \code{dsn} (default \code{FALSE}). When \code{TRUE}, the logarithm of the density values is returned.} \item{engine}{a character string which selects the computing engine; this is either \code{"T.Owen"} or \code{"biv.nt.prob"}, the latter from package \code{mnormt}. If \code{tau != 0} or \code{length(alpha)>1}, \code{"biv.nt.prob"} must be used. If this argument is missing, a default selection rule is applied.} \item{solver}{a character string which selects the numerical method used for solving the quantile equation; possible options are \code{"NR"} (default) and \code{"RFB"}, described in the \sQuote{Details} section.} \item{...}{ additional parameters passed to \code{T.Owen}} } \value{density (\code{dsn}), probability (\code{psn}), quantile (\code{qsn}) or random sample (\code{rsn}) from the skew-normal distribution with given \code{xi}, \code{omega} and \code{alpha} parameters or from the extended skew-normal if \code{tau!=0} } \section{Details}{ Typical usages are \preformatted{% dsn(x, xi=0, omega=1, alpha=0, log=FALSE) dsn(x, dp=, log=FALSE) psn(x, xi=0, omega=1, alpha=0, ...) psn(x, dp=, ...) qsn(p, xi=0, omega=1, alpha=0, tol=1e-8, ...) qsn(x, dp=, ...) rsn(n=1, xi=0, omega=1, alpha=0) rsn(x, dp=) } \code{psn} and \code{qsn} make use of function \code{\link{T.Owen}} or \code{\link[mnormt:dmt]{biv.nt.prob}} In \code{qsn}, the choice \code{solver="NR"} selects the Newton-Raphson method for solving the quantile equation, while option \code{solver="RFB"} alternates a step of \emph{regula falsi} with one of bisection. The \code{"NR"} method is generally more efficient, but \code{"RFB"} is occasionally required in some problematic cases. In version 1.6-2, the random number generation method for \code{rsn} has changed; the so-called transformation method (also referred to as the \sQuote{additive representation}) has been adopted for all values of \code{tau}. Also, the code has been modified so that there is this form of consistency: provided \code{set.seed()} is reset similarly before calls, code like \code{rsn(5, dp=1:3)} and \code{rsn(10, dp=1:3)}, for instance, will start with the same initial values in the longer sequence as in the shorter sequence. } \section{Background}{ The family of skew-normal distributions is an extension of the normal family, via the introdution of a \code{alpha} parameter which regulates asymmetry; when \code{alpha=0}, the skew-normal distribution reduces to the normal one. The density function of the \acronym{SN} distribution in the \sQuote{normalized} case having \code{xi=0} and \code{omega=1} is \eqn{2\phi(x)\Phi(\alpha x)}, if \eqn{\phi} and \eqn{\Phi} denote the standard normal density and distribution function. An early discussion of the skew-normal distribution is given by Azzalini (1985); see Section 3.3 for the \acronym{ESN} variant, up to a slight difference in the parameterization. An updated exposition is provided in Chapter 2 of Azzalini and Capitanio (2014); the \acronym{ESN} variant is presented Section 2.2. See Section 2.3 for an historical account. A multivariate version of the distribution is examined in Chapter 5.} \references{ Azzalini, A. (1985). A class of distributions which includes the normal ones. \emph{Scand. J. Statist.} \bold{12}, 171-178. Azzalini, A. with the collaboration of Capitanio, A. (2014). \emph{The Skew-Normal and Related Families}. Cambridge University Press, IMS Monographs series. } \seealso{ Functions used by \code{psn}: \code{\link{T.Owen}}, \code{\link[mnormt:dmt]{biv.nt.prob}} Related distributions: \code{\link{dmsn}}, \code{\link{dst}}, \code{\link{dmst}} } \examples{ pdf <- dsn(seq(-3, 3, by=0.1), alpha=3) cdf <- psn(seq(-3, 3, by=0.1), alpha=3) q <- qsn(seq(0.1, 0.9, by=0.1), alpha=-2) r <- rsn(100, 5, 2, 5) qsn(1/10^(1:4), 0, 1, 5, 3, solver="RFB") } \keyword{distribution} sn/man/dmsn.Rd0000644000176200001440000001240414166777775012731 0ustar liggesusers% file sn/man/dmsn.Rd % This file is a component of the package 'sn' for R % copyright (C) 1998-2013 Adelchi Azzalini %--------------------- \name{dmsn} \alias{dmsn} \alias{pmsn} \alias{rmsn} \concept{skew-normal distribution} \title{Multivariate skew-normal distribution} \description{ Probability density function, distribution function and random number generation for the multivariate skew-normal (\acronym{SN}) distribution. } \usage{ dmsn(x, xi=rep(0,length(alpha)), Omega, alpha, tau=0, dp=NULL, log=FALSE) pmsn(x, xi=rep(0,length(alpha)), Omega, alpha, tau=0, dp=NULL, ...) rmsn(n=1, xi=rep(0,length(alpha)), Omega, alpha, tau=0, dp=NULL) } \arguments{ \item{x}{either a vector of length \code{d}, where \code{d=length(alpha)}, or a matrix with \code{d} columns, giving the coordinates of the point(s) where the density or the distribution function must be evaluated.} \item{xi}{a numeric vector of length \code{d} representing the location parameter of the distribution; see \sQuote{Background}. In a call to \code{dmsn} and \code{pmsn}, \code{xi} can be a matrix, whose rows represent a set of location parameters; in this case, its dimensions must match those of \code{x}.} \item{Omega}{a symmetric positive-definite matrix of dimension \code{(d,d)}; see \sQuote{Background}.} \item{alpha}{a numeric vector which regulates the slant of the density; see \sQuote{Background}. \code{Inf} values in \code{alpha} are not allowed.} \item{tau}{a single value representing the `hidden mean' parameter of the \acronym{ESN} distribution; \code{tau=0} (default) corresponds to a \acronym{SN} distribution.} \item{dp}{ a list with three elements, corresponding to \code{xi}, \code{Omega} and \code{alpha} described above; default value \code{FALSE}. If \code{dp} is assigned, individual parameters must not be specified. } \item{n}{a numeric value which represents the number of random vectors to be drawn.} \item{log}{logical (default value: \code{FALSE}); if \code{TRUE}, log-densities are returned.} \item{...}{additional parameters passed to \code{\link[mnormt]{pmnorm}}.} } % end arguments \value{ A vector of density values (\code{dmsn}) or of probabilities (\code{pmsn}) or a matrix of random points (\code{rmsn}). } \details{Typical usages are \preformatted{% dmsn(x, xi=rep(0,length(alpha)), Omega, alpha, log=FALSE) dmsn(x, dp=, log=FALSE) pmsn(x, xi=rep(0,length(alpha)), Omega, alpha, ...) pmsn(x, dp=) rmsn(n=1, xi=rep(0,length(alpha)), Omega, alpha) rmsn(n=1, dp=) } For efficiency reasons, \code{rmsn} makes very limited checks on the validity of the arguments. For instance, failure to positive definiteness of \code{Omega} would not be detected, and an uncontrolled crash occurs. Function \code{pmsn} makes use of \code{pmnorm} from package \pkg{mnormt}; the accuracy of its computation can be controlled via \code{...} } \section{Background}{ The multivariate skew-normal distribution is discussed by Azzalini and Dalla Valle (1996). The \code{(Omega,alpha)} parametrization adopted here is the one of Azzalini and Capitanio (1999). Chapter 5 of Azzalini and Capitanio (2014) provides an extensive account, including subsequent developments. Notice that the location vector \code{xi} does not represent the mean vector of the distribution. Similarly, \code{Omega} is not \emph{the} covariance matrix of the distribution, although it is \emph{a} covariance matrix. Finally, the components of \code{alpha} are not equal to the slant parameters of the marginal distributions; to fix the marginal parameters at prescribed values, it is convenient to start from the OP parameterization, as illustrated in the \sQuote{Examples} below. Another option is to start from the \acronym{CP} parameterization, but notice that, at variance from the \acronym{OP}, not all \acronym{CP} sets are invertible to lend a \acronym{DP} set.} \references{ Azzalini, A. and Capitanio, A. (1999). Statistical applications of the multivariate skew normal distribution. \emph{J.Roy.Statist.Soc. B} \bold{61}, 579--602. Full-length version available at \url{https://arXiv.org/abs/0911.2093} Azzalini, A. with the collaboration of Capitanio, A. (2014). \emph{The Skew-Normal and Related Families}. Cambridge University Press, IMS Monographs series. Azzalini, A. and Dalla Valle, A. (1996). The multivariate skew-normal distribution. \emph{Biometrika} \bold{83}, 715--726. } \seealso{\code{\link{dsn}}, \code{\link{dmst}}, \code{\link[mnormt]{pmnorm}}, \code{\link{op2dp}}, \code{\link{cp2dp}}} \examples{ x <- seq(-3,3,length=15) xi <- c(0.5, -1) Omega <- diag(2) Omega[2,1] <- Omega[1,2] <- 0.5 alpha <- c(2,-6) pdf <- dmsn(cbind(x, 2*x-1), xi, Omega, alpha) cdf <- pmsn(cbind(x, 2*x-1), xi, Omega, alpha) p1 <- pmsn(c(2,1), xi, Omega, alpha) p2 <- pmsn(c(2,1), xi, Omega, alpha, abseps=1e-12, maxpts=10000) # rnd <- rmsn(10, xi, Omega, alpha) # # use OP parameters to fix marginal shapes at given lambda values: op <- list(xi=c(0,1), Psi=matrix(c(2,2,2,3), 2, 2), lambda=c(5, -2)) rnd <- rmsn(10, dp=op2dp(op,"SN")) # # use CP parameters to fix mean vector, variance matrix and marginal skewness: cp <- list(mean=c(0,0), var.cov=matrix(c(3,2,2,3)/3, 2, 2), gamma1=c(0.8, 0.4)) dp <- cp2dp(cp, "SN") rnd <- rmsn(5, dp=dp) } \keyword{distribution} \keyword{multivariate} sn/man/sd.Rd0000644000176200001440000000130312504264237012344 0ustar liggesusers\name{sd} \title{Standard deviation} \alias{sd} \alias{sd.default} \description{ The \code{sd} function from the \pkg{stats} is replaced by a new \code{method} in order to introduce a separate method to deal with objects of class \code{SECdistrUv}. The function \code{sd.default} is an alias of the original function \code{\link[stats]{sd}}. } \usage{ sd(x, \dots) \method{sd}{default}(x, na.rm = FALSE, \dots) } \arguments{ \item{x}{a numeric vector, matrix or data frame.} \item{na.rm}{logical. Should missing values be removed?} \item{\dots}{further arguments passed to or from other methods.} } \seealso{ \code{\link[stats]{sd}}, \code{\linkS4class{SECdistrUv}} } \keyword{univar} sn/man/dsc.Rd0000644000176200001440000000531512354763532012523 0ustar liggesusers% file sn/man/dsc.Rd % This file is a component of the package 'sn' for R % copyright (C) 2013 Adelchi Azzalini %--------------------- \name{dsc} \alias{dsc} \alias{psc} \alias{qsc} \alias{rsc} \title{Skew-Cauchy Distribution} \description{Density function, distribution function, quantiles and random number generation for the skew-Cauchy (SC) distribution.} \usage{ dsc(x, xi = 0, omega = 1, alpha = 0, dp = NULL, log = FALSE) psc(x, xi = 0, omega = 1, alpha = 0, dp = NULL) qsc(p, xi = 0, omega = 1, alpha = 0, dp = NULL) rsc(n = 1, xi = 0, omega = 1, alpha = 0, dp = NULL) } \arguments{ \item{x}{vector of quantiles. Missing values (\code{NA}s) and \code{Inf}'s are allowed.} \item{p}{vector of probabilities. Missing values (\code{NA}s) are allowed.} \item{xi}{ vector of location parameters.} \item{omega}{vector of (positive) scale parameters.} \item{alpha}{vector of slant parameters.} \item{dp}{a vector of length 3 whose elements represent the parameters described above. If \code{dp} is specified, the individual parameters cannot be set.} \item{n}{sample size.} \item{log}{logical flag used in \code{dsc} (default \code{FALSE}). When \code{TRUE}, the logarithm of the density values is returned.} } \value{density (\code{dsc}), probability (\code{psc}), quantile (\code{qsc}) or random sample (\code{rsc}) from the skew-Cauchy distribution with given \code{xi}, \code{omega} and \code{alpha} parameters or from the extended skew-normal if \code{tau!=0} } \section{Details}{ Typical usages are \preformatted{% dsc(x, xi=0, omega=1, alpha=0, log=FALSE) dsc(x, dp=, log=FALSE) psc(x, xi=0, omega=1, alpha=0) psc(x, dp= ) qsc(p, xi=0, omega=1, alpha=0) qsc(x, dp=) rsc(n=1, xi=0, omega=1, alpha=0) rsc(x, dp=) } } \section{Background}{ The skew-Cauchy distribution can be thought as a skew-\eqn{t} with tail-weight parameter \code{nu=1}. In this case, closed-form expressions of the distribution function and the quantile function have been obtained by Behboodian \emph{et al.} (2006). The key facts are summarized in Complement 4.2 of Azzalini and Capitanio (2014). A multivariate version of the distribution exists. } \references{ Azzalini, A. with the collaboration of Capitanio, A. (2014). \emph{The Skew-normal and Related Families}. Cambridge University Press, IMS Monographs series. Behboodian, J., Jamalizadeh, A., and Balakrishnan, N. (2006). A new class of skew-Cauchy distributions. \emph{Statist. Probab. Lett.} \bold{76}, 1488--1493. } \seealso{\code{\link{dst}}, \code{\link{dmsc}}} \examples{ pdf <- dsc(seq(-5,5,by=0.1), alpha=3) cdf <- psc(seq(-5,5,by=0.1), alpha=3) q <- qsc(seq(0.1,0.9,by=0.1), alpha=-2) p <- psc(q, alpha=-2) rn <- rsc(100, 5, 2, 5) } \keyword{distribution} sn/man/profile.selm.Rd0000644000176200001440000001615614030043736014344 0ustar liggesusers% file sn/man/profile.selm.Rd % This file is a component of the package 'sn' for R % copyright (C) 2015 Adelchi Azzalini %--------------------- \name{profile.selm} \alias{profile.selm} \alias{profile.selm-method} \concept{confidence interval} \concept{confidence region} \title{Profile log-likelihood function of selm-class objects} \description{ One- or two-dimensional profile (penalized) log-likelihood function of a \code{selm} fit and corresponding confidence interval or regions } \usage{ \S3method{profile}{selm}(fitted, param.type, param.name, param.values, npt, opt.control = list(), plot.it = TRUE, log = TRUE, levels, trace = FALSE, ...) } \arguments{ \item{fitted}{an object of class \code{selm} as produced by a call to function \code{selm} with univariate response.} \item{param.type}{ a character string with the required parameterization; it must be either \code{"CP"} or \code{"DP"}, or possibly their equivalent lowercase.} \item{param.name}{ either a single character string or a vector of two such terms with the name(s) of the parameter(s) for which the profile log-likelihood is required; these names must match those appearing in \code{\link{summary.selm}(object, param.type)}.} \item{param.values}{in the one-parameter case, a numeric vector with the values where the log-likelihood must be evaluated; in the two-parameter case, a list of two such vectors used to build a grid of coordinates of points. Their range must identify an interval or a rectangle which includes the \acronym{MLE} or \acronym{MPLE} obtained by \code{\link{selm}}. See \sQuote{Details} for more information.} \item{npt}{ in case the vector or any of the vectors of argument \code{param.values} has length 2, an equally spaced grid of values is build with length equal to the corresponding component of \code{npt}. If the above condition is met but this argument is missing, a default choice is made, namely 51 or (26,26) in the one- or two-parameter case, respectively.} \item{opt.control}{ an optional list passed as argument \code{control} to \code{optim} to optimize the log-likelihood; see \sQuote{Details} for more information.} \item{plot.it}{a logical value; if \code{TRUE} (default value), a plot is produced representing the deviance, which is described in \sQuote{Details} below. In the one-parameter case, a confidence interval of prescribed \code{level} is marked on the plot; in the two-parameter case, the contour curves are labelled with approximate confidence levels. See however for more information. } \item{log}{a logical value (default: \code{TRUE}) indicating whether the scale and tail-weight parameter (the latter only for the \acronym{ST} family) must be log-transformed, if case any of them occurs in \code{param.name}. This applies to \code{omega} and \code{nu} in the \code{DP} parameter set and to \code{s.d.} and \code{gamma2} in the \code{CP} parameter set.} \item{levels}{a single probability value (in the one-parameter case) or a vector of such values (in the two-parameter case) for which the confidence interval or region is requited; see \sQuote{Details} for more information.} \item{trace}{a logical value (default: \code{FALSE}) to activate printing of intermediate outcome of the log-likelihood optimization process} \item{\dots}{optional graphical parameters passed to the plotting functions.} } \details{ For each chosen point of the parameter(s) to be profiled, the log-likelihood is maximized with respect to the remaining parameters. The optimization process is accomplished using the \code{\link[stats]{optim}} optimization function, with \code{method="BFGS"}. This step can be regulated by the user via \code{opt.control} which is passed to \code{\link[stats]{optim}} as \code{control} argument, apart from element \code{fnscale} whose use is reserved. If the original \code{fitted} object included a fixed parameter value, this is kept fixed here. If the estimation method was \code{"MPLE"}, that choice carries on here; in case the penalty function was user-defined, it must still be accessible. For plotting purposes and also in the numerical output, the deviance function \eqn{D} is used, namely \deqn{D = 2\left[\max(\log L) - \log L\right]}{D = 2*[max(log L)- log L]} where \eqn{L} denotes the likelihood. The range of \code{param.values} must enclose the maximum (penalized) likelihood estimates (\acronym{MLE} or \acronym{MPLE}) by an adequate extent such that suitable confidence intervals or regions can be established from standard asymptotic theory. If this condition does not hold, the function still proceeds, but no confidence interval or region is delivered. For the \acronym{SN} family and \acronym{DP} parameterization, the asymptotic theory is actually non-standard near the important point \eqn{\alpha=0}, but the correspondence with the regular case of the \acronym{CP} parameterization, still allows to derive confidence regions using standard procedures; for additional information, see Section 3.1.6 of Azzalini and Capitanio (2014). When the \acronym{MLE} occurs on the frontier of the parameter space, a message is issued and no confidence interval is produced, while in the two-parameter case the plot is not labelled with probability values, but only with deviance levels. } \value{An invisible list whose components, described below, are partly different in the one- and the two-parameter cases. \item{call}{the calling statement} \item{}{values of the first parameter} \item{}{values of the second parameter (in the two-parameter case)} \item{logLik}{numeric vector or matrix of the profile log-likelihood values} \item{confint}{in the one-parameter case, the confidence interval} \item{level}{in the one-parameter case, the confidence level} \item{deviance.contour}{in the two-parameter case, a list of lists whose elements identify each curve of the contour plot} } \author{Adelchi Azzalini} \references{ Azzalini, A. with the collaboration of Capitanio, A. (2014). \emph{The Skew-Normal and Related Families}. Cambridge University Press, IMS Monographs series. } % \note{} \section{Warnings}{ \itemize{ \item This function is experimental and changes in future versions of the package may occur. Users should not rely on the persistence of the same user interface or the same name(s). \item It is a known fact that, in some critical situations, peculiar outcomes are produced. }} \seealso{ \code{\link{selm}}, \code{\link{summary.selm}}, \code{\link{makeSECdistr}} for the \acronym{CP}/\acronym{DP} parameterizations, \code{\link[stats]{optim}} for its \code{control} argument } \examples{ data(ais, package="sn") m1 <- selm(log(Fe) ~ BMI + LBM, family = "sn", data = ais) pll <- profile(m1, "dp", param.name="alpha", param.val=c(-3,2)) profile(m1, "cp", param.name="gamma1", param.val=seq(-0.7, 0.4, by=0.1)) # in the next example, we reduce the grid points to save execution time pll <- profile(m1, "cp", param.name=c("(Intercept.CP)", "gamma1"), param.val = list(c(1.5, 4), c(-0.8, 0.5)), npt=c(11,11) ) } sn/man/modeSECdistr.Rd0000644000176200001440000000423713370543057014276 0ustar liggesusers% file sn/man/mmodeSECdistr.Rd % This file is a component of the package 'sn' for R % copyright (C) 2013 Adelchi Azzalini %--------------------- \name{modeSECdistr} \alias{modeSECdistr} \title{The mode of a skew-elliptically contoured (\acronym{SEC}) distribution} \description{ Compute compute the mode of a univariate or multivariate \acronym{SEC} distribution.} \usage{ modeSECdistr(dp, family, object=NULL) } \arguments{ \item{dp}{ a numeric vector (in the univariate case, for class \code{SECdistrUv}) or a list (in the multivariate case, , for class \code{SECdistrUv}) of parameters which identify the specific distribution within the named \code{family}. } \item{family}{a character string which identifies the parametric family among those admissible for classes \code{SECdistrUv} or \code{SECdistrMv}.} \item{object}{an object of class \code{SECdistrUv} or \code{SECdistrMv} as created by \code{\link{makeSECdistr}} or \code{\link{extractSECdistr}}; if this argument is used, arguments \code{dp} and \code{family} must not be set, and \emph{vice versa}. } } \value{a numeric vector} \section{Background}{The mode is obtained through numerical maximization. In the multivariate case, the problem is reduced to a one-dimensional search using Propositions 5.14 and 6.2 of the reference below.} \references{ Azzalini, A. with the collaboration of Capitanio, A. (2014). \emph{The Skew-Normal and Related Families}. Cambridge University Press, IMS Monographs series. } \seealso{\code{\link{makeSECdistr}} and \code{\link{extractSECdistr}} for additional information and for constructing a suitable \code{object}, \code{\link{SECdistrUv-class}} and \code{\link{SECdistrMv-class}} for methods \code{mean} and \code{vcov} which compute the mean (vector) and the variance (matrix) of the \code{object} distribution } \examples{ dp3 <- list(xi=1:3, Omega=toeplitz(1/(1:3)), alpha=c(3,-1,2), nu=5) st3 <- makeSECdistr(dp3, family="ST", name="ST3", compNames=c("U", "V", "W")) mode1 <- modeSECdistr(dp3, "ST") mode2 <- modeSECdistr(object=st3) # the same of mode1 } \keyword{multivariate} \keyword{distribution} sn/man/extractSECdistr.Rd0000644000176200001440000000414114025314127015006 0ustar liggesusers% file sn/man/extractSECdistr.Rd % This file is a component of the package 'sn' for R % copyright (C) 2013 Adelchi Azzalini %--------------------- \name{extractSECdistr} \alias{extractSECdistr} \concept{skew-elliptical distribution} \title{Extract the SEC error distribution from an object created by \code{selm}} \description{ Given an object created by a call to \code{selm}, the function delivers the \acronym{SEC} distribution representing the stochastic term of the fitted model } \usage{ extractSECdistr(object, name, compNames) } \arguments{ \item{object}{an object of class \code{selm} or \code{mselm}, as created by \code{\link{selm}}.} \item{name}{an optional character string representing the name of the outcome distribution; if missing, a string is constructed from the \code{object} ingredients.} \item{compNames}{in the multivariate case, an optional vector of character strings with the names of the components of the error distribution; if missing, one such vector is constructed from the \code{object} ingredients.} } \value{An object of class \code{SECdistrMv} or \code{SECdistrUv}, depending of the class of \code{object}.} \section{Details}{ When the formula of the fitted model includes only the constant \code{1}, the returned object represents the fitted \acronym{SEC} distribution. If the formula includes additional terms, the linear predictor is eliminated and the returned object corresponds to the error term of the model; hence the location parameter \code{xi} in the \acronym{DP} parameterization is set to zero. The returned object can be submitted to tools available for objects created by \code{\link{makeSECdistr}}, such as \code{\link{summary.SECdistr}}, \code{\link{conditionalSECdistr}} and and so on.} \seealso{\code{\link{selm}}, \code{\link{makeSECdistr}}} \examples{ data(ais) m2 <- selm(log(Fe) ~ 1, family="ST", data=ais, fixed=list(nu=8)) f2 <- extractSECdistr(m2) show(f2) # m4 <- selm(cbind(BMI, LBM) ~ 1, family="SN", data=ais) f4 <- extractSECdistr(m4) mean(f4) vcov(f4) } \keyword{multivariate} \keyword{distribution} sn/man/frontier.Rd0000644000176200001440000000143013047130133013555 0ustar liggesusers% file sn/man/frontier.Rd % This file is a component of the package 'sn' for R % copyright (C) 1998 Adelchi Azzalini %--------------------- \name{frontier} \alias{frontier} \title{Simulated sample from a skew-normal distribution} \usage{data(frontier)} \description{ A sample simulated from the SN(0,1,5) distribution with sample coefficient of skewness inside the admissible range (-0.9952719, 0.9952719) for the skew-normal family but maximum likelihood estimate on the frontier of the parameter space. } \format{A numeric vector of length 50.} \source{Generated by a run of \code{rsn(50, 0, 1, 5)}.} \examples{ data(frontier, package="sn") fit <- selm(frontier ~ 1) plot(fit, which=2) # fit.p <- selm(frontier ~ 1, method="MPLE") plot(fit.p, which=2) } \keyword{datasets} sn/man/spread.grouped.Rd0000644000176200001440000000252114267530666014675 0ustar liggesusers\name{spread.grouped} \alias{spread.grouped} \title{Spreading grouped data over intervals} \description{ Assuming that \code{counts} represents the frequencies of observations falling into intervals identified by \code{breaks}, the function returns a vector of values obtained by uniformly spreading each group of data over the pertaining interval. } \usage{spread.grouped(breaks, counts, shift = "centre")} \arguments{ \item{breaks}{A numeric vector of strictly increasing finite values which identify a set of contiguous intervals on the real line.} \item{counts}{A vector of non-negative integers representing the number of observations falling in the intervals specified by \code{breaks}; it is then required that \code{length(counts)+1=length(breaks)}. } \item{shift}{a character string which regulates the positioning of the constructed points within a given interval, with possible values \code{"left"}, \code{"center"} (default choice) and \code{"right"}, possibly abbreviated.} } \value{A numeric vector of length \code{sum(counts)} of values within \code{range(breaks)}.} \author{Adelchi Azzalini} \seealso{fitdistr.grouped} \examples{ breaks <- c(10, 12, 15, 20) counts <- c(3, 2, 4) spread.grouped(breaks, counts) spread.grouped(breaks, counts, "l") } \keyword{manip} \concept{grouped data} sn/man/fitdistr.grouped.Rd0000644000176200001440000001245114270442565015244 0ustar liggesusers% file sn/man/fitdistr.grouped.Rd % This file is a component of the package 'sn' for R % copyright (C) 2022 Adelchi Azzalini % \name{fitdistr.grouped} \alias{fitdistr.grouped} \title{ Maximum-likelihood fitting of a univariate distribution from grouped data } \description{ Maximum-likelihood fitting of a univariate distribution when the data are represented by a set of frequencies pertaining to given set of contiguous intervals. } \usage{ fitdistr.grouped(breaks, counts, family, weights, trace = FALSE, wpar = NULL) } \arguments{ \item{breaks}{A numeric vector of strictly increasing values which identify a set of contiguous intervals on the real line. See \sQuote{Details} for additional information.} \item{counts}{A vector of non-negative integers representing the number of observations falling in the intervals specified by \code{breaks}; it is then required that \code{length(counts)+1=length(breaks)}. } \item{family}{A character string specifying the parametric family of distributions to be used for fitted. Admissible names are: \code{"normal"}, \code{"logistic"}, \code{"t"}, \code{"Cauchy"}, \code{"SN"}, \code{"ST"}, \code{"SC"}, \code{"gamma"}, \code{"Weibull"}; the names \code{"gaussian"} and \code{"Gaussian"} are also allowed, and are converted to \code{"normal"}.} \item{weights}{An alias for \code{counts}, allowed for analogy with the \code{selm} function.} \item{trace}{A logical value which indicates whether intermediate evaluations of the optimization process are printed (default: \code{FALSE}).} \item{wpar}{ An optional vector with initial values of the \sQuote{working parameters} for starting the maximization of the log-likelihood function; see \sQuote{Details} for their description. } } \details{ The original motivation of this function was fitting a univariate \acronym{SN}, \acronym{ST} or \acronym{SC} distribution from grouped data; its scope was later extended to include some other continuous distributions. The adopted name of the function reflects the broad similarity of its purpose with the one of \code{\link[MASS]{fitdistr}}, but there are substantial differences in the actual working of the two functions. The parameter set of a given \code{family} is the same as appearing in the corresponding \code{d} function, with the exception of the \code{"t"} distribution, for which a location and a scale parameter are included, besides \code{df}. The range of \code{breaks} does not need to span the whole support of the chosen \code{family} of distributions, that is, \code{(0, Inf)} for \code{"Weibull"} and \code{"gamma"} families, \code{(-Inf, Inf)} for the other families. In fact, for the purpose of post-fitting plotting, an infinite \code{range(breaks)} represents a complication, requiring an \emph{ad hoc} handling; so it is sensible to avoid it. However, at the maximum-likelihood fitting stage, the full support of the probability distribution is considered, with the following implications. If \code{max(breaks)=xR}, say, and \code{xR