mde  R Documentation 
Minimum distance fitting of univariate distributions, allowing parameters to be held fixed if desired.
mde(x, fun, start, measure = c("CvM", "chisquare", "LAS"),
weights = NULL, ...)
x 
a vector or an object of class 
fun 
function returning a cumulative distribution (for

start 
a named list giving the parameters to be optimized with initial values 
measure 
either 
weights 
weights; see Details. 
... 
Additional parameters, either for 
The Cramervon Mises method ("CvM"
) minimizes the squared
difference between the theoretical cdf and the empirical cdf at the
data points (for individual data) or the ogive at the knots (for
grouped data).
The modified chisquare method ("chisquare"
) minimizes the
modified chisquare statistic for grouped data, that is the squared
difference between the expected and observed frequency within each
group.
The layer average severity method ("LAS"
) minimizes the
squared difference between the theoretical and empirical limited
expected value within each group for grouped data.
All sum of squares can be weighted. If arguments weights
is
missing, weights default to 1 for measure = "CvM"
and
measure = "LAS"
; for measure = "chisquare"
, weights
default to 1/n_j
, where n_j
is the frequency
in group j = 1, \dots, r
.
Optimization is performed using optim
. For
onedimensional problems the NelderMead method is used and for
multidimensional problems the BFGS method, unless arguments named
lower
or upper
are supplied when LBFGSB
is used
or method
is supplied explicitly.
An object of class "mde"
, a list with two components:
estimate 
the parameter estimates, and 
distance 
the distance. 
Vincent Goulet vincent.goulet@act.ulaval.ca and Mathieu Pigeon
Klugman, S. A., Panjer, H. H. and Willmot, G. E. (1998), Loss Models, From Data to Decisions, Wiley.
## Individual data example
data(dental)
mde(dental, pexp, start = list(rate = 1/200), measure = "CvM")
## Example 2.21 of Klugman et al. (1998)
data(gdental)
mde(gdental, pexp, start = list(rate = 1/200), measure = "CvM")
mde(gdental, pexp, start = list(rate = 1/200), measure = "chisquare")
mde(gdental, levexp, start = list(rate = 1/200), measure = "LAS")
## Twoparameter distribution example
try(mde(gdental, ppareto, start = list(shape = 3, scale = 600),
measure = "CvM")) # no convergence
## Working in log scale often solves the problem
pparetolog < function(x, shape, scale)
ppareto(x, exp(shape), exp(scale))
( p < mde(gdental, pparetolog, start = list(shape = log(3),
scale = log(600)), measure = "CvM") )
exp(p$estimate)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.