[Robast-commits] r930 - in branches/robast-1.1/pkg: ROptEst/inst ROptEst/man ROptEstOld/man RandVar/vignettes RobAStBase/R RobAStBase/inst RobAStBase/man RobExtremes RobExtremes/R RobExtremes/man RobExtremes/src RobLox/man RobLoxBioC/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Apr 22 10:42:40 CEST 2017
Author: ruckdeschel
Date: 2017-04-22 10:42:39 +0200 (Sat, 22 Apr 2017)
New Revision: 930
Added:
branches/robast-1.1/pkg/RobAStBase/R/getFiRisk.R
branches/robast-1.1/pkg/RobAStBase/man/getFiRisk.Rd
Removed:
branches/robast-1.1/pkg/ROptEst/man/getFiRisk.Rd
Modified:
branches/robast-1.1/pkg/ROptEst/inst/NEWS
branches/robast-1.1/pkg/ROptEstOld/man/ROptEstOldConstants.Rd
branches/robast-1.1/pkg/ROptEstOld/man/RobModel-class.Rd
branches/robast-1.1/pkg/RandVar/vignettes/RandVar.Rnw
branches/robast-1.1/pkg/RobAStBase/inst/NEWS
branches/robast-1.1/pkg/RobExtremes/DESCRIPTION
branches/robast-1.1/pkg/RobExtremes/NAMESPACE
branches/robast-1.1/pkg/RobExtremes/R/kMAD.R
branches/robast-1.1/pkg/RobExtremes/man/ismevgpdgevdiag-methods.Rd
branches/robast-1.1/pkg/RobExtremes/src/kMad.c
branches/robast-1.1/pkg/RobLox/man/finiteSampleCorrection.Rd
branches/robast-1.1/pkg/RobLox/man/showdown.Rd
branches/robast-1.1/pkg/RobLoxBioC/man/SimStudies.Rd
branches/robast-1.1/pkg/RobLoxBioC/man/robloxbioc.Rd
Log:
+ RobExtremes: registered native routine kMAD
+ moved getFiRisk from ROptEst to RobAStBase
+ http://cran to https://cran
Modified: branches/robast-1.1/pkg/ROptEst/inst/NEWS
===================================================================
--- branches/robast-1.1/pkg/ROptEst/inst/NEWS 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/ROptEst/inst/NEWS 2017-04-22 08:42:39 UTC (rev 930)
@@ -8,6 +8,12 @@
information)
#######################################
+version 1.0.1
+#######################################
+user-visible CHANGES:
++ moved getFiRisk from ROptEst to RobAstBase
+
+#######################################
version 1.0
#######################################
Deleted: branches/robast-1.1/pkg/ROptEst/man/getFiRisk.Rd
===================================================================
--- branches/robast-1.1/pkg/ROptEst/man/getFiRisk.Rd 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/ROptEst/man/getFiRisk.Rd 2017-04-22 08:42:39 UTC (rev 930)
@@ -1,63 +0,0 @@
-\name{getFiRisk}
-\alias{getFiRisk}
-\alias{getFiRisk-methods}
-\alias{getFiRisk,fiUnOvShoot,Norm,ContNeighborhood-method}
-\alias{getFiRisk,fiUnOvShoot,Norm,TotalVarNeighborhood-method}
-
-\title{Generic Function for Computation of Finite-Sample Risks}
-\description{
- Generic function for the computation of finite-sample risks.
- This function is rarely called directly. It is used by
- other functions.
-}
-\usage{
-getFiRisk(risk, Distr, neighbor, ...)
-
-\S4method{getFiRisk}{fiUnOvShoot,Norm,ContNeighborhood}(risk, Distr,
- neighbor, clip, stand, sampleSize, Algo, cont)
-
-\S4method{getFiRisk}{fiUnOvShoot,Norm,TotalVarNeighborhood}(risk, Distr,
- neighbor, clip, stand, sampleSize, Algo, cont)
-}
-\arguments{
- \item{risk}{ object of class \code{"RiskType"}. }
- \item{Distr}{ object of class \code{"Distribution"}. }
- \item{neighbor}{ object of class \code{"Neighborhood"}. }
- \item{\dots}{ additional parameters. }
- \item{clip}{ positive real: clipping bound }
- \item{stand}{ standardizing constant/matrix. }
- \item{sampleSize}{ integer: sample size. }
- \item{Algo}{ "A" or "B". }
- \item{cont}{ "left" or "right". }
-}
-\details{The computation of the finite-sample under-/overshoot risk
- is based on FFT. For more details we refer to Section 11.3 of Kohl (2005).
-}
-\value{The finite-sample risk is computed.}
-\section{Methods}{
-\describe{
- \item{risk = "fiUnOvShoot", Distr = "Norm", neighbor = "ContNeighborhood"}{
- computes finite-sample under-/overshoot risk in methods for
- function \code{getFixRobIC}. }
-
- \item{risk = "fiUnOvShoot", Distr = "Norm", neighbor = "TotalVarNeighborhood"}{
- computes finite-sample under-/overshoot risk in methods for
- function \code{getFixRobIC}. }
-}}
-\references{
- Huber, P.J. (1968) Robust Confidence Limits. Z. Wahrscheinlichkeitstheor.
- Verw. Geb. \bold{10}:269--278.
-
- Kohl, M. (2005) \emph{Numerical Contributions to the Asymptotic Theory of Robustness}.
- Bayreuth: Dissertation.
-
- Ruckdeschel, P. and Kohl, M. (2005) Computation of the Finite Sample Risk
- of M-estimators on Neighborhoods.
-}
-\author{Matthias Kohl \email{Matthias.Kohl at stamats.de}}
-%\note{}
-\seealso{\code{\link[distrMod]{fiRisk-class}}}
-%\examples{}
-\concept{finite-sample risk}
-\concept{risk}
-\keyword{robust}
Modified: branches/robast-1.1/pkg/ROptEstOld/man/ROptEstOldConstants.Rd
===================================================================
--- branches/robast-1.1/pkg/ROptEstOld/man/ROptEstOldConstants.Rd 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/ROptEstOld/man/ROptEstOldConstants.Rd 2017-04-22 08:42:39 UTC (rev 930)
@@ -1,34 +1,34 @@
-\name{ROptEstOldConstants}
-\alias{EULERMASCHERONICONSTANT}
-\alias{APERYCONSTANT}
-\encoding{latin1}
-\title{Built-in Constants in package ROptEstOld}
-\description{
- Constants built into \pkg{ROptEstOld}.
-}
-\usage{
-EULERMASCHERONICONSTANT
-APERYCONSTANT
-}
-\details{
- \pkg{ROptEstOld} has a small number of built-in constants.
-
- The following constants are available:
- \itemize{
- \item \code{EULERMASCHERONICONSTANT}: the Euler Mascheroni constant
- \deqn{\gamma=-\Gamma'(1)}{gamma=-digamma(1)}
- given in \url{http://mathworld.wolfram.com/Euler-MascheroniConstant.html} (48);
- \item \code{APERYCONSTANT}: the \enc{Apéry}{Apery} constant
- \deqn{\zeta(3)= \frac{5}{2} (\sum_{k\ge 1}\frac{(-1)^{k-1}}{k^3 {2k\choose k}})}{
- zeta(3) = 5/2 sum_{k>=0} (-1)^(k-1)/(k^3 * choose(2k,k))}
- as given in \url{http://mathworld.wolfram.com/AperysConstant.html}, equation (8);
- }
-
- These are implemented as variables in the \pkg{ROptEstOld} name space taking
- appropriate values.
-}
-\examples{
-EULERMASCHERONICONSTANT
-APERYCONSTANT
-}
-\keyword{sysdata}
+\name{ROptEstOldConstants}
+\alias{EULERMASCHERONICONSTANT}
+\alias{APERYCONSTANT}
+\encoding{latin1}
+\title{Built-in Constants in package ROptEstOld}
+\description{
+ Constants built into \pkg{ROptEstOld}.
+}
+\usage{
+EULERMASCHERONICONSTANT
+APERYCONSTANT
+}
+\details{
+ \pkg{ROptEstOld} has a small number of built-in constants.
+
+ The following constants are available:
+ \itemize{
+ \item \code{EULERMASCHERONICONSTANT}: the Euler Mascheroni constant
+ \deqn{\gamma=-\Gamma'(1)}{gamma=-digamma(1)}
+ given in \url{http://mathworld.wolfram.com/Euler-MascheroniConstant.html} (48);
+ \item \code{APERYCONSTANT}: the \enc{Apéry}{Apery} constant
+ \deqn{\zeta(3)= \frac{5}{2} (\sum_{k\ge 1}\frac{(-1)^{k-1}}{k^3 {2k\choose k}})}{
+ zeta(3) = 5/2 sum_{k>=0} (-1)^(k-1)/(k^3 * choose(2k,k))}
+ as given in \url{http://mathworld.wolfram.com/AperysConstant.html}, equation (8);
+ }
+
+ These are implemented as variables in the \pkg{ROptEstOld} name space taking
+ appropriate values.
+}
+\examples{
+EULERMASCHERONICONSTANT
+APERYCONSTANT
+}
+\keyword{sysdata}
Modified: branches/robast-1.1/pkg/ROptEstOld/man/RobModel-class.Rd
===================================================================
--- branches/robast-1.1/pkg/ROptEstOld/man/RobModel-class.Rd 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/ROptEstOld/man/RobModel-class.Rd 2017-04-22 08:42:39 UTC (rev 930)
@@ -47,4 +47,4 @@
\concept{robust model}
\keyword{classes}
\keyword{models}
-\keyword{robust}
\ No newline at end of file
+\keyword{robust}
Modified: branches/robast-1.1/pkg/RandVar/vignettes/RandVar.Rnw
===================================================================
--- branches/robast-1.1/pkg/RandVar/vignettes/RandVar.Rnw 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/RandVar/vignettes/RandVar.Rnw 2017-04-22 08:42:39 UTC (rev 930)
@@ -273,7 +273,7 @@
Ruckdeschel P., Kohl M., Stabla T., and Camphausen F.
\newblock {S4 Classes for Distributions.}
\newblock {\em R-News\/}, {\bf 6}(2): 10--13.
-\newblock http://CRAN.R-project.org/doc/Rnews/Rnews\_2006-2.pdf
+\newblock https://CRAN.R-project.org/doc/Rnews/Rnews\_2006-2.pdf
\newblock See also {http://www.uni-bayreuth.de/departments/math/org/mathe7/RUCKDESCHEL/pubs/distr.pdf}
\end{thebibliography}
Added: branches/robast-1.1/pkg/RobAStBase/R/getFiRisk.R
===================================================================
--- branches/robast-1.1/pkg/RobAStBase/R/getFiRisk.R (rev 0)
+++ branches/robast-1.1/pkg/RobAStBase/R/getFiRisk.R 2017-04-22 08:42:39 UTC (rev 930)
@@ -0,0 +1,198 @@
+###############################################################################
+## finite-sample under-/overshoot risk
+###############################################################################
+
+# cdf of truncated normal distribution
+ptnorm <- function(x, mu, A, B){
+ ((A <= x)*(x <= B)*(pnorm(x-mu)-pnorm(A-mu))/(pnorm(B-mu)-pnorm(A-mu))
+ + (x > B))
+}
+
+# n-fold convolution for truncated normal distributions
+conv.tnorm <- function(z, A, B, mu, n, m){
+ if(n == 1) return(ptnorm(z, mu = mu, A = A, B = B))
+ if(z <= n*A) return(0)
+ if(z >= n*B) return(1)
+
+ M <- 2^m
+ h <- (B-A)/M
+ x <- seq(from = A, to = B, by = h)
+ p1 <- ptnorm(x, mu = mu, A = A, B = B)
+ p1 <- p1[2:(M + 1)] - p1[1:M]
+
+ ## FFT
+ pn <- c(p1, numeric((n-1)*M))
+
+ ## convolution theorem for DFTs
+ pn <- Re(fft(fft(pn)^n, inverse = TRUE)) / (n*M)
+ pn <- (abs(pn) >= .Machine$double.eps)*pn
+ i.max <- n*M-(n-2)
+ pn <- c(0,pn[1:i.max])
+ pn <- cumsum(pn)
+
+ ## cdf with continuity correction h/2
+ x <- c(n*A,seq(from = n*A+n/2*h, to = n*B-n/2*h, by=h),n*B)
+ pnfun1 <- approxfun(x = x+0.5*h, y = pn, yleft = 0, yright = pn[i.max+1])
+ pnfun2 <- function(x) pnfun1(x) / pn[i.max+1]
+
+ return(pnfun2(z))
+}
+
+
+setMethod("getFiRisk", signature(risk = "fiUnOvShoot",
+ Distr = "Norm",
+ neighbor = "ContNeighborhood"
+ ),
+ function(risk, Distr, neighbor, clip, stand,
+ sampleSize, Algo, cont){
+ eps <- neighbor at radius
+ tau <- risk at width
+ n <- sampleSize
+ m <- getdistrOption("DefaultNrFFTGridPointsExponent")
+
+ if(Algo == "B"){
+ if(cont == "left"){
+ delta1 <- (1-eps)*(pnorm(-clip+tau) + pnorm(-clip-tau)) + eps
+ K1 <- dbinom(0:n, size = n, prob = delta1)
+ P1 <- (1-eps)*pnorm(-clip-tau) + eps
+ p1 <- P1/delta1
+
+ summe1 <- numeric(n+1)
+ summe1[1] <- 1 - conv.tnorm(z = 0, A = -clip, B = clip, mu = -tau, n = n, m = m)
+ summe1[n+1] <- (1 - 0.5*(pbinom(q = n/2, size = n, prob = p1)
+ + pbinom(q = n/2-0.1, size = n, prob = p1)))
+ for(k in 1:(n-1)){
+ j <- 0:k
+ z <- clip*(k-2*j)
+ P1.ste <- sapply(z, conv.tnorm, A = -clip, B = clip, mu = -tau, n = n-k, m = m)
+ summe1[k+1] <- sum((1-P1.ste)*dbinom(j, size = k, prob = p1))
+ }
+ erg <- sum(summe1*K1)
+ }else{
+ delta2 <- (1-eps)*(pnorm(-clip+tau) + pnorm(-clip-tau)) + eps
+ K2 <- dbinom(0:n, size = n, prob = delta2)
+ P2 <- (1-eps)*pnorm(-clip+tau)
+ p2 <- P2/delta2
+
+ summe2 <- numeric(n+1)
+ summe2[1] <- conv.tnorm(z = 0, A = -clip, B = clip, mu = tau, n = n, m = m)
+ summe2[n+1] <- 0.5*(pbinom(q = n/2, size = n, prob = p2)
+ + pbinom(q = n/2-0.1, size = n, prob = p2))
+ for(k in 1:(n-1)){
+ j <- 0:k
+ z <- clip*(k-2*j)
+ P2.ste <- sapply(z, conv.tnorm, A = -clip, B = clip, mu = tau, n = n-k, m = m)
+ summe2[k+1] <- sum(P2.ste*dbinom(j, size=k, prob=p2))
+ }
+ erg <- sum(summe2*K2)
+ }
+ }else{
+ M <- 2^m
+ h <- 2*clip/M
+ x <- seq(from = -clip, to = clip, by = h)
+
+ if(cont == "right"){
+ p1 <- pnorm(x+tau)
+ p1 <- (1-eps)*(p1[2:(M + 1)] - p1[1:M])
+ p1[1] <- p1[1] + (1-eps)*pnorm(-clip+tau)
+ p1[M] <- p1[M] + (1-eps)*pnorm(-clip-tau) + eps
+ }else{
+ p1 <- pnorm(x-tau)
+ p1 <- (1-eps)*(p1[2:(M + 1)] - p1[1:M])
+ p1[1] <- p1[1] + (1-eps)*pnorm(-clip-tau) + eps
+ p1[M] <- p1[M] + (1-eps)*pnorm(-clip+tau)
+ }
+
+ ## FFT
+ pn <- c(p1, numeric((n-1)*M))
+
+ ## convolution theorem for DFTs
+ pn <- Re(fft(fft(pn)^n, inverse = TRUE)) / (n*M)
+ pn <- (abs(pn) >= .Machine$double.eps)*pn
+ pn <- cumsum(pn)
+
+ k <- n*(M-1)/2
+ erg <- ifelse(n%%2 == 0, (pn[k]+pn[k+1])/2, pn[k+1])
+ if(cont == "right") erg <- 1 - erg
+ }
+
+ return(list(fiUnOvShoot = erg))
+ })
+
+setMethod("getFiRisk", signature(risk = "fiUnOvShoot",
+ Distr = "Norm",
+ neighbor = "TotalVarNeighborhood"),
+ function(risk, Distr, neighbor, clip, stand, sampleSize, Algo, cont){
+ delta <- neighbor at radius
+ tau <- risk at width
+ n <- sampleSize
+ m <- getdistrOption("DefaultNrFFTGridPointsExponent")
+
+ if(Algo == "B"){
+ if(cont == "left"){
+ delta1 <- min(pnorm(-clip-tau)+delta, 1) + 1 - min(pnorm(clip-tau)+delta, 1)
+ K1 <- dbinom(0:n, size = n, prob = delta1)
+ P1 <- min(pnorm(-clip-tau) + delta, 1)
+ p1 <- min(P1/delta1, 1)
+
+ summe1 <- numeric(n+1)
+ summe1[1] <- 1 - conv.tnorm(z = 0, A = -clip, B = clip, mu = -tau, n = n, m = m)
+ for(k in 1:(n-1)){
+ j <- 0:k
+ z <- clip*(k-2*j)
+ P1.ste <- sapply(z, conv.tnorm, A = -clip, B = clip, mu = -tau, n = n-k, m = m)
+ summe1[k+1] <- sum((1-P1.ste)*dbinom(j, size = k, prob = p1))
+ }
+ summe1[n+1] <- 1 - 0.5*(pbinom(q = n/2, size = n, prob = p1)
+ + pbinom(q = n/2-0.1, size = n, prob = p1))
+ erg <- sum(summe1*K1)
+ }else{
+ delta2 <- max(0, pnorm(-clip+tau)-delta) + 1 - max(0, pnorm(clip+tau)-delta)
+ K2 <- dbinom(0:n, size = n, prob = delta2)
+ P2 <- max(0, pnorm(-clip+tau) - delta)
+ p2 <- P2/delta2
+
+ summe2 <- numeric(n+1)
+ summe2[1] <- conv.tnorm(z = 0, A = -clip, B = clip, mu = tau, n = n, m = m)
+ for(k in 1:(n-1)){
+ j <- 0:k
+ z <- clip*(k-2*j)
+ P2.ste <- sapply(z, conv.tnorm, A = -clip, B = clip, mu = tau, n = n-k, m = m)
+ summe2[k+1] <- sum(P2.ste*dbinom(j, size = k, prob = p2))
+ }
+ summe2[n+1] <- 0.5*(pbinom(q = n/2, size = n, prob = p2)
+ + pbinom(q = n/2-0.1, size = n, prob = p2))
+ erg <- sum(summe2*K2)
+ }
+ }else{
+ M <- 2^m
+ h <- 2*clip/M
+ x <- seq(from = -clip, to = clip, by = h)
+
+ if(cont == "right"){
+ p1 <- pnorm(x+tau)
+ p1 <- p1[2:(M + 1)] - p1[1:M]
+ p1[1] <- p1[1] + pnorm(-clip+tau) - delta
+ p1[M] <- p1[M] + pnorm(-clip-tau) + delta
+ }else{
+ p1 <- pnorm(x-tau)
+ p1 <- p1[2:(M + 1)] - p1[1:M]
+ p1[1] <- p1[1] + pnorm(-clip-tau) + delta
+ p1[M] <- p1[M] + pnorm(-clip+tau) - delta
+ }
+
+ ## FFT
+ pn <- c(p1, numeric((n-1)*M))
+
+ ## convolution theorem for DFTs
+ pn <- Re(fft(fft(pn)^n, inverse = TRUE)) / (n*M)
+ pn <- (abs(pn) >= .Machine$double.eps)*pn
+ pn <- cumsum(pn)
+
+ k <- n*(M-1)/2
+ erg <- ifelse(n%%2 == 0, (pn[k]+pn[k+1])/2, pn[k+1])
+ if(cont == "right") erg <- 1-erg
+ }
+
+ return(list(fiUnOvShoot = erg))
+ })
Modified: branches/robast-1.1/pkg/RobAStBase/inst/NEWS
===================================================================
--- branches/robast-1.1/pkg/RobAStBase/inst/NEWS 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/RobAStBase/inst/NEWS 2017-04-22 08:42:39 UTC (rev 930)
@@ -8,6 +8,13 @@
information)
#######################################
+version 1.0.1
+#######################################
+user-visible CHANGES:
++ moved getFiRisk from ROptEst to RobAstBase
+
+
+#######################################
version 1.0
#######################################
Added: branches/robast-1.1/pkg/RobAStBase/man/getFiRisk.Rd
===================================================================
--- branches/robast-1.1/pkg/RobAStBase/man/getFiRisk.Rd (rev 0)
+++ branches/robast-1.1/pkg/RobAStBase/man/getFiRisk.Rd 2017-04-22 08:42:39 UTC (rev 930)
@@ -0,0 +1,63 @@
+\name{getFiRisk}
+\alias{getFiRisk}
+\alias{getFiRisk-methods}
+\alias{getFiRisk,fiUnOvShoot,Norm,ContNeighborhood-method}
+\alias{getFiRisk,fiUnOvShoot,Norm,TotalVarNeighborhood-method}
+
+\title{Generic Function for Computation of Finite-Sample Risks}
+\description{
+ Generic function for the computation of finite-sample risks.
+ This function is rarely called directly. It is used by
+ other functions.
+}
+\usage{
+getFiRisk(risk, Distr, neighbor, ...)
+
+\S4method{getFiRisk}{fiUnOvShoot,Norm,ContNeighborhood}(risk, Distr,
+ neighbor, clip, stand, sampleSize, Algo, cont)
+
+\S4method{getFiRisk}{fiUnOvShoot,Norm,TotalVarNeighborhood}(risk, Distr,
+ neighbor, clip, stand, sampleSize, Algo, cont)
+}
+\arguments{
+ \item{risk}{ object of class \code{"RiskType"}. }
+ \item{Distr}{ object of class \code{"Distribution"}. }
+ \item{neighbor}{ object of class \code{"Neighborhood"}. }
+ \item{\dots}{ additional parameters. }
+ \item{clip}{ positive real: clipping bound }
+ \item{stand}{ standardizing constant/matrix. }
+ \item{sampleSize}{ integer: sample size. }
+ \item{Algo}{ "A" or "B". }
+ \item{cont}{ "left" or "right". }
+}
+\details{The computation of the finite-sample under-/overshoot risk
+ is based on FFT. For more details we refer to Section 11.3 of Kohl (2005).
+}
+\value{The finite-sample risk is computed.}
+\section{Methods}{
+\describe{
+ \item{risk = "fiUnOvShoot", Distr = "Norm", neighbor = "ContNeighborhood"}{
+ computes finite-sample under-/overshoot risk in methods for
+ function \code{getFixRobIC}. }
+
+ \item{risk = "fiUnOvShoot", Distr = "Norm", neighbor = "TotalVarNeighborhood"}{
+ computes finite-sample under-/overshoot risk in methods for
+ function \code{getFixRobIC}. }
+}}
+\references{
+ Huber, P.J. (1968) Robust Confidence Limits. Z. Wahrscheinlichkeitstheor.
+ Verw. Geb. \bold{10}:269--278.
+
+ Kohl, M. (2005) \emph{Numerical Contributions to the Asymptotic Theory of Robustness}.
+ Bayreuth: Dissertation.
+
+ Ruckdeschel, P. and Kohl, M. (2005) Computation of the Finite Sample Risk
+ of M-estimators on Neighborhoods.
+}
+\author{Matthias Kohl \email{Matthias.Kohl at stamats.de}}
+%\note{}
+\seealso{\code{\link[distrMod]{fiRisk-class}}}
+%\examples{}
+\concept{finite-sample risk}
+\concept{risk}
+\keyword{robust}
Modified: branches/robast-1.1/pkg/RobExtremes/DESCRIPTION
===================================================================
--- branches/robast-1.1/pkg/RobExtremes/DESCRIPTION 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/RobExtremes/DESCRIPTION 2017-04-22 08:42:39 UTC (rev 930)
@@ -1,6 +1,6 @@
Package: RobExtremes
Version: 1.1
-Date: 2016-09-04
+Date: 2017-04-21
Title: Optimally Robust Estimation for Extreme Value Distributions
Description: Optimally robust estimation for extreme value distributions using S4 classes and methods (based on
packages distr, distrEx, distrMod, RobAStBase, and ROptEst).
@@ -24,4 +24,4 @@
URL: http://robast.r-forge.r-project.org/
LastChangedDate: {$LastChangedDate: 2011-09-30 11:10:33 +0200 (Fr, 30 Sep 2011) $}
LastChangedRevision: {$LastChangedRevision: 453 $}
-SVNRevision: 694
+SVNRevision: 932
Modified: branches/robast-1.1/pkg/RobExtremes/NAMESPACE
===================================================================
--- branches/robast-1.1/pkg/RobExtremes/NAMESPACE 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/RobExtremes/NAMESPACE 2017-04-22 08:42:39 UTC (rev 930)
@@ -1,4 +1,4 @@
-useDynLib("RobExtremes")
+useDynLib(RobExtremes, .registration = TRUE, .fixes = "C_")
import("methods")
import("RobAStRDA")
Modified: branches/robast-1.1/pkg/RobExtremes/R/kMAD.R
===================================================================
--- branches/robast-1.1/pkg/RobExtremes/R/kMAD.R 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/RobExtremes/R/kMAD.R 2017-04-22 08:42:39 UTC (rev 930)
@@ -11,12 +11,11 @@
if(! length(k)==1) stop ("k has to be a numeric of length 1")
if(k<=0) stop ("k has to be strictly positive")
eps1 <- min(diff(unique(sort(x))))
- erg <- .C("kMad", as.double(x),
+ erg <- .C(C_kMad, as.double(x),
as.integer(length(x)),
as.integer(k),
d = double(1),
- eps = as.double(min(eps1,eps)),
- PACKAGE="RobExtremes")
+ eps = as.double(min(eps1,eps)))
return(erg$d)
})
Modified: branches/robast-1.1/pkg/RobExtremes/man/ismevgpdgevdiag-methods.Rd
===================================================================
--- branches/robast-1.1/pkg/RobExtremes/man/ismevgpdgevdiag-methods.Rd 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/RobExtremes/man/ismevgpdgevdiag-methods.Rd 2017-04-22 08:42:39 UTC (rev 930)
@@ -102,7 +102,7 @@
\references{
ismev: An Introduction to Statistical Modeling of Extreme Values. R package
- version 1.39. http://CRAN.R-project.org/package=ismev; original S functions
+ version 1.39. https://CRAN.R-project.org/package=ismev; original S functions
written by Janet E. Heffernan with R port and R documentation provided by
Alec G. Stephenson. (2012).
Modified: branches/robast-1.1/pkg/RobExtremes/src/kMad.c
===================================================================
--- branches/robast-1.1/pkg/RobExtremes/src/kMad.c 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/RobExtremes/src/kMad.c 2017-04-22 08:42:39 UTC (rev 930)
@@ -1,7 +1,14 @@
#include <stdlib.h>
#include <stdio.h>
+#include <R.h>
+#include <Rinternals.h>
+#include <Rmath.h> /* constants */
+#include <R_ext/Rdynload.h>
+#include <R_ext/Visibility.h>
-int compare_doubles(const void *a,const void *b)
+#define C_DEF(name, n) {#name, (DL_FUNC) &name, n}
+
+int attribute_hidden compare_doubles(const void *a,const void *b)
{
double *da = (double*)a;
double *db = (double*)b;
@@ -13,7 +20,7 @@
return 0;
}
-void kMad(double *x, int *lx, int *kp, double *d, double *eps)
+void attribute_hidden kMad(double *x, int *lx, int *kp, double *d, double *eps)
{
double m;
int n2, r1, r2, i1, i2,j, k = (*kp);
@@ -106,3 +113,18 @@
// return 0;
// }
//
+
+/* P.R. 20170421: register routine */
+
+static const R_CMethodDef R_CDef[] = {
+ C_DEF(kMad, 5),
+ {NULL, NULL, 0}
+};
+
+void attribute_visible R_init_RobExtremes(DllInfo *dll)
+{
+ R_registerRoutines(dll, R_CDef, NULL, NULL, NULL);
+ R_useDynamicSymbols(dll, FALSE);
+ R_forceSymbols(dll, TRUE);
+
+}
Modified: branches/robast-1.1/pkg/RobLox/man/finiteSampleCorrection.Rd
===================================================================
--- branches/robast-1.1/pkg/RobLox/man/finiteSampleCorrection.Rd 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/RobLox/man/finiteSampleCorrection.Rd 2017-04-22 08:42:39 UTC (rev 930)
@@ -1,54 +1,54 @@
-\name{finiteSampleCorrection}
-\Rdversion{1.1}
-\alias{finiteSampleCorrection}
-\title{Function to compute finite-sample corrected radii}
-\description{
-Given some radius and some sample size the function computes
-the corresponding finite-sample corrected radius.
-}
-\usage{
-finiteSampleCorrection(r, n, model = "locsc")
-}
-\arguments{
- \item{r}{ asymptotic radius (non-negative numeric) }
- \item{n}{ sample size }
- \item{model}{ has to be \code{"locsc"} (for location and scale),
- \code{"loc"} (for location) or \code{"sc"} (for scale), respectively. }
-}
-\details{
-The finite-sample correction is based on empirical results obtained via
-simulation studies.
-
-Given some radius of a shrinking contamination neighborhood which leads
-to an asymptotically optimal robust estimator, the finite-sample empirical
-MSE based on contaminated samples was minimized for this class of
-asymptotically optimal estimators and the corresponding finite-sample
-radius determined and saved.
-
-The computation is based on the saved results of these Monte-Carlo simulations.
-}
-\value{Finite-sample corrected radius.}
-\references{
- Kohl, M. (2005) \emph{Numerical Contributions to the Asymptotic Theory of Robustness}.
- Bayreuth: Dissertation.
-
- Rieder, H. (1994) \emph{Robust Asymptotic Statistics}. New York: Springer.
-
- Rieder, H., Kohl, M. and Ruckdeschel, P. (2008) The Costs of not Knowing
- the Radius. Statistical Methods and Applications \emph{17}(1) 13-40.
- Extended version: \url{http://www.stamats.de/RRlong.pdf}
-}
-\author{Matthias Kohl \email{Matthias.Kohl at stamats.de}}
-%\note{}
-\seealso{\code{\link{roblox}}, \code{\link{rowRoblox}},
- \code{\link{colRoblox}} }
-\examples{
-finiteSampleCorrection(n = 3, r = 0.001, model = "locsc")
-finiteSampleCorrection(n = 10, r = 0.02, model = "loc")
-finiteSampleCorrection(n = 250, r = 0.15, model = "sc")
-}
-\concept{normal location}
-\concept{normal scale}
-\concept{normal location and scale}
-\concept{finite-sample correction}
-\keyword{robust}
+\name{finiteSampleCorrection}
+\Rdversion{1.1}
+\alias{finiteSampleCorrection}
+\title{Function to compute finite-sample corrected radii}
+\description{
+Given some radius and some sample size the function computes
+the corresponding finite-sample corrected radius.
+}
+\usage{
+finiteSampleCorrection(r, n, model = "locsc")
+}
+\arguments{
+ \item{r}{ asymptotic radius (non-negative numeric) }
+ \item{n}{ sample size }
+ \item{model}{ has to be \code{"locsc"} (for location and scale),
+ \code{"loc"} (for location) or \code{"sc"} (for scale), respectively. }
+}
+\details{
+The finite-sample correction is based on empirical results obtained via
+simulation studies.
+
+Given some radius of a shrinking contamination neighborhood which leads
+to an asymptotically optimal robust estimator, the finite-sample empirical
+MSE based on contaminated samples was minimized for this class of
+asymptotically optimal estimators and the corresponding finite-sample
+radius determined and saved.
+
+The computation is based on the saved results of these Monte-Carlo simulations.
+}
+\value{Finite-sample corrected radius.}
+\references{
+ Kohl, M. (2005) \emph{Numerical Contributions to the Asymptotic Theory of Robustness}.
+ Bayreuth: Dissertation.
+
+ Rieder, H. (1994) \emph{Robust Asymptotic Statistics}. New York: Springer.
+
+ Rieder, H., Kohl, M. and Ruckdeschel, P. (2008) The Costs of not Knowing
+ the Radius. Statistical Methods and Applications \emph{17}(1) 13-40.
+ Extended version: \url{http://www.stamats.de/RRlong.pdf}
+}
+\author{Matthias Kohl \email{Matthias.Kohl at stamats.de}}
+%\note{}
+\seealso{\code{\link{roblox}}, \code{\link{rowRoblox}},
+ \code{\link{colRoblox}} }
+\examples{
+finiteSampleCorrection(n = 3, r = 0.001, model = "locsc")
+finiteSampleCorrection(n = 10, r = 0.02, model = "loc")
+finiteSampleCorrection(n = 250, r = 0.15, model = "sc")
+}
+\concept{normal location}
+\concept{normal scale}
+\concept{normal location and scale}
+\concept{finite-sample correction}
+\keyword{robust}
Modified: branches/robast-1.1/pkg/RobLox/man/showdown.Rd
===================================================================
--- branches/robast-1.1/pkg/RobLox/man/showdown.Rd 2017-04-22 08:18:06 UTC (rev 929)
+++ branches/robast-1.1/pkg/RobLox/man/showdown.Rd 2017-04-22 08:42:39 UTC (rev 930)
@@ -1,82 +1,82 @@
-\name{showdown}
-\Rdversion{1.1}
-\alias{showdown}
-\title{Estimator Showdown by Monte-Carlo Study.}
-\description{
- The function \code{showdown} can be used to perform Monte-Carlo studies
- comparing a competitor with rmx estimators in case of normal location and scale.
- In addition, maximum likelihood (ML) estimators (mean and sd) and median and
- MAD are computed. The comparison is based on the empirical MSE.
-}
-\usage{
-showdown(n, M, eps, contD, seed = 123, estfun, estMean, estSd,
- eps.lower = 0, eps.upper = 0.05, steps = 3L, fsCor = TRUE,
- plot1 = FALSE, plot2 = FALSE, plot3 = FALSE)
-}
-%- maybe also 'usage' for other objects documented here.
-\arguments{
- \item{n}{integer; sample size, should be at least 3.}
- \item{M}{integer; Monte-Carlo replications.}
- \item{eps}{amount of contamination in [0, 0.5].}
- \item{contD}{object of class \code{"UnivariateDistribution"}; contaminating distribution.}
- \item{seed}{random seed.}
- \item{estfun}{function to compute location and scale estimator; see details below.}
- \item{estMean}{function to compute location estimator; see details below.}
- \item{estSd}{function to compute scale estimator; see details below.}
- \item{eps.lower}{used by rmx estimator.}
- \item{eps.upper}{used by rmx estimator.}
- \item{steps}{integer; steps used for estimator construction.}
- \item{fsCor}{logical; use finite-sample correction.}
- \item{plot1}{logical; plot cdf of ideal and real distribution.}
- \item{plot2}{logical; plot 20 (or M if M < 20) randomly selected samples.}
- \item{plot3}{logical; generate boxplots of the results.}
-}
-\details{
-Normal location and scale with mean = 0 and sd = 1 is used as ideal model (without
-restriction due to equivariance).
-
-Since there is no estimator which yields reliable results if 50 percent or more of the
-observations are contaminated, we use a modification where we re-simulate all samples
-including at least 50 percent contaminated data.
-
-If \code{estfun} is specified it has to compute and return a location and scale estimate
-(vector of length 2). One can also specify the location and scale estimator separately
-by using \code{estMean} and \code{estSd} where \code{estMean} computes and returns
-the location estimate and \code{estSd} the scale estimate.
-
-We use funtion \code{\link{rowRoblox}} for the computation of the rmx estimator.
-}
-\value{Data.frame including empirical MSE (standardized by sample size n) and
-relMSE with respect to the rmx estimator.
-}
-\references{
- Kohl, M. (2005) \emph{Numerical Contributions to the Asymptotic Theory of Robustness}.
- Bayreuth: Dissertation.
-
- Rieder, H. (1994) \emph{Robust Asymptotic Statistics}. New York: Springer.
-
- Rieder, H., Kohl, M. and Ruckdeschel, P. (2008) The Costs of not Knowing
- the Radius. Statistical Methods and Applications \emph{17}(1) 13-40.
- Extended version: \url{http://www.stamats.de/RRlong.pdf}
-
- M. Kohl, P. Ruckdeschel, and H. Rieder (2010). Infinitesimally Robust Estimation
- in General Smoothly Parametrized Models. \emph{Statistical Methods and Application},
- \bold{19}(3):333-354.
-}
-\author{Matthias Kohl \email{Matthias.Kohl at stamats.de}}
-%\note{}
-\seealso{\code{\link{rowRoblox}}}
-\examples{
-library(MASS)
-## compare with Huber's Proposal 2
-showdown(n = 20, M = 100, eps = 0.02, contD = Norm(mean = 3, sd = 3),
- estfun = function(x){ unlist(hubers(x)) },
- plot1 = TRUE, plot2 = TRUE, plot3 = TRUE)
-
-## compare with Huber M estimator with MAD scale
-showdown(n = 20, M = 100, eps = 0.02, contD = Norm(mean = 3, sd = 3),
- estfun = function(x){ unlist(huber(x)) },
- plot1 = TRUE, plot2 = TRUE, plot3 = TRUE)
-}
-\concept{Monte-Carlo study}
-\keyword{robust}
+\name{showdown}
+\Rdversion{1.1}
+\alias{showdown}
+\title{Estimator Showdown by Monte-Carlo Study.}
+\description{
+ The function \code{showdown} can be used to perform Monte-Carlo studies
+ comparing a competitor with rmx estimators in case of normal location and scale.
+ In addition, maximum likelihood (ML) estimators (mean and sd) and median and
+ MAD are computed. The comparison is based on the empirical MSE.
+}
+\usage{
+showdown(n, M, eps, contD, seed = 123, estfun, estMean, estSd,
+ eps.lower = 0, eps.upper = 0.05, steps = 3L, fsCor = TRUE,
+ plot1 = FALSE, plot2 = FALSE, plot3 = FALSE)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{n}{integer; sample size, should be at least 3.}
+ \item{M}{integer; Monte-Carlo replications.}
+ \item{eps}{amount of contamination in [0, 0.5].}
+ \item{contD}{object of class \code{"UnivariateDistribution"}; contaminating distribution.}
+ \item{seed}{random seed.}
+ \item{estfun}{function to compute location and scale estimator; see details below.}
+ \item{estMean}{function to compute location estimator; see details below.}
+ \item{estSd}{function to compute scale estimator; see details below.}
+ \item{eps.lower}{used by rmx estimator.}
+ \item{eps.upper}{used by rmx estimator.}
+ \item{steps}{integer; steps used for estimator construction.}
+ \item{fsCor}{logical; use finite-sample correction.}
+ \item{plot1}{logical; plot cdf of ideal and real distribution.}
+ \item{plot2}{logical; plot 20 (or M if M < 20) randomly selected samples.}
+ \item{plot3}{logical; generate boxplots of the results.}
+}
+\details{
+Normal location and scale with mean = 0 and sd = 1 is used as ideal model (without
+restriction due to equivariance).
+
+Since there is no estimator which yields reliable results if 50 percent or more of the
+observations are contaminated, we use a modification where we re-simulate all samples
+including at least 50 percent contaminated data.
+
+If \code{estfun} is specified it has to compute and return a location and scale estimate
+(vector of length 2). One can also specify the location and scale estimator separately
+by using \code{estMean} and \code{estSd} where \code{estMean} computes and returns
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/robast -r 930
More information about the Robast-commits
mailing list