[Robast-commits] r382 - in branches/robast-0.7/pkg: ROptEst/inst RobAStBase/R RobAStBase/inst RobAStBase/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 6 13:13:19 CEST 2009
Author: ruckdeschel
Date: 2009-10-06 13:13:19 +0200 (Tue, 06 Oct 2009)
New Revision: 382
Modified:
branches/robast-0.7/pkg/ROptEst/inst/NEWS
branches/robast-0.7/pkg/RobAStBase/R/qqplot.R
branches/robast-0.7/pkg/RobAStBase/inst/NEWS
branches/robast-0.7/pkg/RobAStBase/inst/TOBEDONE
branches/robast-0.7/pkg/RobAStBase/man/qqplot.Rd
Log:
+RobAStBase: NEWS & TOBEDONE files updated
+RobAStBase: qqplot: new argument n.adj to adjust sample size in presence of neighborhoods
Modified: branches/robast-0.7/pkg/ROptEst/inst/NEWS
===================================================================
--- branches/robast-0.7/pkg/ROptEst/inst/NEWS 2009-10-06 00:28:57 UTC (rev 381)
+++ branches/robast-0.7/pkg/ROptEst/inst/NEWS 2009-10-06 11:13:19 UTC (rev 382)
@@ -36,8 +36,8 @@
*** others
+ added argument fsCor to function roptest enabling a finite-sample correction of the radius ...
++ added QQ plots in examples to roptest
-
SCRIPTS
+ all scripts do run now without (obvious) error ---
Modified: branches/robast-0.7/pkg/RobAStBase/R/qqplot.R
===================================================================
--- branches/robast-0.7/pkg/RobAStBase/R/qqplot.R 2009-10-06 00:28:57 UTC (rev 381)
+++ branches/robast-0.7/pkg/RobAStBase/R/qqplot.R 2009-10-06 11:13:19 UTC (rev 382)
@@ -20,13 +20,20 @@
n = length(x), withIdLine = TRUE, withConf = TRUE,
withConf.pw = withConf, withConf.sim = withConf,
plot.it = TRUE, xlab = deparse(substitute(x)),
- ylab = deparse(substitute(y)), ..., distance = NormType()){
+ ylab = deparse(substitute(y)), ..., distance = NormType(),
+ n.adj = TRUE){
mc <- match.call(call = sys.call(sys.parent(1)))
if(missing(xlab)) mc$xlab <- as.character(deparse(mc$x))
if(missing(ylab)) mc$ylab <- as.character(deparse(mc$y))
mcl <- as.list(mc)[-1]
+ if(is.null(mcl$n.CI)) mcl$n.CI <- n
+ if(n.adj){
+ r <- radius(neighbor(y))
+ n <- floor((1-r)*n)
+ }
+ mcl$n <- n
mcl$y <- y at center
xD <- fct(distance)(x)
@@ -45,7 +52,7 @@
withConf.pw = withConf, ### shall pointwise confidence lines be plotted
withConf.sim = withConf, ### shall simultaneous confidence lines be plotted
plot.it = TRUE, xlab = deparse(substitute(x)),
- ylab = deparse(substitute(y)), ...){
+ ylab = deparse(substitute(y)), ..., n.adj = TRUE){
mc <- match.call(call = sys.call(sys.parent(1)))
if(missing(xlab)) mc$xlab <- as.character(deparse(mc$x))
@@ -53,6 +60,12 @@
mcl <- as.list(mc)[-1]
if(is.null(mcl$distance)) distance <- NormType()
+ if(is.null(mcl$n.CI)) mcl$n.CI <- n
+ if(n.adj){
+ r <- radius(neighbor(y))
+ n <- floor((1-r/sqrt(n))*n)
+ }
+ mcl$n <- n
mcl$y <- y at center
L2D <- L2deriv(y at center)
@@ -95,7 +108,13 @@
mcl$y <- L2Fam
if(is(IC,"HampIC")){
- w.fct <- function(x) sapply(x, weight(weight(IC)))
+ dim0 <- nrow(FisherInfo(L2Fam))
+ L <- as(diag(dim0)%*%L2Fam at L2deriv, "EuclRandVariable")
+ L.fct <- function(x) evalRandVar(L,x)
+
+ w.fct <- function(x)
+ weight(weight(IC))(L.fct(matrix(x))[,,1])
+
wx <- w.fct(x)
mcl$order.traf <- function(x) 1/w.fct(x)
Modified: branches/robast-0.7/pkg/RobAStBase/inst/NEWS
===================================================================
--- branches/robast-0.7/pkg/RobAStBase/inst/NEWS 2009-10-06 00:28:57 UTC (rev 381)
+++ branches/robast-0.7/pkg/RobAStBase/inst/NEWS 2009-10-06 11:13:19 UTC (rev 382)
@@ -14,6 +14,14 @@
user-visible CHANGES:
+ enhanced plotting:
+ * new diagnostic function qqplot to check the quality of a model fit
+ + special methods for second argument of class
+ "RobModel", "InfRobModel", and "kStepEstimate"
+ + comes with corresponding (pointwise/simultaneous) confidence intervals
+ + for "RobModel", "InfRobModel": sizing of points and labels according to
+ Mahalanobis size of points / any other distance function
+ + for "kStepEstimate": fading / sizing of points and labels according to
+ weight of corresponding [p]IC
* suggestions by A. Unwin, Augsburg;
plot for ICs, infoPlot, and comparePlot may be restricted to selected subplots;
* ylim can now be matrix-valued...
@@ -25,7 +33,7 @@
- which.lbs : select some data indices for plotting,
- which.Order : select some order statistics from the remaining data
for plotting (ordered; w.r.t. norm of IC) (in descending order)
- - return.Order : shall ordering be printed out?
+ - return.Order : shall ordering be printed out?
+ documentation
* added some UML class diagrams
+ checking functions
Modified: branches/robast-0.7/pkg/RobAStBase/inst/TOBEDONE
===================================================================
--- branches/robast-0.7/pkg/RobAStBase/inst/TOBEDONE 2009-10-06 00:28:57 UTC (rev 381)
+++ branches/robast-0.7/pkg/RobAStBase/inst/TOBEDONE 2009-10-06 11:13:19 UTC (rev 382)
@@ -2,10 +2,6 @@
to be done in package RobAStBase
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-+ model diagnostics: qqplot adapted for robust model fits
- (choose color of plots according to robust distances)
- (see distrMod for further ideas)
-
+ MEstimator (repeats k-steps until convergence)
+ S4 class(es) for slot Risk, with corresponding scalable output
Modified: branches/robast-0.7/pkg/RobAStBase/man/qqplot.Rd
===================================================================
--- branches/robast-0.7/pkg/RobAStBase/man/qqplot.Rd 2009-10-06 00:28:57 UTC (rev 381)
+++ branches/robast-0.7/pkg/RobAStBase/man/qqplot.Rd 2009-10-06 11:13:19 UTC (rev 382)
@@ -7,12 +7,13 @@
n = length(x), withIdLine = TRUE, withConf = TRUE,
withConf.pw = withConf, withConf.sim = withConf,
plot.it = TRUE, xlab = deparse(substitute(x)),
- ylab = deparse(substitute(y)), ..., distance = NormType())
+ ylab = deparse(substitute(y)), ..., distance = NormType(),
+ n.adj = TRUE)
\S4method{qqplot}{ANY,InfRobModel}(x, y,
n = length(x), withIdLine = TRUE, withConf = TRUE,
withConf.pw = withConf, withConf.sim = withConf,
plot.it = TRUE, xlab = deparse(substitute(x)),
- ylab = deparse(substitute(y)), ...)
+ ylab = deparse(substitute(y)), ..., n.adj = TRUE)
\S4method{qqplot}{ANY,kStepEstimate}(x, y,
n = length(x), withIdLine = TRUE, withConf = TRUE,
withConf.pw = withConf, withConf.sim = withConf,
@@ -43,7 +44,9 @@
\item{xlab}{x-label}
\item{ylab}{y-label}
\item{\dots}{further parameters for method \code{qqplot} with signature
-\code{ANY,ProbFamily} or with function \code{plot}}
+\code{ANY,ProbFamily} (see \code{\link[distrMod]{qqplot}}) or with function \code{plot}}
+\item{n.adj}{logical; shall sample size be adjusted for possible outliers according
+to radius of the corresponding neighborhood?}
\item{distance}{a function mapping observations \code{x} to the positive reals;
used to determine the size of the plotted points (the larger \code{distance(x)},
the smaller the points are plotted.}
@@ -103,13 +106,29 @@
\item{qqplot}{\code{signature(x = "ANY", y = "kStepEstimate")}:
produces a QQ plot of a dataset \code{x} against the theoretical
quantiles of the model distribution of model at which
-the corresponding \code{kStepEstimate} \code{y} had been calibrated at.}
+the corresponding \code{kStepEstimate} \code{y} had been calibrated at.
+By default, if the [p]IC of the \code{kStepEstimate} is of class
+\code{HampIC}, i.e.; has a corresponding weight function,
+points (and, if \code{withLab==TRUE}, labels) are
+scaled and faded according to this weight function. Corresponding
+arguments \code{exp.cex2.pch} and \code{exp.fadcol.pch} control this
+scaling and fading, respectively
+(and analogously \code{exp.cex2.lbl} and \code{exp.fadcol.lbl} for the labels).
+The choice of these arguments has to be done on a case-by-case basis.
+Positive exponents induce fading, magnification with increasing weight,
+for negative exponents the same is true for decreasing weight; higher
+(absolute) values increase the speed of fading / magnification.
}
}
+}
\examples{
qqplot(r(Norm(15,sqrt(30)))(40), Chisq(df=15))
-qqplot(r(Norm(15,sqrt(30)))(40), NormLocationFamily())
+RobM <- InfRobModel(center = NormLocationFamily(),
+ neighbor = ContNeighborhood(radius = 0.4))
+qqplot(r(Norm(15,sqrt(30)))(40), RobM)
+## further examples for ANY,kStepEstimator-method
+## in example to roptest() in package ROptEst
}
\keyword{hplot}
\keyword{distribution}
More information about the Robast-commits
mailing list