From noreply at r-forge.r-project.org Tue May 6 21:04:23 2025 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 6 May 2025 21:04:23 +0200 (CEST) Subject: [Distr-commits] r1506 - branches/distr-2.9/pkg/distrEx/R branches/distr-2.9/pkg/distrEx/inst pkg/distrEx/R pkg/distrEx/inst Message-ID: <20250506190423.CC96F1805AF@r-forge.r-project.org> Author: ruckdeschel Date: 2025-05-06 21:04:23 +0200 (Tue, 06 May 2025) New Revision: 1506 Modified: branches/distr-2.9/pkg/distrEx/R/Functionals.R branches/distr-2.9/pkg/distrEx/inst/NEWS pkg/distrEx/R/Functionals.R pkg/distrEx/inst/NEWS Log: [distrEx] (trunk and devel): found a glitch in var-method for compound distributions (see comments in file Functionals.R for details) Modified: branches/distr-2.9/pkg/distrEx/R/Functionals.R =================================================================== --- branches/distr-2.9/pkg/distrEx/R/Functionals.R 2025-01-18 11:12:13 UTC (rev 1505) +++ branches/distr-2.9/pkg/distrEx/R/Functionals.R 2025-05-06 19:04:23 UTC (rev 1506) @@ -9,8 +9,7 @@ function(x, fun = function(t) {t}, cond, withCond = FALSE, useApply = TRUE, ...){ if(missing(useApply)) useApply <- TRUE - dots <- match.call(call = sys.call(sys.parent(1)), - expand.dots = FALSE)$"..." + dots <- list(...) low <- -Inf; upp <- Inf if(hasArg(low)) low <- dots$low if(hasArg(upp)) upp <- dots$upp @@ -77,7 +76,17 @@ S <- x at SummandsDistr N <- x at NumbOfSummandsDistr if(is(S,"UnivariateDistribution")){ - return(E(N)*var(S, ...)+ (var(S, ...)+E(S, ...)^2)*var(N)) + en <- E(N) + vn <- var(N) + es <- E(S, ...) + vs <- var(S, ...) + ## wrong: (corrected 20250506) + ## E(N)*var(S, ...)+ (var(S, ...)+E(S, ...)^2)*var(N)); + ## this is correct: + ## Var(CN) = E(Var(sum.{i=1}^N} S.i | N)) + Var(E(sum.{i=1}^N} S.i | N)) = + ## = E[N Var(S)] + Var[N E(S)] = + ## = E(N) Var(S) + Var(N) E(S)^2 + return(en * vs + es^2 * vn) } else return(var(simplifyD(x),...)) }}) @@ -88,15 +97,14 @@ ################################################################################ setMethod("sd", signature(x = "UnivariateDistribution"), function(x, fun, cond, withCond = FALSE, useApply = TRUE, - propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + propagate.names=getdistrExOption("propagate.names.functionals"), ...){ propagate.names0 <- propagate.names - dots <- match.call(call = sys.call(sys.parent(1)), - expand.dots = FALSE)$"..." + dots <- list(...) dots$propagate.names <- NULL if(missing(fun)) {if(missing(cond)) return(sqrt(do.call(var,c(list(x, useApply = useApply, - propagate.names = propagate.names0),dots)))) + propagate.names=propagate.names0),dots)))) else return(sqrt(do.call(var,c(list(x, cond =cond, withCond = FALSE, useApply = useApply, dots))))) @@ -112,7 +120,7 @@ ### overload "sd" method for "Norm" ... setMethod("sd", signature(x = "Norm"), function(x, fun, cond, withCond = FALSE, useApply = TRUE, - propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + propagate.names=getdistrExOption("propagate.names.functionals"), ...){ if(missing(fun)) {if(missing(cond)){ ret.v <- sd(param(x)) @@ -161,7 +169,7 @@ if(is(Symmetry(x),"SphericalSymmetry")) return(q.l(x)(3/4)) m <- median(x) - y <- abs(x - m) + y <- abs(x-m) return(q.l(y)(1/2)) }) @@ -184,11 +192,11 @@ setMethod("IQR", signature(x = "UnivariateCondDistribution"), function(x, cond){ - return(q.l(x)(3/4, cond = cond) - q.l(x)(1/4, cond = cond)) + return(q.l(x)(3/4, cond = cond)-q.l(x)(1/4, cond = cond)) }) setMethod("IQR", signature(x = "DiscreteDistribution"), - function(x) q.r(x)(3/4) - q.l(x)(1/4) + function(x) q.r(x)(3/4)-q.l(x)(1/4) ) setMethod("IQR", signature(x = "AffLinDistribution"), @@ -213,7 +221,7 @@ # some exact variances: ################################################################# setMethod("var", signature(x = "Norm"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"),...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"),...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -228,7 +236,7 @@ }) setMethod("var", signature(x = "Binom"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"),...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"),...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -259,7 +267,7 @@ ### source https://mathworld.wolfram.com/CauchyDistribution.html setMethod("var", signature(x = "Chisq"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"),...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"),...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -293,7 +301,7 @@ ### source https://mathworld.wolfram.com/LaplaceDistribution.html setMethod("var", signature(x = "Exp"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -310,7 +318,7 @@ ### source https://mathworld.wolfram.com/ExponentialDistribution.html setMethod("var", signature(x = "Fd"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -330,7 +338,7 @@ ### source (without ncp) https://mathworld.wolfram.com/F-Distribution.html setMethod("var", signature(x = "Gammad"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -346,7 +354,7 @@ ### source https://mathworld.wolfram.com/GammaDistribution.html setMethod("var", signature(x = "Geom"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -364,7 +372,7 @@ ### source https://mathworld.wolfram.com/GeometricDistribution.html setMethod("var", signature(x = "Hyper"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -383,7 +391,7 @@ ### source https://mathworld.wolfram.com/HypergeometricDistribution.html setMethod("var", signature(x = "Logis"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -400,7 +408,7 @@ ### source https://mathworld.wolfram.com/LogisticDistribution.html setMethod("var", signature(x = "Lnorm"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -417,7 +425,7 @@ ### source https://mathworld.wolfram.com/LogNormalDistribution.html setMethod("var", signature(x = "Nbinom"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -435,7 +443,7 @@ ### source https://mathworld.wolfram.com/NegativeBinomialDistribution.html setMethod("var", signature(x = "Pois"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -452,7 +460,7 @@ ### source https://mathworld.wolfram.com/PoissonDistribution.html setMethod("var", signature(x = "Td"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -461,7 +469,7 @@ if(hasArg(fun)||hasArg(cond)||!is.null(low)||!is.null(upp)) return(var(as(x,"AbscontDistribution"),...)) else - {n <- df(x); d <- ncp(x) + {n <- df(x); d<- ncp(x) ## correction thanks to G.Jay Kerns ### corrected again P.R. ret.v <- ifelse( n>2, n/(n-2)*(1+d^2) -d^2*n/2*exp(2*(lgamma((n-1)/2)-lgamma(n/2))), NA) @@ -473,7 +481,7 @@ ### source https://mathworld.wolfram.com/NoncentralStudentst-Distribution.html setMethod("var", signature(x = "Unif"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -490,7 +498,7 @@ ### source https://mathworld.wolfram.com/UniformDistribution.html setMethod("var", signature(x = "Weibull"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -508,7 +516,7 @@ ### source https://mathworld.wolfram.com/WeibullDistribution.html setMethod("var", signature(x = "Beta"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals"), ...){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals"), ...){ dots <- match.call(call = sys.call(sys.parent(1)), expand.dots = FALSE)$"..." fun <- NULL; cond <- NULL; low <- NULL; upp <- NULL @@ -543,7 +551,7 @@ ################################################################# setMethod("median", signature(x = "Norm"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- mean(x) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -551,7 +559,7 @@ ) setMethod("median", signature(x = "Cauchy"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- location(x) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -559,7 +567,7 @@ ) setMethod("median", signature(x = "Dirac"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- location(x) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -570,7 +578,7 @@ function(x) 0) setMethod("median", signature(x = "Exp"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- log(2)/rate(x) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -578,7 +586,7 @@ ) setMethod("median", signature(x = "Geom"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- ceiling(-log(2)/log(1-prob(x))-1) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -586,7 +594,7 @@ ) setMethod("median", signature(x = "Logis"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- location(x) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -594,7 +602,7 @@ ) setMethod("median", signature(x = "Lnorm"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- exp(meanlog(x)) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -602,7 +610,7 @@ ) setMethod("median", signature(x = "Unif"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- (Max(x)+Min(x))/2 if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -618,7 +626,7 @@ ################################################################# setMethod("IQR", signature(x = "Norm"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- 2*qnorm(3/4)*sd(x) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -626,7 +634,7 @@ ) setMethod("IQR", signature(x = "Cauchy"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- 2*scale(x)*qcauchy(3/4) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -640,7 +648,7 @@ function(x) 2*log(2)) setMethod("IQR", signature(x = "Exp"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- (log(4)-log(4/3))/rate(x) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -648,7 +656,7 @@ ) setMethod("IQR", signature(x = "Geom"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- ceiling(log(1/4)/log(1-prob(x)))- max(floor(log(3/4)/log(1-prob(x))),0) if(!propagate.names){names(ret.v) <- NULL} @@ -657,7 +665,7 @@ ) setMethod("IQR", signature(x = "Logis"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- 2*log(3)*scale(x) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -665,7 +673,7 @@ ) setMethod("IQR", signature(x = "Unif"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- (Max(x)-Min(x))/2 if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -680,7 +688,7 @@ ################################################################# setMethod("mad", signature(x = "Norm"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- qnorm(3/4)*sd(x) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -688,7 +696,7 @@ ) setMethod("mad", signature(x = "Cauchy"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- scale(x)*qcauchy(3/4) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -702,7 +710,7 @@ function(x) log(2)) setMethod("mad", signature(x = "Exp"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- log((1+sqrt(5))/2)/rate(x) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -710,7 +718,7 @@ ) setMethod("mad", signature(x = "Geom"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")) { + function(x, propagate.names=getdistrExOption("propagate.names.functionals")) { p <- prob(x); pq <- 1-p m <- median(x); rho <- 1/2*pq^(-m) ret.v <- max(ceiling(-log(rho/2+sqrt(pq+rho^2/4))/log(pq)),0) @@ -719,7 +727,7 @@ }) setMethod("mad", signature(x = "Logis"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- log(3)*scale(x) if(!propagate.names){names(ret.v) <- NULL} return(ret.v) @@ -727,7 +735,7 @@ ) setMethod("mad", signature(x = "Unif"), - function(x, propagate.names = getdistrExOption("propagate.names.functionals")){ + function(x, propagate.names=getdistrExOption("propagate.names.functionals")){ ret.v <- (Max(x)-Min(x))/4 if(!propagate.names){names(ret.v) <- NULL} return(ret.v) Modified: branches/distr-2.9/pkg/distrEx/inst/NEWS =================================================================== --- branches/distr-2.9/pkg/distrEx/inst/NEWS 2025-01-18 11:12:13 UTC (rev 1505) +++ branches/distr-2.9/pkg/distrEx/inst/NEWS 2025-05-06 19:04:23 UTC (rev 1506) @@ -8,6 +8,14 @@ information) ############## +v 2.9.7 +############## + +bug fix: ++ found a glitch in var-method for compound distributions + (see comments in file Functionals.R for details) + +############## v 2.9.6 ############## Modified: pkg/distrEx/R/Functionals.R =================================================================== --- pkg/distrEx/R/Functionals.R 2025-01-18 11:12:13 UTC (rev 1505) +++ pkg/distrEx/R/Functionals.R 2025-05-06 19:04:23 UTC (rev 1506) @@ -76,7 +76,17 @@ S <- x at SummandsDistr N <- x at NumbOfSummandsDistr if(is(S,"UnivariateDistribution")){ - return(E(N)*var(S, ...)+ (var(S, ...)+E(S, ...)^2)*var(N)) + en <- E(N) + vn <- var(N) + es <- E(S, ...) + vs <- var(S, ...) + ## wrong: (corrected 20250506) + ## E(N)*var(S, ...)+ (var(S, ...)+E(S, ...)^2)*var(N)); + ## this is correct: + ## Var(CN) = E(Var(sum.{i=1}^N} S.i | N)) + Var(E(sum.{i=1}^N} S.i | N)) = + ## = E[N Var(S)] + Var[N E(S)] = + ## = E(N) Var(S) + Var(N) E(S)^2 + return(en * vs + es^2 * vn) } else return(var(simplifyD(x),...)) }}) Modified: pkg/distrEx/inst/NEWS =================================================================== --- pkg/distrEx/inst/NEWS 2025-01-18 11:12:13 UTC (rev 1505) +++ pkg/distrEx/inst/NEWS 2025-05-06 19:04:23 UTC (rev 1506) @@ -8,6 +8,14 @@ information) ############## +v 2.9.7 +############## + +bug fix: ++ found a glitch in var-method for compound distributions + (see comments in file Functionals.R for details) + +############## v 2.9.6 ############## From noreply at r-forge.r-project.org Tue May 6 21:05:37 2025 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 6 May 2025 21:05:37 +0200 (CEST) Subject: [Distr-commits] r1507 - branches/distr-2.9/pkg/distr/man Message-ID: <20250506190537.7075B18450D@r-forge.r-project.org> Author: ruckdeschel Date: 2025-05-06 21:05:37 +0200 (Tue, 06 May 2025) New Revision: 1507 Modified: branches/distr-2.9/pkg/distr/man/0distr-package.Rd Log: [distr] trunk: minor remainder from last published revision Modified: branches/distr-2.9/pkg/distr/man/0distr-package.Rd =================================================================== --- branches/distr-2.9/pkg/distr/man/0distr-package.Rd 2025-05-06 19:04:23 UTC (rev 1506) +++ branches/distr-2.9/pkg/distr/man/0distr-package.Rd 2025-05-06 19:05:37 UTC (rev 1507) @@ -46,8 +46,8 @@ Package: \tab distr \cr Version: \tab 2.9.6 \cr Date: \tab 2024-08-29 \cr -Depends: \tab R(>= 3.4), methods, graphics, startupmsg, sfsmisc \cr -Suggests: \tab distrEx, svUnit (>= 0.7-11), knitr, distrMod, ROptEst \cr +Depends: \tab R(>= 3.4), methods, graphics, startupmsg(>= 1.0.0), sfsmisc \cr +Suggests: \tab distrEx, svUnit(>= 0.7-11), knitr, distrMod, ROptEst \cr Imports: \tab stats, grDevices, utils, MASS \cr LazyLoad: \tab yes \cr License: \tab LGPL-3 \cr From noreply at r-forge.r-project.org Tue May 6 21:09:37 2025 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 6 May 2025 21:09:37 +0200 (CEST) Subject: [Distr-commits] r1508 - branches/distr-2.9/pkg/distrDoc/inst branches/distr-2.9/pkg/distrSim pkg/distrSim pkg/startupmsg Message-ID: <20250506190937.83160180545@r-forge.r-project.org> Author: ruckdeschel Date: 2025-05-06 21:09:37 +0200 (Tue, 06 May 2025) New Revision: 1508 Modified: branches/distr-2.9/pkg/distrDoc/inst/NEWS branches/distr-2.9/pkg/distrSim/DESCRIPTION pkg/distrSim/DESCRIPTION pkg/startupmsg/DESCRIPTION Log: some remainders from the last submission to CRAN Modified: branches/distr-2.9/pkg/distrDoc/inst/NEWS =================================================================== --- branches/distr-2.9/pkg/distrDoc/inst/NEWS 2025-05-06 19:05:37 UTC (rev 1507) +++ branches/distr-2.9/pkg/distrDoc/inst/NEWS 2025-05-06 19:09:37 UTC (rev 1508) @@ -1,4 +1,4 @@ - ###################################################################### +###################################################################### # News: to package distrDoc ###################################################################### Modified: branches/distr-2.9/pkg/distrSim/DESCRIPTION =================================================================== --- branches/distr-2.9/pkg/distrSim/DESCRIPTION 2025-05-06 19:05:37 UTC (rev 1507) +++ branches/distr-2.9/pkg/distrSim/DESCRIPTION 2025-05-06 19:09:37 UTC (rev 1508) @@ -7,7 +7,7 @@ Depends: R(>= 3.4), methods, graphics, setRNG(>= 2006.2-1), distr(>= 2.8.0) Suggests: distrEx(>= 2.8.0) Enhances: distrTEst -Imports: startupmsg, stats, grDevices +Imports: startupmsg(>= 1.0.0), stats, grDevices Authors at R: c(person("Florian", "Camphausen", role="ctb", comment="contributed as student in the initial phase --2005"), person("Matthias", "Kohl", role=c("aut", "cph"), comment = c(ORCID = "0000-0001-9514-8910")), person("Peter", "Ruckdeschel", Modified: pkg/distrSim/DESCRIPTION =================================================================== --- pkg/distrSim/DESCRIPTION 2025-05-06 19:05:37 UTC (rev 1507) +++ pkg/distrSim/DESCRIPTION 2025-05-06 19:09:37 UTC (rev 1508) @@ -7,7 +7,7 @@ Depends: R(>= 3.4), methods, graphics, setRNG(>= 2006.2-1), distr(>= 2.5.2) Suggests: distrEx(>= 2.2) Enhances: distrTEst -Imports: startupmsg, stats, grDevices +Imports: startupmsg(>= 1.0.0), stats, grDevices Authors at R: c(person("Florian", "Camphausen", role="ctb", comment="contributed as student in the initial phase --2005"), person("Matthias", "Kohl", role=c("aut", "cph")), person("Peter", "Ruckdeschel", role=c("cre", "cph"), Modified: pkg/startupmsg/DESCRIPTION =================================================================== --- pkg/startupmsg/DESCRIPTION 2025-05-06 19:05:37 UTC (rev 1507) +++ pkg/startupmsg/DESCRIPTION 2025-05-06 19:09:37 UTC (rev 1508) @@ -1,6 +1,6 @@ Package: startupmsg Encoding: UTF-8 -Version: 1.0.0 +Version: 1.0.1 Date: 2025-01-11 Title: Utilities for Start-Up Messages Description: Provides utilities to create or suppress start-up messages. From noreply at r-forge.r-project.org Tue May 6 21:10:51 2025 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 6 May 2025 21:10:51 +0200 (CEST) Subject: [Distr-commits] r1509 - pkg Message-ID: <20250506191051.3EBD4180545@r-forge.r-project.org> Author: ruckdeschel Date: 2025-05-06 21:10:50 +0200 (Tue, 06 May 2025) New Revision: 1509 Added: pkg/20250112TexteFurCRAN-Submission.txt pkg/20250115FehlerAnalyseRCMDCHECK.txt Log: writeups for CRAN submission and error analysis for MikTeX problem /usr/local/bin/subversion_commit-email: `/usr/bin/svnlook diff /svnroot/distr -r 1509' failed with this output: svnlook: E000022: Can't convert string from 'UTF-8' to native encoding: svnlook: E000022: Added: pkg/20250112TexteFurCRAN-Submission.txt =================================================================== From noreply at r-forge.r-project.org Tue May 6 21:14:59 2025 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 6 May 2025 21:14:59 +0200 (CEST) Subject: [Distr-commits] r1510 - / pkg Message-ID: <20250506191459.33F99180545@r-forge.r-project.org> Author: ruckdeschel Date: 2025-05-06 21:14:58 +0200 (Tue, 06 May 2025) New Revision: 1510 Added: 20240905WriteUpKHornikS3Methods.txt pkg/20250116HintsAsToR-CMD-issue.txt Log: yet some remainder writeups Added: 20240905WriteUpKHornikS3Methods.txt =================================================================== --- 20240905WriteUpKHornikS3Methods.txt (rev 0) +++ 20240905WriteUpKHornikS3Methods.txt 2025-05-06 19:14:58 UTC (rev 1510) @@ -0,0 +1,36 @@ + ## Check S3 generics and methods consistency. + + ## Unfortunately, what is an S3 method is not clear. + ## These days, S3 methods for a generic GEN are found + ## A. via GEN.CLS lookup from the callenv to its topenv; + ## B. the S3 registry; + ## C. GEN.CLS lookup from the parent of the topenv to baseenv, + ## skipping everything on the search path between globalenv and + ## baseenv. + ## Thus if "package code" calls GEN, we first look in the package + ## namespace itself, then in the registry, and then in the package + ## imports and .BaseNamespaceEnv (and globalenv and baseenv again). + ## + ## Clearly, everything registered via S3method() should be an S3 + ## method. Interestingly, we seem to have some registrations for + ## non-generics, such as grDevices::axis(). These are "harmless" + ## but likely not "as intended", and hence inconsistencies are not + ## ignored. + ## + ## If the package namespace has a function named GEN.CLS, it is used + ## as an S3 method for an S3 generic named GEN (and hence "is an S3 + ## method") only if the package code actually calls GEN (see A + ## above). So one could argue that we should not be looking at all + ## GEN.CLS matches with GEN a generic in the package itself, its + ## imports or base, but restrict to only the ones where the package + ## code calls GEN. Doable, but not straightforward (calls could be + ## PKG::GEN) and possibly quite time consuming. For generics from + ## the package itself or its imports, not restricting should not + ## make a difference (why define or import when not calling?), but + ## for generics from base it may: hence we filter out the mismatches + ## for base GEN not called in the package. + ## + ## If a package provides an S3 generic GEN, there is no need to + ## register GEN.CLS functions for "internal use" (see above). + ## However, if GEN is exported then likely all GEN.CLS functions + ## should be registered as S3 methods. \ No newline at end of file Added: pkg/20250116HintsAsToR-CMD-issue.txt =================================================================== --- pkg/20250116HintsAsToR-CMD-issue.txt (rev 0) +++ pkg/20250116HintsAsToR-CMD-issue.txt 2025-05-06 19:14:58 UTC (rev 1510) @@ -0,0 +1,91 @@ +## ----------------------------------------------------------------- +## UTF-8 encoding issue with R CMD check with install-args="--latex" +## ----------------------------------------------------------------- +## Peter Ruckdeschel, Oldenburg University +## ----------------------------------------------------------------- +# peter.ruckdeschel at uol.de, peter.ruckdeschel at web.de +# 2025-01-16 +## ----------------------------------------------------------------- + +This reports first insights into the error thrown at + +R CMD check --install-args="--latex" \_.tar.gz + +Seen error message: + +=== +* checking PDF version of manual ... WARNING +LaTeX errors when creating PDF version. +This typically indicates Rd problems. +LaTeX errors found: +! Undefined control sequence. +l.37 \inputencoding + {utf8} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +=== + +Digging deeper into it, I find that + + tools:::.Rd2pdf() + +starting in code line 576 of Rd2pdf.R inserts the following line +into the TeX file of the manual + + \makeatletter\@ifl at t@r\fmtversion{2018/04/01}{}{\usepackage[utf8]{inputenc}}\makeatother + +[and this is the only location in the R code of pkg tools where such a string is written.] +I.e., in recent TeX-versions the following line is _not_ inserted to the TeX file of the manual + + \usepackage[utf8]{inputenc} + +and consequently (as the alternatives to inputenc are not reached either in my case) pdfLaTeX will +not know command \inputencoding which causes the error described above. + +We also note that line 576 is only reached (in if clauses) if logical variable asUTF8 is TRUE. +However, the code of tools:::.Rd2pdf starting from line 641 in file Rd2pdf.R writes the lines + + \Rdcontents{Contents} + \inputencoding{utf8} + +into the TeX file of the manual, [and againg, this is the only location in the R code of pkg tools where +such strings are written.] Of these two lines the latter is only reached if asUTF is FALSE. + +So I suppose option --install-args="--latex" somehow interferes with this so that asUTF inbetween +lines 576 and 641 gets changed, but I have not been able to identify where and how this could +happen. + +============================================================================= +> sessionInfo() +R Under development (unstable) (2025-01-10 r87562 ucrt) +Platform: x86_64-w64-mingw32/x64 +Running under: Windows 11 x64 (build 26100) + +Matrix products: default + LAPACK version 3.12.0 + +locale: +[1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8 +[3] LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C +[5] LC_TIME=German_Germany.utf8 + +time zone: Europe/Berlin +tzcode source: internal + +attached base packages: +[1] stats graphics grDevices utils datasets methods base + +loaded via a namespace (and not attached): + [1] utf8_1.2.4 R6_2.5.1 magrittr_2.0.3 gtable_0.3.5 + [5] glue_1.7.0 tibble_3.2.1 pkgconfig_2.0.3 lifecycle_1.0.4 + [9] ggplot2_3.5.1 cli_3.6.3 fansi_1.0.6 scales_1.3.0 +[13] grid_4.5.0 vctrs_0.6.5 compiler_4.5.0 munsell_0.5.1 +[17] pillar_1.9.0 colorspace_2.1-1 rlang_1.1.4 + +============================================================================= +As to MikTeX, see:This is pdfTeX, Version 3.141592653-2.6-1.40.26 (MiKTeX 24.4) +(preloaded format=pdflatex 2025.1.11) 11 JAN 2025 20:25 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +=============================================================================