MCEstimator {distrMod} | R Documentation |
The function MCEstimator
provides a general way to compute
estimates for a given parametric family of probability measures which
can be obtain by minimizing a certain criterion. For instance,
the negative log-Likelihood in case of the maximum likelihood
estimator or some distance between distributions like in
case of minimum distance estimators.
MCEstimator(x, ParamFamily, criterion, crit.name, startPar = NULL, Infos, trafo = NULL, penalty = 0, validity.check = TRUE, asvar.fct, ...)
x |
(empirical) data |
ParamFamily |
object of class "ParamFamily" |
criterion |
function: criterion to minimize; see Details section. |
crit.name |
optional name for criterion. |
startPar |
initial information used by optimize resp. optim ;
i.e; if (total) parameter is of length 1, startPar is
a search interval, else it is an initial parameter value; if NULL
slot startPar of ParamFamily is used to produce it;
in the multivariate case, startPar may also be of class Estimate ,
in which case slot untransformed.estimate is used. |
Infos |
character: optional informations about estimator |
trafo |
an object of class MatrixorFunction – a transformation
for the main parameter |
penalty |
(non-negative) numeric: penalizes non valid parameter-values |
validity.check |
logical: shall return parameter value be checked for
validity? Defaults to yes (TRUE ) |
asvar.fct |
optionally: a function to determine the corresponding
asymptotic variance; if given, asvar.fct takes arguments
L2Fam ((the parametric model as object of class L2ParamFamily ))
and param (the parameter value as object of class
ParamFamParameter ); arguments are called by name; asvar.fct
may also process further arguments passed through the ... argument |
... |
further arguments to criterion or optimize
or optim , respectively. |
The argument criterion
has to be a function with arguments the
empirical data as well as an object of class "Distribution"
and possibly ...
. Uses mceCalc
for method dispatch.
An object of S4-class "MCEstimate"
which inherits from class
"Estimate"
.
Matthias Kohl Matthias.Kohl@stamats.de,
Peter Ruckdeschel Peter.Ruckdeschel@itwm.fraunhofer.de
ParamFamily-class
, ParamFamily
,
MCEstimate-class
## (empirical) Data x <- rgamma(50, scale = 0.5, shape = 3) ## parametric family of probability measures G <- GammaFamily(scale = 1, shape = 2) ## Maximum Likelihood estimator ## Note: you can directly use function MLEstimator! negLoglikelihood <- function(x, Distribution){ res <- -sum(log(Distribution@d(x))) names(res) <- "Negative Log-Likelihood" return(res) } MCEstimator(x = x, ParamFamily = G, criterion = negLoglikelihood) ## Kolmogorov(-Smirnov) minimum distance estimator ## Note: you can also use function MDEstimator! MCEstimator(x = x, ParamFamily = G, criterion = KolmogorovDist, crit.name = "Kolmogorov distance") ## Total variation minimum distance estimator ## Note: you can also use function MDEstimator! ## discretize Gamma distribution MCEstimator(x = x, ParamFamily = G, criterion = TotalVarDist, crit.name = "Total variation distance") ## or smooth empirical distribution (takes some time!) #MCEstimator(x = x, ParamFamily = G, criterion = TotalVarDist, # asis.smooth.discretize = "smooth", crit.name = "Total variation distance") ## Hellinger minimum distance estimator ## Note: you can also use function MDEstimator! ## discretize Gamma distribution distroptions(DistrResolution = 1e-8) MCEstimator(x = x, ParamFamily = G, criterion = HellingerDist, crit.name = "Hellinger Distance", startPar = c(1,2)) distroptions(DistrResolution = 1e-6) ## or smooth empirical distribution (takes some time!) #MCEstimator(x = x, ParamFamily = G, criterion = HellingerDist, # asis.smooth.discretize = "smooth", crit.name = "Hellinger distance")