[Distr-commits] r862 - branches/distr-2.5/pkg/distrMod/R branches/distr-2.5/pkg/distrMod/man pkg/distrMod/R pkg/distrMod/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jan 18 23:47:52 CET 2013
Author: ruckdeschel
Date: 2013-01-18 23:47:52 +0100 (Fri, 18 Jan 2013)
New Revision: 862
Modified:
branches/distr-2.5/pkg/distrMod/R/Estimator.R
branches/distr-2.5/pkg/distrMod/man/Estimator.Rd
pkg/distrMod/R/Estimator.R
pkg/distrMod/man/Estimator.Rd
Log:
distrMod: Estimator gains argument ParamFamily (after "...") to be able to compute asymptotic variances
Modified: branches/distr-2.5/pkg/distrMod/R/Estimator.R
===================================================================
--- branches/distr-2.5/pkg/distrMod/R/Estimator.R 2013-01-15 16:40:29 UTC (rev 861)
+++ branches/distr-2.5/pkg/distrMod/R/Estimator.R 2013-01-18 22:47:52 UTC (rev 862)
@@ -2,10 +2,12 @@
## Function to compute estimates
###############################################################################
Estimator <- function(x, estimator, name, Infos, asvar = NULL, nuis.idx,
- trafo = NULL, fixed = NULL, asvar.fct, na.rm = TRUE, ...){
+ trafo = NULL, fixed = NULL, asvar.fct, na.rm = TRUE, ...,
+ ParamFamily = NULL){
name.est <- paste(deparse(substitute(estimator)),sep="",collapse="")
es.call <- match.call()
+
if(missing(name))
name <- "Some estimator"
@@ -70,9 +72,11 @@
res at estimate <- estimate[idm]
asvar <- NULL
- if(!missing(asvar.fct))
- asvar <- asvar.fct(L2Fam = ParamFamily, param = param, ...)
-
+ if(!missing(asvar.fct)){
+ asvar.try <- try(asvar.fct(L2Fam = ParamFamily, param = param, ...),
+ silent=TRUE)
+ if(!is(asvar.try,"try-error")) asvar <- asvar.try
+ }
res at untransformed.asvar <- asvar
if(!.isUnitMatrix(res at trafo$mat)){
Modified: branches/distr-2.5/pkg/distrMod/man/Estimator.Rd
===================================================================
--- branches/distr-2.5/pkg/distrMod/man/Estimator.Rd 2013-01-15 16:40:29 UTC (rev 861)
+++ branches/distr-2.5/pkg/distrMod/man/Estimator.Rd 2013-01-18 22:47:52 UTC (rev 862)
@@ -8,7 +8,8 @@
}
\usage{
Estimator(x, estimator, name, Infos, asvar = NULL, nuis.idx,
- trafo = NULL, fixed = NULL, asvar.fct, na.rm = TRUE, ...)
+ trafo = NULL, fixed = NULL, asvar.fct, na.rm = TRUE, ...,
+ ParamFamily = NULL)
}
\arguments{
\item{x}{ (empirical) data }
@@ -23,12 +24,14 @@
for the main parameter}
\item{asvar.fct}{optionally: a function to determine the corresponding
asymptotic variance; if given, \code{asvar.fct} takes arguments
- \code{L2Fam}((the parametric model as object of class \code{L2ParamFamily}))
+ \code{L2Fam}(the parametric model as object of class \code{L2ParamFamily})
and \code{param} (the parameter value as object of class
\code{ParamFamParameter}); arguments are called by name; \code{asvar.fct}
- may also process further arguments passed through the \code{\dots} argument}
+ may also process further arguments passed through the \code{\dots} argument. }
\item{na.rm}{logical: if \code{TRUE}, the estimator is evaluated at \code{complete.cases(x)}.}
- \item{\dots}{ further arguments to \code{estimator}. }
+ \item{\dots}{ further arguments to \code{estimator}.}
+ \item{ParamFamily}{an optional object of class \code{ParamFamily}. Passed on
+ to \code{asvar.fct} to compute asymptotic variances.}
}
\details{
The argument \code{criterion} has to be a function with arguments the
Modified: pkg/distrMod/R/Estimator.R
===================================================================
--- pkg/distrMod/R/Estimator.R 2013-01-15 16:40:29 UTC (rev 861)
+++ pkg/distrMod/R/Estimator.R 2013-01-18 22:47:52 UTC (rev 862)
@@ -2,10 +2,12 @@
## Function to compute estimates
###############################################################################
Estimator <- function(x, estimator, name, Infos, asvar = NULL, nuis.idx,
- trafo = NULL, fixed = NULL, asvar.fct, na.rm = TRUE, ...){
+ trafo = NULL, fixed = NULL, asvar.fct, na.rm = TRUE, ...,
+ ParamFamily = NULL){
name.est <- paste(deparse(substitute(estimator)),sep="",collapse="")
es.call <- match.call()
+
if(missing(name))
name <- "Some estimator"
@@ -70,9 +72,11 @@
res at estimate <- estimate[idm]
asvar <- NULL
- if(!missing(asvar.fct))
- asvar <- asvar.fct(L2Fam = ParamFamily, param = param, ...)
-
+ if(!missing(asvar.fct)){
+ asvar.try <- try(asvar.fct(L2Fam = ParamFamily, param = param, ...),
+ silent=TRUE)
+ if(!is(asvar.try,"try-error")) asvar <- asvar.try
+ }
res at untransformed.asvar <- asvar
if(!.isUnitMatrix(res at trafo$mat)){
Modified: pkg/distrMod/man/Estimator.Rd
===================================================================
--- pkg/distrMod/man/Estimator.Rd 2013-01-15 16:40:29 UTC (rev 861)
+++ pkg/distrMod/man/Estimator.Rd 2013-01-18 22:47:52 UTC (rev 862)
@@ -8,7 +8,8 @@
}
\usage{
Estimator(x, estimator, name, Infos, asvar = NULL, nuis.idx,
- trafo = NULL, fixed = NULL, asvar.fct, na.rm = TRUE, ...)
+ trafo = NULL, fixed = NULL, asvar.fct, na.rm = TRUE, ...,
+ ParamFamily = NULL)
}
\arguments{
\item{x}{ (empirical) data }
@@ -23,12 +24,14 @@
for the main parameter}
\item{asvar.fct}{optionally: a function to determine the corresponding
asymptotic variance; if given, \code{asvar.fct} takes arguments
- \code{L2Fam}((the parametric model as object of class \code{L2ParamFamily}))
+ \code{L2Fam}(the parametric model as object of class \code{L2ParamFamily})
and \code{param} (the parameter value as object of class
\code{ParamFamParameter}); arguments are called by name; \code{asvar.fct}
- may also process further arguments passed through the \code{\dots} argument}
+ may also process further arguments passed through the \code{\dots} argument. }
\item{na.rm}{logical: if \code{TRUE}, the estimator is evaluated at \code{complete.cases(x)}.}
- \item{\dots}{ further arguments to \code{estimator}. }
+ \item{\dots}{ further arguments to \code{estimator}.}
+ \item{ParamFamily}{an optional object of class \code{ParamFamily}. Passed on
+ to \code{asvar.fct} to compute asymptotic variances.}
}
\details{
The argument \code{criterion} has to be a function with arguments the
More information about the Distr-commits
mailing list