msedist  R Documentation 
Fit of univariate distribution by maximizing (log) spacings for non censored data.
msedist(data, distr, phidiv="KL", power.phidiv=NULL, start = NULL, fix.arg = NULL,
optim.method = "default", lower = Inf, upper = Inf, custom.optim = NULL,
weights=NULL, silent = TRUE, gradient = NULL, checkstartfix=FALSE, ...)
data 
A numeric vector for non censored data. 
distr 
A character string 
phidiv 
A character string coding for the name of the phidivergence used :

power.phidiv 
If relevant, a numeric for the power used in some phidivergence :
should be 
start 
A named list giving the initial values of parameters of the named distribution
or a function of data computing initial values and returning a named list.
This argument may be omitted (default) for some distributions for which reasonable
starting values are computed (see the 'details' section of 
fix.arg 
An optional named list giving the values of fixed parameters of the named distribution or a function of data computing (fixed) parameter values and returning a named list. Parameters with fixed value are thus NOT estimated. 
optim.method 

lower 
Left bounds on the parameters for the 
upper 
Right bounds on the parameters for the 
custom.optim 
a function carrying the optimization. 
weights 
an optional vector of weights to be used in the fitting process.
Should be 
silent 
A logical to remove or show warnings when bootstraping. 
gradient 
A function to return the gradient of the gof distance for the 
checkstartfix 
A logical to test starting and fixed values. Do not change it. 
... 
further arguments passed to the 
The msedist
function numerically maximizes a phidivergence function of spacings,
where spacings are the differences of the cumulative distribution function evaluated at
the sorted dataset.
The classical maximum spacing estimation (MSE) was introduced by Cheng and Amin (1986)
and Ranneby (1984) independently where the phidiverence is the logarithm,
see Anatolyev and Kosenok (2005) for a link between MSE and maximum likelihood estimation.
MSE was generalized by Ranneby and Ekstrom (1997) by allowing different phidivergence function. Generalized MSE maximizes
S_n(\theta)=\frac{1}{n+1}\sum_{i=1}^{n+1} \phi\left(F(x_{(i)}; \theta)F(x_{(i1)}; \theta) \right),
where F(;\theta)
is the parametric distribution function to be fitted,
\phi
is the phidivergence function,
x_{(1)}<\dots<x_{(n)}
is the sorted sample,
x_{(0)}=\infty
and x_{(n+1)}=+\infty
.
The possible phidivergence function is
KullbackLeibler information (when phidiv="KL"
and corresponds to classical MSE)
\phi(x)=\log(x)
Jeffreys' divergence (when phidiv="J"
)
\phi(x)=(1x)\log(x)
Renyi's divergence (when phidiv="R"
and power.phidiv=alpha
)
\phi(x)=x^\alpha\times\textrm{sign}(1\alpha) \textrm{ with } \alpha>0, \alpha\neq 1
Hellinger distance (when phidiv="H"
and power.phidiv=p
)
\phi(x)=1x^{1/p}^p \textrm{ with } p\ge 1
Vajda's measure of information (when phidiv="V"
and power.phidiv=beta
)
\phi(x)=1x^\beta \textrm{ with } \beta\ge 1
The optimization process is the same as mledist
, see the 'details' section
of that function.
This function is not intended to be called directly but is internally called in
fitdist
and bootdist
.
This function is intended to be used only with noncensored data.
NB: if your data values are particularly small or large, a scaling may be needed
before the optimization process, see mledist
's examples.
msedist
returns a list with following components,
estimate 
the parameter estimates. 
convergence 
an integer code for the convergence of 
value 
the minimal value reached for the criterion to minimize. 
hessian 
a symmetric matrix computed by 
optim.function 
the name of the optimization function used for maximum likelihood. 
optim.method 
when 
fix.arg 
the named list giving the values of parameters of the named distribution
that must kept fixed rather than estimated by maximum likelihood or 
fix.arg.fun 
the function used to set the value of 
weights 
the vector of weigths used in the estimation process or 
counts 
A twoelement integer vector giving the number of calls
to the loglikelihood function and its gradient respectively.
This excludes those calls needed to compute the Hessian, if requested,
and any calls to loglikelihood function to compute a finitedifference
approximation to the gradient. 
optim.message 
A character string giving any additional information
returned by the optimizer, or 
loglik 
the loglikelihood value. 
phidiv 
The character string coding for the name of the phidivergence used
either 
power.phidiv 
Either 
MarieLaure DelignetteMuller and Christophe Dutang.
Anatolyev, S., and Kosenok, G. (2005). An alternative to maximum likelihood based on spacings. Econometric Theory, 21(2), 472476.
Cheng, R.C.H. and N.A.K. Amin (1983) Estimating parameters in continuous univariate distributions with a shifted origin. Journal of the Royal Statistical Society Series B 45, 394403.
Ranneby, B. (1984) The maximum spacing method: An estimation method related to the maximum likelihood method. Scandinavian Journal of Statistics 11, 93112.
Ranneby, B. and Ekstroem, M. (1997). Maximum spacing estimates based on different metrics. Umea universitet.
mmedist
, mledist
, qmedist
, mgedist
,
fitdist
for other estimation methods.
# (1) Fit of a Weibull distribution to serving size data by maximum
# spacing estimation
#
data(groundbeef)
serving < groundbeef$serving
msedist(serving, "weibull")
# (2) Fit of an exponential distribution
#
set.seed(123)
x1 < rexp(1e3)
#the convergence is quick
msedist(x1, "exp", control=list(trace=0, REPORT=1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.