[Distr-commits] r1245 - in branches/distr-2.8/pkg/distrMod: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Aug 5 22:56:37 CEST 2018
Author: ruckdeschel
Date: 2018-08-05 22:56:37 +0200 (Sun, 05 Aug 2018)
New Revision: 1245
Modified:
branches/distr-2.8/pkg/distrMod/R/MCEstimator.R
branches/distr-2.8/pkg/distrMod/R/MDEstimator.R
branches/distr-2.8/pkg/distrMod/R/MLEstimator.R
branches/distr-2.8/pkg/distrMod/R/asCvMVarianceQtl.R
branches/distr-2.8/pkg/distrMod/R/internalMleCalc.R
branches/distr-2.8/pkg/distrMod/R/mleCalc-methods.R
branches/distr-2.8/pkg/distrMod/inst/NEWS
branches/distr-2.8/pkg/distrMod/man/MCEstimator.Rd
branches/distr-2.8/pkg/distrMod/man/MDEstimator.Rd
branches/distr-2.8/pkg/distrMod/man/MLEstimator.Rd
branches/distr-2.8/pkg/distrMod/man/internalmleHelpers.Rd
Log:
[distrMod] branch 2.8
+ some fiddeling with the names of MCEstimators:
all functions MDEstimator, CvMMDEstimator, KolmogorovMDEstimator, TotalVarMDEstimator,
HellingerMDEstimator, MLEstimator, MCEstimator gain an extra argument nmsffx for
potential suffices to be appended to the estimator name.
+ in MDEstimator with Cramer von Mises distance in case
* distance == CvMDist && !is.null(mu) -> "( mu = <muname> )"
* distance == CvMDist && is.null(mu) -> "( mu = emp. cdf )"
* distance == CvMDist2 -> "( mu = model distr. )"
is appended to the default estimator name
+ similarly in wrapper CvMMDEstimator in case argument 'muDatOrMod' is matched to
* muDatOrMod=="Dat" -> "( mu = emp. cdf )"
* muDatOrMod=="Mod" -> "( mu = model distr. )"
* muDatOrMod=="Other" -> "( mu = <muname> )"
is appended to the default estimator name
+ based on this tag "( mu = ... )" later on, in pkg RobAStBase, a (conditional)
coerce method produces the pIC of the MDE by means of .CvMMDCovariance[WithMux]
Modified: branches/distr-2.8/pkg/distrMod/R/MCEstimator.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/MCEstimator.R 2018-08-05 16:04:51 UTC (rev 1244)
+++ branches/distr-2.8/pkg/distrMod/R/MCEstimator.R 2018-08-05 20:56:37 UTC (rev 1245)
@@ -4,7 +4,8 @@
MCEstimator <- function(x, ParamFamily, criterion, crit.name,
startPar = NULL,
Infos, trafo = NULL, penalty = 1e20, validity.check = TRUE,
- asvar.fct, na.rm = TRUE, ..., .withEvalAsVar = TRUE){
+ asvar.fct, na.rm = TRUE, ..., .withEvalAsVar = TRUE,
+ nmsffx = ""){
## preparation: getting the matched call
es.call <- match.call()
@@ -33,8 +34,8 @@
if(missing(crit.name)) crit.name <- ""
argList <- c(argList, crit.name = crit.name)
if(!is.null(dots)) argList <- c(argList, dots)
+# print(argList)
-
## call to mceCalc
res0 <- do.call(mceCalc, argList)
@@ -54,6 +55,7 @@
if(!is.null(asv)) argList <- c(argList, asvar.fct = asv)
if(!is.null(dots)) argList <- c(argList, dots)
argList <- c(argList, x = x)
+ if(any(nmsffx!="")) argList <- c(argList, nmsffx = nmsffx)
## digesting the results of mceCalc
res <- do.call(.process.meCalcRes, argList)
Modified: branches/distr-2.8/pkg/distrMod/R/MDEstimator.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/MDEstimator.R 2018-08-05 16:04:51 UTC (rev 1244)
+++ branches/distr-2.8/pkg/distrMod/R/MDEstimator.R 2018-08-05 20:56:37 UTC (rev 1245)
@@ -6,12 +6,14 @@
startPar = NULL, Infos,
trafo = NULL, penalty = 1e20,
validity.check = TRUE, asvar.fct, na.rm = TRUE,
- ..., .withEvalAsVar = TRUE){
+ ..., .withEvalAsVar = TRUE, nmsffx = ""){
## preparation: getting the matched call
es.call <- match.call()
dots <- match.call(expand.dots = FALSE)$"..."
+ distfc <- paste(substitute(distance))
+
completecases <- complete.cases(x)
if(na.rm) x <- na.omit(x)
@@ -19,12 +21,35 @@
if(!is.numeric(x))
stop(gettext("'x' has to be a numeric vector"))
if(is.null(startPar)) startPar <- startPar(ParamFamily)(x,...)
- if(missing(dist.name))
- dist.name <- names(distance(x, ParamFamily at distribution))
+ if(missing(dist.name)){
+ dist.name0 <- names(distance(x, ParamFamily at distribution))
+# print(dist.name0)
+# print(str(dist.name0))
+ dist.name <- gsub("(.+distance).+","\\1", dist.name0)
+ nmsffx <- paste(
+ gsub(".+distance","",gsub("(.+distance) (.+)","\\2", dist.name0)),
+ nmsffx, collapse=" ")
+ if(distfc=="CvMDist2"){
+ dist.name <- "CvM distance"
+ nmsffx <- paste("( mu = model distr. )",nmsffx, collapse=" ")
+ }
+ if(distfc=="CvMDist"&&is.null(dots$mu)){
+ dist.name <- "CvM distance"
+ nmsffx <- paste("( mu = emp. cdf )",nmsffx, collapse=" ")
+ }
+ if(distfc=="CvMDist"&&!is.null(dots$mu)){
+ muc <- paste(deparse((dots$mu)))
+ dots$mu <- eval(dots$mu)
+ dist.name <- "CvM distance"
+ nmsffx <- paste("( mu = ", muc, ")", nmsffx, collapse=" ")
+ }
+ }
+
if(paramDepDist) dots$thetaPar <-NULL
- distanceFctWithoutVal <- function(e1,e2,check.validity=NULL,...) distance(e1,e2,...)
+ distanceFctWithoutVal <- function(e1,e2,check.validity=NULL,...)
+ distance(e1,e2,...)
## manipulation of the arg list to method mceCalc
argList <- c(list(x = x, PFam = ParamFamily, criterion = distanceFctWithoutVal,
startPar = startPar, penalty = penalty,
@@ -53,6 +78,7 @@
if(!validity.check %in% names(argList))
argList$validity.check <- TRUE
argList <- c(argList, x = x)
+ if(any(nmsffx!="")) argList <- c(argList, nmsffx = nmsffx)
## digesting the results of mceCalc
res <- do.call(.process.meCalcRes, argList)
@@ -61,22 +87,40 @@
return(.checkEstClassForParamFamily(ParamFamily,res))
}
-CvMMDEstimator <- function(x, ParamFamily, muDatOrMod = c("Dat","Mod"),
+CvMMDEstimator <- function(x, ParamFamily, muDatOrMod = c("Dat","Mod", "Other"),
+ mu = NULL,
paramDepDist = FALSE,
startPar = NULL, Infos,
trafo = NULL, penalty = 1e20,
validity.check = TRUE, asvar.fct = .CvMMDCovariance,
- na.rm = TRUE, ..., .withEvalAsVar = TRUE){
+ na.rm = TRUE, ..., .withEvalAsVar = TRUE,
+ nmsffx = ""){
muDatOrMod <- match.arg(muDatOrMod)
if(muDatOrMod=="Dat") {
distance0 <- CvMDist
- estnsffx <- "(mu = emp. cdf)"
+ estnsffx <- "( mu = emp. cdf )"
if(missing(asvar.fct)) asvar.fct <- .CvMMDCovarianceWithMux
}else{
- distance0 <- CvMDist2
- estnsffx <- "(mu = model distr.)"
- if(missing(asvar.fct)) asvar.fct <- .CvMMDCovariance
+ if(muDatOrMod=="Mod") {
+ distance0 <- CvMDist2
+ estnsffx <- "( mu = model distr. )"
+ if(missing(asvar.fct)) asvar.fct <- .CvMMDCovariance
+ }else{
+ if(missing(mu)||is.null(mu))
+ stop(gettextf("This choice of 'muDatOrMod' requires a non-null 'mu'"))
+ muc <- paste(deparse(substitute(mu)))
+ distance0 <- function(e1,e2,... ) CvMDist(e1, e2, mu = mu, ...)
+ estnsffx <- paste("( mu = ", muc, ")")
+ if(missing(asvar.fct))
+ asvar.fct <- function(L2Fam, param, N = 400, rel.tol=.Machine$double.eps^0.3,
+ TruncQuantile = getdistrOption("TruncQuantile"),
+ IQR.fac = 15, ...){
+ .CvMMDCovariance(L2Fam=L2Fam, param=param, mu=eval(mu),
+ withplot = FALSE, withpreIC = FALSE,
+ N = N, rel.tol=rel.tol, TruncQuantile = TruncQuantile,
+ IQR.fac = IQR.fac, ...)}
+ }
}
res <- MDEstimator(x = x, ParamFamily = ParamFamily, distance = distance0,
@@ -84,7 +128,8 @@
trafo = trafo, penalty = penalty, validity.check = validity.check,
asvar.fct = asvar.fct, na.rm = na.rm,
..., .withEvalAsVar = .withEvalAsVar)
- res at name <- paste("Minimum CvM distance estimate", estnsffx)
+# print(list(estnsffx, nmsffx))
+ res at name <- paste("Minimum CvM distance estimate", estnsffx, nmsffx, collapse="")
res at estimate.call <- match.call()
return(res)
}
@@ -93,12 +138,12 @@
startPar = NULL, Infos,
trafo = NULL, penalty = 1e20,
validity.check = TRUE, asvar.fct, na.rm = TRUE, ...,
- .withEvalAsVar = TRUE){
+ .withEvalAsVar = TRUE, nmsffx = ""){
res <- MDEstimator(x = x, ParamFamily = ParamFamily, distance = KolmogorovDist,
paramDepDist = paramDepDist, startPar = startPar, Infos = Infos,
trafo = trafo, penalty = penalty, validity.check = validity.check,
asvar.fct = asvar.fct, na.rm = na.rm,
- ..., .withEvalAsVar = .withEvalAsVar)
+ ..., .withEvalAsVar = .withEvalAsVar, nmsffx = nmsffx)
res at estimate.call <- match.call()
return(res)
}
@@ -107,12 +152,12 @@
startPar = NULL, Infos,
trafo = NULL, penalty = 1e20,
validity.check = TRUE, asvar.fct, na.rm = TRUE, ...,
- .withEvalAsVar = TRUE){
+ .withEvalAsVar = TRUE, nmsffx = ""){
res <- MDEstimator(x = x, ParamFamily = ParamFamily, distance = TotalVarDist,
paramDepDist = paramDepDist, startPar = startPar, Infos = Infos,
trafo = trafo, penalty = penalty, validity.check = validity.check,
asvar.fct = asvar.fct, na.rm = na.rm,
- ..., .withEvalAsVar = .withEvalAsVar)
+ ..., .withEvalAsVar = .withEvalAsVar, nmsffx = nmsffx)
res at estimate.call <- match.call()
return(res)
}
@@ -121,12 +166,12 @@
startPar = NULL, Infos,
trafo = NULL, penalty = 1e20,
validity.check = TRUE, asvar.fct, na.rm = TRUE, ...,
- .withEvalAsVar = TRUE){
+ .withEvalAsVar = TRUE, nmsffx = ""){
res <- MDEstimator(x = x, ParamFamily = ParamFamily, distance = HellingerDist,
paramDepDist = paramDepDist, startPar = startPar, Infos = Infos,
trafo = trafo, penalty = penalty, validity.check = validity.check,
asvar.fct = asvar.fct, na.rm = na.rm,
- ..., .withEvalAsVar = .withEvalAsVar)
+ ..., .withEvalAsVar = .withEvalAsVar, nmsffx = nmsffx)
res at estimate.call <- match.call()
return(res)
}
Modified: branches/distr-2.8/pkg/distrMod/R/MLEstimator.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/MLEstimator.R 2018-08-05 16:04:51 UTC (rev 1244)
+++ branches/distr-2.8/pkg/distrMod/R/MLEstimator.R 2018-08-05 20:56:37 UTC (rev 1245)
@@ -8,7 +8,8 @@
Infos, trafo = NULL, penalty = 1e20,
validity.check = TRUE, na.rm = TRUE,
..., .withEvalAsVar = TRUE,
- dropZeroDensity = TRUE){
+ dropZeroDensity = TRUE,
+ nmsffx = ""){
## preparation: getting the matched call
es.call <- match.call()
@@ -49,6 +50,7 @@
if(!is.null(asv)) argList <- c(argList, asvar.fct = asv)
if(!is.null(dots)) argList <- c(argList, dots)
argList <- c(argList, x = x)
+ if(any(nmsffx!="")) argList <- c(argList, nmsffx = nmsffx)
## digesting the results of mceCalc
res <- do.call(what = ".process.meCalcRes", args = argList)
Modified: branches/distr-2.8/pkg/distrMod/R/asCvMVarianceQtl.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/asCvMVarianceQtl.R 2018-08-05 16:04:51 UTC (rev 1244)
+++ branches/distr-2.8/pkg/distrMod/R/asCvMVarianceQtl.R 2018-08-05 20:56:37 UTC (rev 1245)
@@ -10,7 +10,11 @@
IQR.fac = IQR.fac, ...)
}
-CvMDist2 <- function(e1,e2,... ) CvMDist(e1, e2, mu = e2, ...)
+CvMDist2 <- function(e1,e2,... ) {res <- CvMDist(e1, e2, mu = e2, ...)
+ e2c <- paste(deparse(substitute(e2)))
+ if(length(e2c) == 1)
+ names(res) <- paste("CvM distance ( mu =", e2c,")")
+ return(res)}
### 20180805: new function to compute asCov of CvM-MDE
# which for the primitive functions uses integration on [0,1]
Modified: branches/distr-2.8/pkg/distrMod/R/internalMleCalc.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/internalMleCalc.R 2018-08-05 16:04:51 UTC (rev 1244)
+++ branches/distr-2.8/pkg/distrMod/R/internalMleCalc.R 2018-08-05 20:56:37 UTC (rev 1245)
@@ -24,7 +24,7 @@
##########################################################################
.process.meCalcRes <- function(res, PFam, trafo, res.name, call,
asvar.fct, check.validity, ...,
- .withEvalAsVar = TRUE, x = NULL){
+ .withEvalAsVar = TRUE, x = NULL, nmsffx = ""){
lmx <- length(main(PFam))
lnx <- length(nuisance(PFam))
@@ -51,6 +51,7 @@
est.name <- if(crit.name=="") "Minimum criterion estimate" else
paste("Minimum", crit.name, "estimate", sep = " ")
+ if(any(nmsffx != "")) est.name <- paste(est.name, nmsffx, collapse=" ")
if(is.null(res$Infos))
Infos <- matrix(c(character(0),character(0)), ncol=2,
dimnames=list(character(0), c("method", "message")))
@@ -99,12 +100,14 @@
if("x" %in% names(formals(asvar.fct)))
asvarArgList <- c(asvarArgList, x=x)
asvar.try <- try(do.call(asvar.fct, asvarArgList), silent = TRUE)
+# print(asvar.try)
as0 <- if(is(asvar.try,"try-error")) NULL else asvar.try
return(as0)
}
asvar <- substitute(do.call(asfct, args=c(list(PFam0, param0, ...))),
list(asfct=asvar.tfct, PFam0=PFam, param0=param))
}
+# print(eval(asvar))
if(.withEvalAsVar) asvar <- eval(asvar)
untransformed.estimate <- theta
Modified: branches/distr-2.8/pkg/distrMod/R/mleCalc-methods.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/mleCalc-methods.R 2018-08-05 16:04:51 UTC (rev 1244)
+++ branches/distr-2.8/pkg/distrMod/R/mleCalc-methods.R 2018-08-05 20:56:37 UTC (rev 1245)
@@ -114,7 +114,9 @@
# mceCalcDots1 <- match.call(call = sys.call(sys.parent(1)),
# expand.dots = FALSE)$"..."
- mceCalcDots <- match.call(expand.dots = FALSE)$"..."
+ mceCalcDots <- list(...)
+# cat("------------\n");print(mceCalcDots);cat("------------\n");
+
filterDots <- function(dots){
if(length(dots)){
dotsOptIz <- NULL
@@ -155,14 +157,25 @@
if(length(dotsForCrit)==0) dotsForCrit <- NULL
}
dotsForOpt <- c(dotsOptIz,dotsForCrit[!names(dotsForCrit)%in% nOptProh])
- return(list(dotsForOpt=dotsForOpt, dotsCrit=dotsForCrit))
+ return(list(dotsForOpt=dotsForOpt, dotsCrit=dotsForCrit, dotsOnlyOpt=dotsOptIz))
}else return(NULL)
}
dotsToPass <- do.call(filterDots, list(mceCalcDots))
+# print(dotsToPass)
+# print(names(dotsToPass$dotsCrit))
allwarns <- character(0)
fun <- function(theta, Data, ParamFamily, criterionF, ...){
vP <- TRUE
+ dotsfun <- list(...)
+ names(dotsfun) <- gsub("dotsForC\\.","",names(dotsfun))
+# cat(".....\n");print(dotsfun);cat(".....\n")
+# cat("!!!!\n")
+# print(names(dotsfun))
+# print(names(dotsToPass$dotsCrit))
+# cat("!!!!\n")
+ dotsForC0 <- dotsfun[names(dotsfun)%in%names(dotsToPass$dotsCrit)]
+# print(dotsForC0)
if(validity.check) vP <- validParameter(ParamFamily, theta)
if(is.function(penalty)) penalty <- penalty(theta)
if(!vP) {crit0 <- penalty; theta <- mO(theta)
@@ -172,7 +185,8 @@
names(nuisance(ParamFamily)))
else names(theta) <- names(main(ParamFamily))
distr.new <- try(ParamFamily at modifyParam(theta), silent = TRUE)
- argList <- c(list(Data, distr.new), ... )
+ argList <- list(Data, distr.new)
+ if(!is.null(dotsForC0)) argList <- c(argList, dotsForC0)
if(withthetaPar) argList <- c(argList, list(thetaPar = theta))
if(is(distr.new,"try.error")){
crit0 <- penalty
@@ -199,18 +213,26 @@
return(critP)}
if(length(param(PFam)) == 1){
- optres <- do.call(optimize, c(list(f = fun, interval = startPar, Data = x,
- ParamFamily = PFam, criterionF = criterion),
- dotsToPass$dotsForOpt))
+ argsOptimize <- list(f = fun, interval = startPar, Data = x,
+ ParamFamily = PFam, criterionF = criterion)
+ if(!is.null(dotsToPass$dotsOnlyOpt))
+ argsOptimize <- c(argsOptimize, dotsToPass$dotsOnlyOpt)
+ if(!is.null(dotsToPass$dotsCrit))
+ argsOptimize <- c(argsOptimize, dotsForC=dotsToPass$dotsCrit)
+ optres <- do.call(optimize, argsOptimize)
theta <- optres$minimum
names(theta) <- names(main(PFam))
crit <- optres$objective
method <- "optimize"
}else{
if(is(startPar,"Estimate")) startPar <- untransformed.estimate(startPar)
- optres <- do.call(optim, c(list(par = startPar, fn = fun, Data = x,
- ParamFamily = PFam, criterionF = criterion),
- dotsToPass$dotsForOpt))
+ argsOptim <- list(par = startPar, fn = fun, Data = x,
+ ParamFamily = PFam, criterionF = criterion)
+ if(!is.null(dotsToPass$dotsOnlyOpt))
+ argsOptim <- c(argsOptim, dotsToPass$dotsOnlyOpt)
+ if(!is.null(dotsToPass$dotsCrit))
+ argsOptim <- c(argsOptim, dotsForC=dotsToPass$dotsCrit)
+ optres <- do.call(optim, argsOptim)
theta <- as.numeric(optres$par)
names(theta) <- c(names(main(PFam)),names(nuisance(PFam)))
method <- "optim"
@@ -285,6 +307,11 @@
MCEstimator(x = x, ParamFamily = nF, criterion = negLoglikelihood2,
fups="fu")
+fo <- list(a="fu",c=list(b="e",3))
+refo <- MCEstimator(x = x, ParamFamily = nF, criterion = negLoglikelihood2,
+ fups=fo)
+optimReturn(refo)
+
re2 <- MCEstimator(x = x, ParamFamily = nF, criterion = negLoglikelihood2,
fups="fu", hessian = TRUE, fn="LU")
re2
Modified: branches/distr-2.8/pkg/distrMod/inst/NEWS
===================================================================
--- branches/distr-2.8/pkg/distrMod/inst/NEWS 2018-08-05 16:04:51 UTC (rev 1244)
+++ branches/distr-2.8/pkg/distrMod/inst/NEWS 2018-08-05 20:56:37 UTC (rev 1245)
@@ -27,8 +27,10 @@
+ For diagnostic purposes, MCEstimate-class gains a slot optimReturn (of class "ANY" and filled by
NULL by default) which is filled by the return value of the optimizer in "mceCalc" -- it has a
corresponding accessor
-+ distinguish two cases for CvMMDEstimator: mu = emp. cdf (default) and mu = current best fit model distribution
- (controlled by argument muDatOrMod = c("Dat","Mod")) => consistency between estimate and asyCov
++ distinguish three cases for CvMMDEstimator selected by argument muDatOrMod = c("Dat","Mod", "Other"):
+ in case "Dat", mu = emp. cdf (default), in case "Mod", mu = current best fit model distribution,
+ and in case "Other" one has to supply an integration probability mu.
+ => consistency between estimate and asyCov
+ added some theory/references to help file to MD estimators
bug fixes
@@ -59,7 +61,23 @@
+ new wrappe CvMDist2 which by default uses model distribution as mu
+ CvMMDEstimator gains argument muDatOrMod = c("Dat","Mod") to distinguish two cases
+ moved code to .[old]CvMMDCovariance from 0distrModUtils.R to new file asCvMVarianceQtl.R
-
++ some fiddeling with the names of MCEstimators:
+ all functions MDEstimator, CvMMDEstimator, KolmogorovMDEstimator, TotalVarMDEstimator,
+ HellingerMDEstimator, MLEstimator, MCEstimator gain an extra argument nmsffx for
+ potential suffices to be appended to the estimator name.
++ in MDEstimator with Cramer von Mises distance in case
+ * distance == CvMDist && !is.null(mu) -> "( mu = <muname> )"
+ * distance == CvMDist && is.null(mu) -> "( mu = emp. cdf )"
+ * distance == CvMDist2 -> "( mu = model distr. )"
+ is appended to the default estimator name
++ similarly in wrapper CvMMDEstimator in case argument 'muDatOrMod' is matched to
+ * muDatOrMod=="Dat" -> "( mu = emp. cdf )"
+ * muDatOrMod=="Mod" -> "( mu = model distr. )"
+ * muDatOrMod=="Other" -> "( mu = <muname> )"
+ is appended to the default estimator name
++ based on this tag "( mu = ... )" later on, in pkg RobAStBase, a (conditional)
+ coerce method produces the pIC of the MDE by means of .CvMMDCovariance[WithMux]
+
##############
v 2.7
##############
Modified: branches/distr-2.8/pkg/distrMod/man/MCEstimator.Rd
===================================================================
--- branches/distr-2.8/pkg/distrMod/man/MCEstimator.Rd 2018-08-05 16:04:51 UTC (rev 1244)
+++ branches/distr-2.8/pkg/distrMod/man/MCEstimator.Rd 2018-08-05 20:56:37 UTC (rev 1245)
@@ -14,7 +14,7 @@
MCEstimator(x, ParamFamily, criterion, crit.name,
startPar = NULL, Infos, trafo = NULL,
penalty = 1e20, validity.check = TRUE, asvar.fct, na.rm = TRUE,
- ..., .withEvalAsVar = TRUE)
+ ..., .withEvalAsVar = TRUE, nmsffx = "")
}
\arguments{
\item{x}{ (empirical) data }
@@ -45,6 +45,7 @@
\item{.withEvalAsVar}{logical: shall slot \code{asVar} be evaluated
(if \code{asvar.fct} is given) or
just the call be returned?}
+ \item{nmsffx}{character: a potential suffix to be appended to the estimator name.}
}
\details{
The argument \code{criterion} has to be a function with arguments the
Modified: branches/distr-2.8/pkg/distrMod/man/MDEstimator.Rd
===================================================================
--- branches/distr-2.8/pkg/distrMod/man/MDEstimator.Rd 2018-08-05 16:04:51 UTC (rev 1244)
+++ branches/distr-2.8/pkg/distrMod/man/MDEstimator.Rd 2018-08-05 20:56:37 UTC (rev 1245)
@@ -15,20 +15,21 @@
MDEstimator(x, ParamFamily, distance = KolmogorovDist, dist.name,
paramDepDist = FALSE, startPar = NULL, Infos, trafo = NULL,
penalty = 1e20, validity.check = TRUE, asvar.fct, na.rm = TRUE,
- ..., .withEvalAsVar = TRUE)
-CvMMDEstimator(x, ParamFamily, muDatOrMod = c("Dat","Mod"),
- paramDepDist = FALSE, startPar = NULL, Infos,
+ ..., .withEvalAsVar = TRUE, nmsffx = "")
+CvMMDEstimator(x, ParamFamily, muDatOrMod = c("Dat","Mod", "Other"),
+ mu = NULL, paramDepDist = FALSE, startPar = NULL, Infos,
trafo = NULL, penalty = 1e20, validity.check = TRUE,
- asvar.fct = .CvMMDCovariance, na.rm = TRUE, ..., .withEvalAsVar = TRUE)
+ asvar.fct = .CvMMDCovariance, na.rm = TRUE, ...,
+ .withEvalAsVar = TRUE, nmsffx = "")
KolmogorovMDEstimator(x, ParamFamily, paramDepDist = FALSE, startPar = NULL, Infos,
trafo = NULL, penalty = 1e20, validity.check = TRUE, asvar.fct,
- na.rm = TRUE, ..., .withEvalAsVar = TRUE)
+ na.rm = TRUE, ..., .withEvalAsVar = TRUE, nmsffx = "")
TotalVarMDEstimator(x, ParamFamily, paramDepDist = FALSE, startPar = NULL, Infos,
trafo = NULL, penalty = 1e20, validity.check = TRUE, asvar.fct,
- na.rm = TRUE, ..., .withEvalAsVar = TRUE)
+ na.rm = TRUE, ..., .withEvalAsVar = TRUE, nmsffx = "")
HellingerMDEstimator(x, ParamFamily, paramDepDist = FALSE, startPar = NULL, Infos,
trafo = NULL, penalty = 1e20, validity.check = TRUE, asvar.fct,
- na.rm = TRUE, ..., .withEvalAsVar = TRUE)
+ na.rm = TRUE, ..., .withEvalAsVar = TRUE, nmsffx = "")
CvMDist2(e1,e2,... )
}
%- maybe also 'usage' for other objects documented here.
@@ -42,9 +43,16 @@
as integration measure \eqn{mu} in Cramer-von-Mises distance,
the empirical cdf (corresponding to argument value
\code{"Dat"}) or the current model distribution
- (corresponding to argument value \code{"Mod"}) is to be used;
- must be one of "Dat" (default) or "Mod".
+ (corresponding to argument value \code{"Mod"}) or a given
+ integration (probability) measure / distribution \code{mu}
+ (corresponding to argument value \code{"Other"}) is to be used;
+ must be one of "Dat" (default) or "Mod" or "Other".
You can specify just the initial letter.}
+ \item{mu}{ optional integration (probability) measure for CvM MDE.
+ defaults to \code{NULL} and is ignored in options
+ \code{muDatOrMod} in \code{"Dat"} and \code{"Mod"};
+ in case \code{"Other"}, it must be of class
+ \code{UnivariateDistribution}. }
\item{paramDepDist}{logical; will computation of distance be parameter
dependent (see also note below)? if \code{TRUE}, distance function
must be able to digest a parameter \code{thetaPar}; otherwise
@@ -74,6 +82,7 @@
\item{.withEvalAsVar}{logical: shall slot \code{asVar} be evaluated
(if \code{asvar.fct} is given) or
just the call be returned?}
+ \item{nmsffx}{character: a potential suffix to be appended to the estimator name.}
\item{e1}{object of class \code{"Distribution"} or class \code{"numeric"} }
\item{e2}{object of class \code{"Distribution"} }
}
@@ -162,6 +171,7 @@
\code{\link[MASS]{fitdistr}} }
\examples{
## (empirical) Data
+set.seed(123)
x <- rgamma(50, scale = 0.5, shape = 3)
## parametric family of probability measures
@@ -175,15 +185,22 @@
## von Mises minimum distance estimator with default mu
MDEstimator(x = x, ParamFamily = G, distance = CvMDist)
-\dontrun{
+\donttest{
## von Mises minimum distance estimator with default mu
MDEstimator(x = x, ParamFamily = G, distance = CvMDist,
asvar.fct = .CvMMDCovarianceWithMux)
## or
CvMMDEstimator(x = x, ParamFamily = G)
+## or
+CvMMDEstimator(x = x, ParamFamily = G, muDatOrMod="Dat")
+## or
+CvMMDEstimator(x = x, ParamFamily = G, muDatOrMod="Mod")
+
## von Mises minimum distance estimator with mu = N(0,1)
MDEstimator(x = x, ParamFamily = G, distance = CvMDist, mu = Norm())
+## or
+CvMMDEstimator(x = x, ParamFamily = G, muDatOrMod="Other", mu = Norm())
## Total variation minimum distance estimator
## gamma distributions are discretized
Modified: branches/distr-2.8/pkg/distrMod/man/MLEstimator.Rd
===================================================================
--- branches/distr-2.8/pkg/distrMod/man/MLEstimator.Rd 2018-08-05 16:04:51 UTC (rev 1244)
+++ branches/distr-2.8/pkg/distrMod/man/MLEstimator.Rd 2018-08-05 20:56:37 UTC (rev 1245)
@@ -12,7 +12,7 @@
MLEstimator(x, ParamFamily, startPar = NULL,
Infos, trafo = NULL, penalty = 1e20,
validity.check = TRUE, na.rm = TRUE, ...,
- .withEvalAsVar = TRUE, dropZeroDensity = TRUE)
+ .withEvalAsVar = TRUE, dropZeroDensity = TRUE, nmsffx = "")
}
%- maybe also 'usage' for other objects documented here.
\arguments{
@@ -39,6 +39,7 @@
\item{dropZeroDensity}{logical of length 1; shall observations with
density zero be dropped? Optimizers like \code{optim} require finite
values, so get problems when negative loglikelihood is evaluated. }
+ \item{nmsffx}{character: a potential suffix to be appended to the estimator name.}
}
\details{
The function uses \code{\link{mleCalc}}
Modified: branches/distr-2.8/pkg/distrMod/man/internalmleHelpers.Rd
===================================================================
--- branches/distr-2.8/pkg/distrMod/man/internalmleHelpers.Rd 2018-08-05 16:04:51 UTC (rev 1244)
+++ branches/distr-2.8/pkg/distrMod/man/internalmleHelpers.Rd 2018-08-05 20:56:37 UTC (rev 1245)
@@ -15,7 +15,7 @@
\usage{
.negLoglikelihood(x, Distribution, ..., dropZeroDensity = TRUE)
.process.meCalcRes(res, PFam, trafo, res.name, call, asvar.fct, check.validity,
- ..., .withEvalAsVar = TRUE, x = NULL)
+ ..., .withEvalAsVar = TRUE, x = NULL, nmsffx = "")
.callParamFamParameter(PFam, theta, idx, nuis, fixed)
}
@@ -47,6 +47,7 @@
\item{dropZeroDensity}{logical of length 1; shall observations with
density zero be dropped? Optimizers like \code{optim} require finite
values, so get problems when negative loglikelihood is evaluated. }
+ \item{nmsffx}{character: a potential suffix to be appended to the estimator name.}
}
\details{
More information about the Distr-commits
mailing list