Function to compute minimum criterion estimates
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 = 1e20, validity.check = TRUE, asvar.fct, na.rm = TRUE, ..., .withEvalAsVar = TRUE, nmsffx = "", .with.checkEstClassForParamFamily = TRUE)
x |
(empirical) data |
ParamFamily |
object of class |
criterion |
function: criterion to minimize; see Details section. |
crit.name |
optional name for criterion. |
startPar |
initial information used by |
Infos |
character: optional informations about estimator |
trafo |
an object of class |
penalty |
(non-negative) numeric: penalizes non valid parameter-values |
validity.check |
logical: shall return parameter value be checked for
validity? Defaults to yes ( |
asvar.fct |
optionally: a function to determine the corresponding
asymptotic variance; if given, |
na.rm |
logical: if |
... |
further arguments to |
.withEvalAsVar |
logical: shall slot |
nmsffx |
character: a potential suffix to be appended to the estimator name. |
.with.checkEstClassForParamFamily |
logical: Should a the end of the
function |
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"
.
The criterion function may be called together with a parameter thetaPar
which is the current parameter value under consideration, i.e.; the value
under which the model distribution is considered. Hence, if desired,
particular criterion functions could make use of this information, by, say
computing the criterion differently for different parameter values.
Matthias Kohl Matthias.Kohl@stamats.de,
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de
## (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 ## IGNORE_RDIFF_BEGIN MCEstimator(x = x, ParamFamily = G, criterion = TotalVarDist, crit.name = "Total variation distance") ## IGNORE_RDIFF_END ## 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")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.