[Robast-commits] r420 - in branches/robast-0.8/pkg/RobAStBase: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Sep 3 14:57:39 CEST 2010
Author: ruckdeschel
Date: 2010-09-03 14:57:39 +0200 (Fri, 03 Sep 2010)
New Revision: 420
Modified:
branches/robast-0.8/pkg/RobAStBase/R/IC.R
branches/robast-0.8/pkg/RobAStBase/man/IC.Rd
branches/robast-0.8/pkg/RobAStBase/man/makeIC-methods.Rd
Log:
ROptEst: new helper methods makeIC to apply to functions or list of functions
for easily producing (suboptimal) ICs
Modified: branches/robast-0.8/pkg/RobAStBase/R/IC.R
===================================================================
--- branches/robast-0.8/pkg/RobAStBase/R/IC.R 2010-09-03 11:55:08 UTC (rev 419)
+++ branches/robast-0.8/pkg/RobAStBase/R/IC.R 2010-09-03 12:57:39 UTC (rev 420)
@@ -156,3 +156,49 @@
CallL2Fam = CallL2Fam,
modifyIC = modifyIC))
})
+
+
+# alias to IC needed here:
+.IC <- IC
+
+setMethod("makeIC", signature(IC = "list", L2Fam = "L2ParamFamily"),
+ function(IC, L2Fam, forceIC = TRUE, name, Risks, Infos, modifyIC = NULL){
+ mc <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)[-1]
+ mc0 <- as.list(mc)
+ mc0$IC <- NULL
+ mc0$L2Fam <- NULL
+ mc0$forceIC <- NULL
+ if(!all(as.logical(c(lapply(IC,is.function)))))
+ stop("First argument must be a list of functions")
+
+ IC.1 <- lapply(IC, function(IC.2)
+ if(length(formals(IC.2))==0) function(x) IC.2(x) else IC.2)
+
+ mc0$Curve <- EuclRandVarList(RealRandVariable(Map = IC.1, Domain = Reals()))
+ mc0$CallL2Fam <- substitute(L2Fam at fam.call)
+
+ IC.0 <- do.call(.IC,mc0)
+ if(forceIC) IC.0 <- makeIC(IC.0, L2Fam)
+ return(IC.0)
+ })
+
+
+
+setMethod("makeIC", signature(IC = "function", L2Fam = "L2ParamFamily"),
+ function(IC, L2Fam, forceIC = TRUE, name, Risks, Infos, modifyIC = NULL){
+ mc <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)[-1]
+ mc0 <- as.list(mc)
+ mc0$IC <- NULL
+ mc0$L2Fam <- NULL
+ mc0$forceIC <- NULL
+ IC.1 <- if(length(formals(IC))==0) function(x) IC(x) else IC
+ mc0$Curve <- EuclRandVarList(RealRandVariable(Map = list(IC.1),
+ Domain = Reals()))
+ mc0$CallL2Fam <- substitute(L2Fam at fam.call)
+ print(mc0)
+
+ IC.0 <- do.call(.IC,mc0)
+ print(IC.0)
+ if(forceIC) IC.0 <- makeIC(IC.0, L2Fam)
+ return(IC.0)
+ })
Modified: branches/robast-0.8/pkg/RobAStBase/man/IC.Rd
===================================================================
--- branches/robast-0.8/pkg/RobAStBase/man/IC.Rd 2010-09-03 11:55:08 UTC (rev 419)
+++ branches/robast-0.8/pkg/RobAStBase/man/IC.Rd 2010-09-03 12:57:39 UTC (rev 420)
@@ -11,7 +11,7 @@
Risks, Infos, CallL2Fam = call("L2ParamFamily"), modifyIC = NULL)
}
\arguments{
- \item{name}{ Object of class \code{"character"}. }
+ \item{name}{ Object of class \code{"character"}; the name of the IC. }
\item{CallL2Fam}{ object of class \code{"call"}:
creates an object of the underlying L2-differentiable
parametric family. }
@@ -23,7 +23,8 @@
\item{modifyIC}{ Object of class \code{"OptionalFunction"}:
function of two arguments, which are an L2 parametric family
and an optional influence curve. Returns an object of
- class \code{"IC"}. This function is mainly used for internal
+ class \code{"IC"} at the parameter value of the L2 parametric
+ family. This function is mainly used for internal
computations! }
}
%\details{}
Modified: branches/robast-0.8/pkg/RobAStBase/man/makeIC-methods.Rd
===================================================================
--- branches/robast-0.8/pkg/RobAStBase/man/makeIC-methods.Rd 2010-09-03 11:55:08 UTC (rev 419)
+++ branches/robast-0.8/pkg/RobAStBase/man/makeIC-methods.Rd 2010-09-03 12:57:39 UTC (rev 420)
@@ -4,6 +4,8 @@
\alias{makeIC-methods}
\alias{makeIC,IC,missing-method}
\alias{makeIC,IC,L2ParamFamily-method}
+\alias{makeIC,list,L2ParamFamily-method}
+\alias{makeIC,function,L2ParamFamily-method}
\title{Generic Function for making ICs consistent at a possibly different model}
\description{
@@ -11,16 +13,54 @@
}
\usage{
makeIC(IC, L2Fam, ...)
+\S4method{makeIC}{IC,missing}(IC)
+\S4method{makeIC}{IC,L2ParamFamily}(IC, L2Fam)
+\S4method{makeIC}{list,L2ParamFamily}(IC, L2Fam, forceIC = TRUE, name, Risks,
+ Infos, modifyIC = NULL)
+\S4method{makeIC}{function,L2ParamFamily}(IC, L2Fam, forceIC = TRUE, name,
+ Risks, Infos, modifyIC = NULL)
}
\arguments{
- \item{IC}{ object of class \code{"IC"} }
+ \item{IC}{ object of class \code{"IC"} for signature \code{IC="IC"}, respectively
+ a list of functions in one argument for signature \code{IC="list"}, respectively
+ a function in one argument for signature \code{IC="function"}.}
\item{L2Fam}{ L2-differentiable family of probability measures; may be missing. }
+ \item{forceIC}{ logical; shall centeredness and Fisher consistency be enforced
+ applying an affine linear transformation?}
+ \item{name}{ Object of class \code{"character"}; the name of the IC }
+ \item{Risks}{ object of class \code{"list"}:
+ list of risks; cf. \code{\link[distrMod]{RiskType-class}}. }
+ \item{Infos}{ matrix of characters with two columns
+ named \code{method} and \code{message}: additional informations. }
+ \item{modifyIC}{ Object of class \code{"OptionalFunction"}:
+ function of two arguments, which are an L2 parametric family
+ and an optional influence curve. Returns an object of
+ class \code{"IC"} at the parameter value of the L2 parametric
+ family. This function is mainly used for internal
+ computations! }
\item{\dots}{ additional parameters }
}
-\value{An IC at the model.}
+\value{An IC of class \code{"IC"} at the model.}
\section{Methods}{\describe{
-\item{makeIC}{\code{signature(IC = "IC", L2Fam = "missing"}: ...}
-\item{makeIC}{\code{signature(IC = "IC", L2Fam = "L2ParamFamily"}: ...}
+\item{makeIC}{\code{signature(IC = "IC", L2Fam = "missing"}: creates
+ an object of class \code{"IC"} at the parametric model of its own
+ slot \code{CallL2Fam}; enforces IC conditions
+ centeredness and Fisher consistency, applying an affine linear
+ transformation.}
+\item{makeIC}{\code{signature(IC = "IC", L2Fam = "L2ParamFamily"}: creates
+ an object of class \code{"IC"} at the parametric model \code{L2Fam};
+ enforces IC conditions centeredness and Fisher consistency,
+ applying an affine linear transformation.}
+\item{makeIC}{\code{signature(IC = "list", L2Fam = "L2ParamFamily"}: creates
+ an object of class \code{"IC"} out of a list of functions given by argument
+ \code{IC} at the parametric model \code{L2Fam};
+ enforces IC conditions centeredness and Fisher consistency,
+ applying an affine linear transformation.}
+\item{makeIC}{\code{signature(IC = "function", L2Fam = "L2ParamFamily"}: creates
+ an object of class \code{"IC"} out of a function given by argument
+ \code{IC} at the parametric model \code{L2Fam};
+ enforces IC conditions centeredness and Fisher consistency,
+ applying an affine linear transformation.}
}}
\references{
@@ -53,6 +93,19 @@
checkIC(IC3)
## identical to
checkIC(IC3, BinomFamily(13, 0.2))
+
+IC4 <- makeIC(sin, B)
+checkIC(IC4)
+
+(IC5 <- makeIC(list(function(x)x^3), B, name="a try"))
+plot(IC5)
+checkIC(IC5)
+
+N0 <- NormLocationScaleFamily()
+IC6 <- makeIC(list(sin,cos),N0)
+plot(IC6)
+checkIC(IC6)
+
}
\concept{influence curve}
\keyword{robust}
More information about the Robast-commits
mailing list