New Upstream Snapshot - r-cran-goftest
Ready changes
Summary
Merged new upstream version: 1.2-3+git20191127.1.ef942bf (was: 1.2-3).
Resulting package
Built on 2023-01-20T01:25 (took 5m46s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots r-cran-goftest-dbgsymapt install -t fresh-snapshots r-cran-goftest
Lintian Result
- r-cran-goftest-dbgsym_1.2-3+git20191127.1.ef942bf-1~jan+nus2_amd64.deb
- r-cran-goftest_1.2-3+git20191127.1.ef942bf-1~jan+nus2.dsc
- r-cran-goftest_1.2-3+git20191127.1.ef942bf-1~jan+nus2_amd64.buildinfo
- r-cran-goftest_1.2-3+git20191127.1.ef942bf-1~jan+nus2_amd64.deb
- r-cran-goftest_1.2-3+git20191127.1.ef942bf-1~jan+nus2_amd64.changes
Diff
diff --git a/DESCRIPTION b/DESCRIPTION
index 80fa4f2..fb44922 100755
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
Package: goftest
Type: Package
Title: Classical Goodness-of-Fit Tests for Univariate Distributions
-Version: 1.2-3
-Date: 2021-10-07
+Version: 1.2-2
+Date: 2019-11-27
Authors@R: c(person("Julian", "Faraway", role = "aut"),
person("George", "Marsaglia", role = "aut"),
person("John", "Marsaglia", role = "aut"),
@@ -15,13 +15,11 @@ Description: Cramer-Von Mises and Anderson-Darling tests of goodness-of-fit
efficient algorithms.
URL: https://github.com/baddstats/goftest
BugReports: https://github.com/baddstats/goftest/issues
-License: GPL (>= 2)
+License: GPL (>=2)
NeedsCompilation: yes
-Packaged: 2021-10-07 07:30:39 UTC; adrian
+Packaged: 2023-01-20 01:20:55 UTC; root
Author: Julian Faraway [aut],
George Marsaglia [aut],
John Marsaglia [aut],
Adrian Baddeley [aut, cre]
Maintainer: Adrian Baddeley <Adrian.Baddeley@curtin.edu.au>
-Repository: CRAN
-Date/Publication: 2021-10-07 09:20:02 UTC
diff --git a/MD5 b/MD5
deleted file mode 100644
index 1441789..0000000
--- a/MD5
+++ /dev/null
@@ -1,33 +0,0 @@
-29111628fe1b2d270ef5df0c5ff3c6c5 *DESCRIPTION
-15b924eea35078a33ce9a9597f352439 *NAMESPACE
-e45a60eb1d479da9631e0dd3a45d9ec1 *R/RCS/andarl.R,v
-d7a9c3d741437b87b272318a38e01fd7 *R/RCS/cramer.R,v
-f149bfb2b89d8c70e8807f2a5357ee48 *R/RCS/cvmtest.R,v
-56ce831b8afd6f55b7f7180a470226c1 *R/RCS/recog.R,v
-2d55fdb30747e83b2380d5bf777b1898 *R/andarl.R
-e967698c8e63feae74fefd362e996d6d *R/braun.R
-e2fbe5802aff0bcb1ff080f9ce8dbf65 *R/cramer.R
-723adf9bac297d8d04daba9b6df77847 *R/cvmtest.R
-d3146be4396e0b2db19377e00d110794 *R/oldRCS/andarl.R,v
-8052568d7f91b67ab5e8794f559b4cab *R/oldRCS/cramer.R,v
-2c68dc762655bbc1958556cb1d84fa55 *R/oldRCS/cvmtest.R,v
-56ce831b8afd6f55b7f7180a470226c1 *R/oldRCS/recog.R,v
-b5dc530d801f347fcc103ba9a9ef2bd6 *R/recog.R
-29b8a1f246a7963b8d8e9cb77543f0c2 *build/partial.rdb
-4ca09aee4f6ec8772a37f287a23a503a *man/RCS/ad.test.Rd,v
-8c8471c1ed64c58a562fa42ffcd35b6b *man/RCS/cvm.test.Rd,v
-62bc401099f8d0a7522fb4d24b5f71a4 *man/RCS/goftest-package.Rd,v
-6e322a80bcf915758cf6b34edfe8c55c *man/RCS/pAD.Rd,v
-d0f7bb029253ac0d213e7f7be7f21690 *man/RCS/pCvM.Rd,v
-b26573082916c8dc121ae0610198cfcc *man/ad.test.Rd
-c4a9a49bd5eb2b0bc0c0c2d26eed4929 *man/cvm.test.Rd
-aeefaa4a55958c09f7f8cc3ad4dc2eae *man/goftest-package.Rd
-d31fca48d10c5dd9e63be3955c14412d *man/pAD.Rd
-b6294a6cc54d82ceb166326a40f07b4c *man/pCvM.Rd
-a4f4486d8a6e4b08d73001ef3134c2a2 *man/recogniseCdf.Rd
-ca3270c176ce09cd15243bf4df918aa9 *src/ADinf.c
-d7fa22cf49d25bc1ceb8fa5b02dc5aa2 *src/AnDarl.c
-db80933a3060fbea79e3fee3c0e04278 *src/RCS/ADinf.c,v
-ba414da1b88f5baa526cf93958359949 *src/RCS/AnDarl.c,v
-a197e1a03ae0ab8761473c5ad9bc9508 *src/init.c
-84f17e3621a4165a4d306993459dfaa8 *tests/all.R
diff --git a/R/RCS/andarl.R,v b/R/RCS/andarl.R,v
deleted file mode 100755
index 79ed77a..0000000
--- a/R/RCS/andarl.R,v
+++ /dev/null
@@ -1,424 +0,0 @@
-head 1.10;
-access;
-symbols;
-locks
- adrian:1.10; strict;
-comment @# @;
-
-
-1.10
-date 2018.06.06.08.25.51; author adrian; state Exp;
-branches;
-next 1.9;
-
-1.9
-date 2018.06.06.08.10.11; author adrian; state Exp;
-branches;
-next 1.8;
-
-1.8
-date 2018.06.06.08.05.21; author adrian; state Exp;
-branches;
-next 1.7;
-
-1.7
-date 2018.03.29.13.51.49; author adrian; state Exp;
-branches;
-next 1.6;
-
-1.6
-date 2014.06.24.02.12.20; author adrian; state Exp;
-branches;
-next 1.5;
-
-1.5
-date 2014.06.24.01.54.16; author adrian; state Exp;
-branches;
-next 1.4;
-
-1.4
-date 2014.06.09.05.07.09; author adrian; state Exp;
-branches;
-next 1.3;
-
-1.3
-date 2014.06.09.05.02.30; author adrian; state Exp;
-branches;
-next 1.2;
-
-1.2
-date 2014.06.09.04.34.57; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.09.04.26.35; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.10
-log
-@Summary: tweak
-@
-text
-@##
-## andarl.R
-##
-## Anderson-Darling test and null distribution
-##
-## $Revision: 1.9 $ $Date: 2018/06/06 08:10:11 $
-##
-
-ad.test <- function(x, null="punif", ..., estimated=FALSE, nullname) {
- xname <- deparse(substitute(x))
- nulltext <- deparse(substitute(null))
- if(is.character(null)) nulltext <- null
- if(missing(nullname) || is.null(nullname)) {
- reco <- recogniseCdf(nulltext)
- nullname <- if(!is.null(reco)) reco else
- paste("distribution", sQuote(nulltext))
- }
- stopifnot(is.numeric(x))
- x <- as.vector(x)
- n <- length(x)
- F0 <- getCdf(null)
- U <- F0(x, ...)
- if(any(U < 0 | U > 1))
- stop("null distribution function returned values outside [0,1]")
- if(!estimated || n <= 4) {
- #' simple null hypothesis
- z <- do.goftest.AD(U)
- PVAL <- z$pvalue
- STATISTIC <- z$adstat
- names(STATISTIC) <- "An"
- } else {
- #' composite - use Braun (1980)
- first <- sample(n, ceiling(n/2), replace=TRUE)
- z1 <- do.goftest.AD(U[first])
- z2 <- do.goftest.AD(U[-first])
- STATISTIC <- max(z1$adstat, z2$adstat)
- names(STATISTIC) <- "AnMax"
- PVAL <- 1 - (1 - z1$pvalue) * (1 - z2$pvalue)
- }
- METHOD <- c("Anderson-Darling test of goodness-of-fit",
- if(estimated) "(with Braun's adjustment)" else NULL,
- paste("Null hypothesis:", nullname))
-
- extras <- list(...)
- parnames <- intersect(names(extras), names(formals(F0)))
- if(length(parnames) > 0) {
- pars <- extras[parnames]
- pard <- character(length(parnames))
- for(i in seq_along(parnames))
- pard[i] <- paste(parnames[i], "=", paste(pars[[i]], collapse=" "))
- pard <- paste("with",
- ngettext(length(pard), "parameter", "parameters"),
- " ",
- paste(pard, collapse=", "))
- METHOD <- c(METHOD, pard)
- }
-
- coda <- paste("Parameters assumed to",
- if(estimated) "have been estimated from data" else "be fixed")
- METHOD <- c(METHOD, coda)
-
- out <- list(statistic = STATISTIC,
- p.value = PVAL,
- method = METHOD,
- data.name = xname)
- class(out) <- "htest"
- return(out)
-}
-
-do.goftest.AD <- function(U) {
- ## Internal: call Marsaglia C code
- U <- sort(U)
- n <- length(U)
- z <- .C(CgofADtestR,
- x = as.double(U),
- n = as.integer(n),
- adstat = as.double(numeric(1)),
- pvalue = as.double(numeric(1)),
- PACKAGE="goftest"
- )
- return(z[c("adstat", "pvalue")])
-}
-
-pAD <- function(q, n=Inf, lower.tail=TRUE, fast=TRUE) {
- q <- as.numeric(q)
- p <- rep(NA_real_, length(q))
- if(any(ones <- is.infinite(q) & (q == Inf)))
- p[ones] <- 1
- if(any(zeroes <- (is.finite(q) & q <= 0) | (is.infinite(q) & (q == -Inf))))
- p[zeroes] <- 0
- ok <- is.finite(q) & (q > 0)
- nok <- sum(ok)
- if(nok > 0) {
- if(is.finite(n)) {
- z <- .C(CgofADprobN,
- a = as.double(q[ok]),
- na = as.integer(nok),
- nsample = as.integer(n),
- prob = as.double(numeric(nok)),
- PACKAGE="goftest")
- p[ok] <- z$prob
- } else if(fast) {
- ## fast version adinf()
- z <- .C(CgofADprobApproxInf,
- a = as.double(q[ok]),
- na = as.integer(nok),
- prob = as.double(numeric(nok)),
- PACKAGE="goftest")
- p[ok] <- z$prob
- } else {
- ## slow, accurate version ADinf()
- z <- .C(CgofADprobExactInf,
- a = as.double(q[ok]),
- na = as.integer(nok),
- prob = as.double(numeric(nok)),
- PACKAGE="goftest")
- p[ok] <- z$prob
- }
-
- }
- if(!lower.tail)
- p <- 1 - p
- return(p)
-}
-
-qAD <- local({
-
- f <- function(x, N, P, Fast) {
- pAD(x, N, fast=Fast) - P
- }
-
- qAD <- function(p, n=Inf, lower.tail=TRUE, fast=TRUE) {
- ## quantiles of null distribution of Anderson-Darling test statistic
- stopifnot(all(p >= 0))
- stopifnot(all(p <= 1))
- if(!lower.tail) p <- 1-p
- ans <- rep(NA_real_, length(p))
- for(i in which(p >= 0 & p < 1))
- ans[i] <- uniroot(f, c(0, 1), N=n, P=p[i], Fast=fast, extendInt="up")$root
- return(ans)
- }
-
- qAD
-})
-
-
-
-
-@
-
-
-1.9
-log
-@Summary: d'oh
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.8 $ $Date: 2018/06/06 08:05:21 $
-d58 2
-a59 2
- coda <- paste("Parameters assumed to be",
- if(estimated) "estimated from data" else "fixed")
-@
-
-
-1.8
-log
-@Summary: handles composite case using Braun 1980
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.7 $ $Date: 2018/03/29 13:51:49 $
-d59 1
-a59 1
- if(!estimated) "estimated from data" else "fixed")
-@
-
-
-1.7
-log
-@Summary: removed unused variable
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.6 $ $Date: 2014/06/24 02:12:20 $
-d9 1
-a9 1
-ad.test <- function(x, null="punif", ..., nullname) {
-d21 1
-a21 3
- F0 <- if(is.function(null)) null else
- if(is.character(null)) get(null, mode="function") else
- stop("Argument 'null' should be a function, or the name of a function")
-d25 15
-a39 12
- U <- sort(U)
- ## call Marsaglia C code
- z <- .C(CgofADtestR,
- x = as.double(U),
- n = as.integer(n),
- adstat = as.double(numeric(1)),
- pvalue = as.double(numeric(1)),
- PACKAGE="goftest"
- )
- STATISTIC <- z$adstat
- names(STATISTIC) <- "An"
- PVAL <- z$pvalue
-d41 1
-d43 1
-d48 1
-a48 1
- pard <- character(0)
-d57 5
-d68 14
-@
-
-
-1.6
-log
-@polished output
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.5 $ $Date: 2014/06/24 01:54:16 $
-a27 1
- k <- seq_len(n)
-d29 1
-a29 1
- z <- .C("ADtestR",
-d33 2
-a34 1
- pvalue = as.double(numeric(1))
-d73 1
-a73 1
- z <- .C("ADprobN",
-d77 2
-a78 2
- prob = as.double(numeric(nok))
- )
-d82 1
-a82 1
- z <- .C("ADprobApproxInf",
-d85 2
-a86 2
- prob = as.double(numeric(nok))
- )
-d90 1
-a90 1
- z <- .C("ADprobExactInf",
-d93 2
-a94 2
- prob = as.double(numeric(nok))
- )
-@
-
-
-1.5
-log
-@recognises standard distributions
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.4 $ $Date: 2014/06/09 05:07:09 $
-d39 15
-a53 2
- METHOD <- paste("Anderson-Darling test of", nullname)
- ALTERN <- paste("Not the", nullname)
-a55 1
- alternative = ALTERN,
-@
-
-
-1.4
-log
-@tweak
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.3 $ $Date: 2014/06/09 05:02:30 $
-d13 3
-a15 2
- if(missing(nullname))
- nullname <- if(identical(null, "punif")) "uniform distribution" else
-d17 1
-d50 1
-a50 1
-pAD <- function(q, n=Inf, lower.tail=TRUE) {
-d68 8
-d77 2
-a78 1
- z <- .C("ADprobInf",
-d85 1
-d94 2
-a95 2
- f <- function(x, N, P) {
- pAD(x, N) - P
-d98 1
-a98 1
- qAD <- function(p, n=Inf, lower.tail=TRUE) {
-d105 1
-a105 1
- ans[i] <- uniroot(f, c(0, 1), N=n, P=p[i], extendInt="up")$root
-@
-
-
-1.3
-log
-@buglet fix
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.2 $ $Date: 2014/06/09 04:34:57 $
-d35 1
-d91 2
-a92 1
- for(i in which(p > 0 & p < 1))
-@
-
-
-1.2
-log
-@tweaked
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.1 $ $Date: 2014/06/09 04:26:35 $
-d52 1
-a52 1
- if(any(zeroes <- (is.finite(q) & q < 0) | (is.infinite(q) & (q == -Inf))))
-d54 1
-a54 1
- ok <- is.finite(q) & (q >= 0)
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d6 1
-a6 1
-## $Revision$ $Date$
-d47 1
-a47 1
-pAnDarl <- function(q, n=Inf, lower.tail=TRUE) {
-d78 23
-@
diff --git a/R/RCS/cramer.R,v b/R/RCS/cramer.R,v
deleted file mode 100755
index 75ac4a1..0000000
--- a/R/RCS/cramer.R,v
+++ /dev/null
@@ -1,398 +0,0 @@
-head 1.9;
-access;
-symbols;
-locks
- adrian:1.9; strict;
-comment @# @;
-
-
-1.9
-date 2019.11.27.01.50.20; author adrian; state Exp;
-branches;
-next 1.8;
-
-1.8
-date 2019.11.26.04.05.19; author adrian; state Exp;
-branches;
-next 1.7;
-
-1.7
-date 2019.11.26.03.59.06; author adrian; state Exp;
-branches;
-next 1.6;
-
-1.6
-date 2019.11.26.03.55.16; author adrian; state Exp;
-branches;
-next 1.5;
-
-1.5
-date 2019.11.26.03.49.24; author adrian; state Exp;
-branches;
-next 1.4;
-
-1.4
-date 2019.11.26.03.31.49; author adrian; state Exp;
-branches;
-next 1.3;
-
-1.3
-date 2019.11.26.03.29.57; author adrian; state Exp;
-branches;
-next 1.2;
-
-1.2
-date 2014.06.09.04.34.49; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.08.10.20.20; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.9
-log
-@Summary: changed epsilon
-@
-text
-@##
-## cramer.R
-##
-## Distribution of the Cramer-Von Mises test statistic
-##
-## $Revision: 1.8 $ $Date: 2019/11/26 04:05:19 $
-##
-## ..................................................................
-##
-## From Matlab code written by Julian Faraway (faraway@@umich.edu)
-## Translated to R by Adrian Baddeley
-##
-## Reference: S. Csorgo and J.J. Faraway,
-## The exact and asymptotic distributions of Cramer-von Mises statistics
-## Journal of the Royal Statistical Society, Series B
-## 58 (1996) 221-234.
-##
-
-pCvM <- local({
-
- ## all functions are vectorised
- D2 <- function(x) {
- z <- (x^2)/4
- b <- besselK(x=z, nu=1/4) + besselK(x=z, nu=3/4)
- b * sqrt((x^3)/(8*pi))
- }
-
- D3 <- function(x) {
- z <- (x^2)/4
- b <- 2*besselK(z, nu=1/4) + 3*besselK(z, nu=3/4) - besselK(z, nu=5/4)
- b * sqrt((x^5)/(32 * pi))
- }
-
- ED2 <- function(x) { exp(-(x^2)/4) * D2(x) }
-
- ED3 <- function(x) { exp(-(x^2)/4) * D3(x) }
-
- Ak <- function(k, x) {
- #' original code (transliterated from Matlab) for reference
- twosqrtx <- 2 * sqrt(x)
- x34 <- x^(3/4)
- x54 <- x^(5/4)
- (2*k+1)*gamma(k+1/2)*ED2((4*k+3)/twosqrtx)/(9*x34) +
- gamma(k+1/2)*ED3((4*k+1)/twosqrtx)/(72*x54) +
- 2*(2*k+3)*gamma(k+3/2)*ED3((4*k+5)/twosqrtx)/(12*x54) +
- 7*(2*k+1)*gamma(k+1/2)*ED2((4*k+1)/twosqrtx)/(144*x34) +
- 7*(2*k+1)*gamma(k+1/2)*ED2((4*k+5)/twosqrtx)/(144*x34)
- }
-
- AkOnFk <- function(k, x) {
- #' calculates A(k, x)/factorial(k)
- #' Adrian Baddeley, 26 nov 2019
- twosqrtx <- 2 * sqrt(x)
- fk1x <- (4*k+1)/twosqrtx
- fk3x <- (4*k+3)/twosqrtx
- fk5x <- (4*k+5)/twosqrtx
- x34 <- x^(3/4)
- x54 <- x^(5/4)
- #'evaluate gamma(k+1/2)/factorial(k) = gamma(k+1/2)/gamma(k+1)
- gf <- if(k < 100) {
- gamma(k+1/2)/factorial(k)
- } else if(k <= 1e15) {
- exp(lgamma(k+1/2)-lgamma(k+1))
- } else exp(-10*k)
- gf * (
- ED3(fk1x)/(72*x54) +
- (2*k+1) * (
- ED2(fk3x)/(9*x34) +
- (2*k+3)*ED3(fk5x)/(12*x54) +
- 7*(ED2(fk1x)+ED2(fk5x))/(144*x34)
- )
- )
- }
-
- psi1 <- function(x) {
- ## Leading term in expansion of small-sample cdf of Cramer-Von Mises
- m <- length(x)
- tot <- numeric(m)
- active <- rep(TRUE, m)
- for(k in 0:200) {
- ## WAS: z <- -Ak(k,x[active])/(pi*factorial(k))
- z <- -AkOnFk(k,x[active])/pi
- tot[active] <- tot[active] + z
- active[active] <- (abs(z) >= 1e-9)
- if((k > 20) && (ok <- !any(active))) break
- }
- if(!ok)
- warning("Series did not converge after 200 iterations (small sample cdf)",
- call.=FALSE)
- return(tot + Vinf(x)/12)
- }
-
- Vinf <- function(x) {
- ## cdf of asymptotic distribution of Cramer-von Mises
- m <- length(x)
- tot <- numeric(m)
- active <- rep(TRUE, m)
- for(k in 0:200) {
- q <- (4*k+1)^2/(16*x[active])
- z <- ((-1)^k)*choose(-1/2,k)*sqrt(4*k+1)*
- exp(-q)*besselK(q, nu=1/4)/sqrt(x[active])
- tot[active] <- tot[active] + z
- active[active] <- (abs(z) >= 1e-9)
- if((k > 10) && (ok <- !any(active))) break
- }
- if(!ok)
- warning("Series did not converge after 200 iterations (asymptotic cdf)",
- call.=FALSE)
- return(tot/pi)
- }
-
- Vn <- function(x, n) {
- ## cdf of small-sample distribution of Cramer-von Mises statistic
- ## First order approximation, Csorgo and Faraway equation (1.8)
- Vinf(x) + psi1(x)/n
- }
-
- pCvM <- function(q, n=Inf, lower.tail=TRUE) {
- ## cdf of null distribution of Cramer-von Mises test statistic
- nn <- min(100, n)
- lower <- 1/(12 * nn)
- upper <- nn/3
- m <- length(q)
- p <- numeric(m)
- unknown <- rep(TRUE, m)
- if(any(zeroes <- (q <= lower))) {
- p[zeroes] <- 0
- unknown[zeroes] <- FALSE
- }
- if(any(ones <- (q >= upper))) {
- p[ones] <- 1
- unknown[ones] <- FALSE
- }
- if(any(unknown))
- p[unknown] <- if(is.infinite(n)) Vinf(q[unknown]) else Vn(q[unknown], n)
- p[p < 2e-10] <- 0
- p[(1-p) < 2e-10] <- 1
- return(if(lower.tail) p else 1-p)
- }
-
- pCvM
-})
-
-qCvM <- local({
-
- f <- function(x, N, P) {
- pCvM(x, N) - P
- }
-
- qCvM <- function(p, n=Inf, lower.tail=TRUE) {
- ## quantiles of null distribution of Cramer-von Mises test statistic
- stopifnot(all(p >= 0))
- stopifnot(all(p <= 1))
- if(!lower.tail) p <- 1-p
- lower <- if(is.finite(n)) (1/(12 * n)) else 0
- upper <- if(is.finite(n)) n/3 else Inf
- ans <- numeric(length(p))
- small <- (p <= 2e-10)
- large <- (1-p <= 2e-10)
- ans[small] <- lower
- ans[large] <- upper
- for(i in which(!small & !large))
- ans[i] <- uniroot(f, c(lower, 1), N=n, P=p[i], extendInt="up")$root
- return(ans)
- }
-
- qCvM
-})
-
-
-
-
-@
-
-
-1.8
-log
-@Summary: more tweaks
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.7 $ $Date: 2019/11/26 03:59:06 $
-d136 2
-a137 2
- p[p < 2e-11] <- 0
- p[(1-p) < 2e-11] <- 1
-d158 2
-a159 2
- small <- (p <= 2e-11)
- large <- (1-p <= 2e-11)
-@
-
-
-1.7
-log
-@Summary: more tweaks
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.6 $ $Date: 2019/11/26 03:55:16 $
-d85 1
-a85 1
- if(ok <- !any(active)) break
-d104 1
-a104 1
- if(ok <- !any(active)) break
-@
-
-
-1.6
-log
-@Summary: more numerical stabilisation
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.5 $ $Date: 2019/11/26 03:49:24 $
-d158 5
-a162 3
- ans[p == 0] <- lower
- ans[p == 1] <- upper
- for(i in which(p > 0 & p < 1))
-@
-
-
-1.5
-log
-@Summary: more tweaks
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.4 $ $Date: 2019/11/26 03:31:49 $
-d136 2
-@
-
-
-1.4
-log
-@Summary: d'oh
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.3 $ $Date: 2019/11/26 03:29:57 $
-d84 1
-a84 1
- active[active] <- (abs(z) >= 1e-7)
-d103 1
-a103 1
- active[active] <- (abs(z) >= 1e-7)
-d120 3
-a122 7
- if(is.finite(n)) {
- lower <- 1/(12 * n)
- upper <- n/3
- } else {
- lower <- 0
- upper <- Inf
- }
-@
-
-
-1.3
-log
-@Summary: bug fixes
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.2 $ $Date: 2014/06/09 04:34:49 $
-d71 1
-@
-
-
-1.2
-log
-@renamed
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.1 $ $Date: 2014/06/08 10:20:20 $
-d39 1
-d50 24
-d79 3
-a81 2
- for(k in 0:20) {
- z <- -Ak(k,x[active])/(pi*factorial(k))
-d84 1
-a84 1
- if(!any(active)) break
-d86 3
-d97 1
-a97 1
- for(k in 0:10) {
-d103 1
-a103 1
- if(!any(active)) break
-d105 3
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d6 1
-a6 1
-## $Revision$ $Date$
-d19 1
-a19 1
-pcramer <- local({
-d85 1
-a85 1
- pcramer <- function(q, n=Inf, lower.tail=TRUE) {
-d110 1
-a110 1
- pcramer
-d113 1
-a113 1
-qcramer <- local({
-d116 1
-a116 1
- pcramer(x, N) - P
-d119 1
-a119 1
- qcramer <- function(p, n=Inf, lower.tail=TRUE) {
-d134 1
-a134 1
- qcramer
-@
diff --git a/R/RCS/cvmtest.R,v b/R/RCS/cvmtest.R,v
deleted file mode 100755
index 7a186df..0000000
--- a/R/RCS/cvmtest.R,v
+++ /dev/null
@@ -1,249 +0,0 @@
-head 1.7;
-access;
-symbols;
-locks
- adrian:1.7; strict;
-comment @# @;
-
-
-1.7
-date 2018.06.06.08.25.46; author adrian; state Exp;
-branches;
-next 1.6;
-
-1.6
-date 2018.06.06.08.09.39; author adrian; state Exp;
-branches;
-next 1.5;
-
-1.5
-date 2018.06.06.08.05.35; author adrian; state Exp;
-branches;
-next 1.4;
-
-1.4
-date 2014.06.24.02.13.27; author adrian; state Exp;
-branches;
-next 1.3;
-
-1.3
-date 2014.06.24.01.54.26; author adrian; state Exp;
-branches;
-next 1.2;
-
-1.2
-date 2014.06.08.11.32.51; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.08.11.05.58; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.7
-log
-@Summary: tweak
-@
-text
-@##
-## cvmtest.R
-##
-## Cramer-von Mises test
-##
-## $Revision: 1.6 $ $Date: 2018/06/06 08:09:39 $
-##
-
-cvm.test <- function(x, null="punif", ..., estimated=FALSE, nullname) {
- xname <- deparse(substitute(x))
- nulltext <- deparse(substitute(null))
- if(is.character(null)) nulltext <- null
- if(missing(nullname) || is.null(nullname)) {
- reco <- recogniseCdf(nulltext)
- nullname <- if(!is.null(reco)) reco else
- paste("distribution", sQuote(nulltext))
- }
- stopifnot(is.numeric(x))
- x <- as.vector(x)
- n <- length(x)
- F0 <- getCdf(null)
- U <- F0(x, ...)
- if(any(U < 0 | U > 1))
- stop("null distribution function returned values outside [0,1]")
- if(!estimated || n <= 4) {
- #' simple null hypothesis
- z <- do.goftest.CvM(U)
- PVAL <- z$pvalue
- STATISTIC <- z$omega2
- names(STATISTIC) <- "omega2"
- } else {
- #' composite - use Braun (1980)
- first <- sample(n, ceiling(n/2), replace=TRUE)
- z1 <- do.goftest.CvM(U[first])
- z2 <- do.goftest.CvM(U[-first])
- PVAL <- 1 - (1 - z1$pvalue) * (1 - z2$pvalue)
- STATISTIC <- max(z1$omega2, z2$omega2)
- names(STATISTIC) <- "omega2max"
- }
- METHOD <- c("Cramer-von Mises test of goodness-of-fit",
- if(estimated) "(with Braun's adjustment)" else NULL,
- paste("Null hypothesis:", nullname))
-
- extras <- list(...)
- parnames <- intersect(names(extras), names(formals(F0)))
- if(length(parnames) > 0) {
- pars <- extras[parnames]
- pard <- character(0)
- for(i in seq_along(parnames))
- pard[i] <- paste(parnames[i], "=", paste(pars[[i]], collapse=" "))
- pard <- paste("with",
- ngettext(length(pard), "parameter", "parameters"),
- " ",
- paste(pard, collapse=", "))
- METHOD <- c(METHOD, pard)
- }
-
- coda <- paste("Parameters assumed to",
- if(estimated) "have been estimated from data" else "be fixed")
- METHOD <- c(METHOD, coda)
-
- out <- list(statistic = STATISTIC,
- p.value = PVAL,
- method = METHOD,
- data.name = xname)
- class(out) <- "htest"
- return(out)
-}
-
-#' not exported
-
-do.goftest.CvM <- function(U) {
- U <- sort(U)
- n <- length(U)
- k <- seq_len(n)
- omega2 <- 1/(12 * n) + sum((U - (2*k - 1)/(2*n))^2)
- pvalue <- pCvM(omega2, n=n, lower.tail=FALSE)
- return(list(omega2=omega2, pvalue=pvalue))
-}
-@
-
-
-1.6
-log
-@Summary: d'oh
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.5 $ $Date: 2018/06/06 08:05:35 $
-d58 2
-a59 2
- coda <- paste("Parameters assumed to be",
- if(estimated) "estimated from data" else "fixed")
-@
-
-
-1.5
-log
-@Summary: handles composite case using Braun 1980
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.4 $ $Date: 2014/06/24 02:13:27 $
-d59 1
-a59 1
- if(!estimated) "estimated from data" else "fixed")
-d62 1
-a62 1
- out <- list(statistic = omega2,
-@
-
-
-1.4
-log
-@polished output
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.3 $ $Date: 2014/06/24 01:54:26 $
-d9 1
-a9 1
-cvm.test <- function(x, null="punif", ..., nullname) {
-d21 1
-a21 3
- F0 <- if(is.function(null)) null else
- if(is.character(null)) get(null, mode="function") else
- stop("Argument 'null' should be a function, or the name of a function")
-d25 15
-a39 5
- U <- sort(U)
- k <- seq_len(n)
- omega2 <- 1/(12 * n) + sum((U - (2*k - 1)/(2*n))^2)
- PVAL <- pCvM(omega2, n=n, lower.tail=FALSE)
- names(omega2) <- "omega2"
-d41 1
-d43 1
-d57 5
-d70 10
-@
-
-
-1.3
-log
-@recognises standard distributions
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.2 $ $Date: 2014/06/08 11:32:51 $
-d33 14
-a46 1
- paste("to", nullname))
-@
-
-
-1.2
-log
-@minor
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.1 $ $Date: 2014/06/08 11:05:58 $
-d13 3
-a15 2
- if(missing(nullname))
- nullname <- if(identical(null, "punif")) "uniform distribution" else
-d17 1
-d30 1
-a30 1
- PVAL <- pcvm(omega2, n=n, lower.tail=FALSE)
-d32 2
-a33 2
- METHOD <- paste("Cramer-von Mises test of", nullname)
- ALTERN <- paste("Not the", nullname)
-a35 1
- alternative = ALTERN,
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d6 1
-a6 1
-## $Revision$ $Date$
-d10 2
-a11 2
- xname <- short.deparse(substitute(x))
- nulltext <- short.deparse(substitute(null))
-@
diff --git a/R/RCS/recog.R,v b/R/RCS/recog.R,v
deleted file mode 100755
index dce9ea5..0000000
--- a/R/RCS/recog.R,v
+++ /dev/null
@@ -1,124 +0,0 @@
-head 1.4;
-access;
-symbols;
-locks
- adrian:1.4; strict;
-comment @# @;
-
-
-1.4
-date 2014.06.24.02.13.35; author adrian; state Exp;
-branches;
-next 1.3;
-
-1.3
-date 2014.06.24.01.55.53; author adrian; state Exp;
-branches;
-next 1.2;
-
-1.2
-date 2014.06.24.01.49.05; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.24.01.48.14; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.4
-log
-@neatened
-@
-text
-@## recog.R
-##
-## $Revision: 1.3 $ $Date: 2014/06/24 01:55:53 $
-##
-
-recogniseCdf <- function(s="punif") {
- if(!is.character(s) || length(s) != 1) return(NULL)
- if(nchar(s) <= 1 || substr(s,1,1) != "p") return(NULL)
- root <- substr(s, 2, nchar(s))
- a <- switch(root,
- beta = "beta",
- binom = "binomial",
- birthday = "birthday coincidence",
- cauchy = "Cauchy",
- chisq = "chi-squared",
- exp = "exponential",
- f = "F",
- gamma = "Gamma",
- geom = "geometric",
- hyper = "hypergeometric",
- lnorm = "log-normal",
- logis = "logistic",
- nbinom = "negative binomial",
- norm = "Normal",
- pois = "Poisson",
- t = "Student's t",
- tukey = "Tukey (Studentized range)",
- unif = "uniform",
- weibull = "Weibull",
- NULL)
- if(!is.null(a))
- return(paste(a, "distribution"))
- b <- switch(root,
- AD = "Anderson-Darling",
- CvM = "Cramer-von Mises",
- wilcox = "Wilcoxon Rank Sum",
- NULL)
- if(!is.null(b))
- return(paste("null distribution of", b, "Test Statistic"))
- return(NULL)
-}
-
-
-@
-
-
-1.3
-log
-@minor
-@
-text
-@d3 1
-a3 1
-## $Revision: 1.2 $ $Date: 2014/06/24 01:49:05 $
-d6 1
-a6 1
-recogniseCdf <- function(s) {
-@
-
-
-1.2
-log
-@bug fix
-@
-text
-@d3 1
-a3 1
-## $Revision: 1.1 $ $Date: 2014/06/24 01:48:14 $
-d35 1
-a35 1
- CvM = "Cramer-von Mises"
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d3 1
-a3 1
-## $Revision$ $Date$
-d8 1
-a8 1
- if(substr(s,1,1) != "p" || nchar(s) > 1) return(NULL)
-@
diff --git a/R/oldRCS/andarl.R,v b/R/oldRCS/andarl.R,v
deleted file mode 100755
index 4cb4dae..0000000
--- a/R/oldRCS/andarl.R,v
+++ /dev/null
@@ -1,273 +0,0 @@
-head 1.6;
-access;
-symbols;
-locks
- adrian:1.6; strict;
-comment @# @;
-
-
-1.6
-date 2014.06.24.02.12.20; author adrian; state Exp;
-branches;
-next 1.5;
-
-1.5
-date 2014.06.24.01.54.16; author adrian; state Exp;
-branches;
-next 1.4;
-
-1.4
-date 2014.06.09.05.07.09; author adrian; state Exp;
-branches;
-next 1.3;
-
-1.3
-date 2014.06.09.05.02.30; author adrian; state Exp;
-branches;
-next 1.2;
-
-1.2
-date 2014.06.09.04.34.57; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.09.04.26.35; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.6
-log
-@polished output
-@
-text
-@##
-## andarl.R
-##
-## Anderson-Darling test and null distribution
-##
-## $Revision: 1.5 $ $Date: 2014/06/24 01:54:16 $
-##
-
-ad.test <- function(x, null="punif", ..., nullname) {
- xname <- deparse(substitute(x))
- nulltext <- deparse(substitute(null))
- if(is.character(null)) nulltext <- null
- if(missing(nullname) || is.null(nullname)) {
- reco <- recogniseCdf(nulltext)
- nullname <- if(!is.null(reco)) reco else
- paste("distribution", sQuote(nulltext))
- }
- stopifnot(is.numeric(x))
- x <- as.vector(x)
- n <- length(x)
- F0 <- if(is.function(null)) null else
- if(is.character(null)) get(null, mode="function") else
- stop("Argument 'null' should be a function, or the name of a function")
- U <- F0(x, ...)
- if(any(U < 0 | U > 1))
- stop("null distribution function returned values outside [0,1]")
- U <- sort(U)
- k <- seq_len(n)
- ## call Marsaglia C code
- z <- .C("ADtestR",
- x = as.double(U),
- n = as.integer(n),
- adstat = as.double(numeric(1)),
- pvalue = as.double(numeric(1))
- )
- STATISTIC <- z$adstat
- names(STATISTIC) <- "An"
- PVAL <- z$pvalue
- METHOD <- c("Anderson-Darling test of goodness-of-fit",
- paste("Null hypothesis:", nullname))
- extras <- list(...)
- parnames <- intersect(names(extras), names(formals(F0)))
- if(length(parnames) > 0) {
- pars <- extras[parnames]
- pard <- character(0)
- for(i in seq_along(parnames))
- pard[i] <- paste(parnames[i], "=", paste(pars[[i]], collapse=" "))
- pard <- paste("with",
- ngettext(length(pard), "parameter", "parameters"),
- " ",
- paste(pard, collapse=", "))
- METHOD <- c(METHOD, pard)
- }
- out <- list(statistic = STATISTIC,
- p.value = PVAL,
- method = METHOD,
- data.name = xname)
- class(out) <- "htest"
- return(out)
-}
-
-pAD <- function(q, n=Inf, lower.tail=TRUE, fast=TRUE) {
- q <- as.numeric(q)
- p <- rep(NA_real_, length(q))
- if(any(ones <- is.infinite(q) & (q == Inf)))
- p[ones] <- 1
- if(any(zeroes <- (is.finite(q) & q <= 0) | (is.infinite(q) & (q == -Inf))))
- p[zeroes] <- 0
- ok <- is.finite(q) & (q > 0)
- nok <- sum(ok)
- if(nok > 0) {
- if(is.finite(n)) {
- z <- .C("ADprobN",
- a = as.double(q[ok]),
- na = as.integer(nok),
- nsample = as.integer(n),
- prob = as.double(numeric(nok))
- )
- p[ok] <- z$prob
- } else if(fast) {
- ## fast version adinf()
- z <- .C("ADprobApproxInf",
- a = as.double(q[ok]),
- na = as.integer(nok),
- prob = as.double(numeric(nok))
- )
- p[ok] <- z$prob
- } else {
- ## slow, accurate version ADinf()
- z <- .C("ADprobExactInf",
- a = as.double(q[ok]),
- na = as.integer(nok),
- prob = as.double(numeric(nok))
- )
- p[ok] <- z$prob
- }
-
- }
- if(!lower.tail)
- p <- 1 - p
- return(p)
-}
-
-qAD <- local({
-
- f <- function(x, N, P, Fast) {
- pAD(x, N, fast=Fast) - P
- }
-
- qAD <- function(p, n=Inf, lower.tail=TRUE, fast=TRUE) {
- ## quantiles of null distribution of Anderson-Darling test statistic
- stopifnot(all(p >= 0))
- stopifnot(all(p <= 1))
- if(!lower.tail) p <- 1-p
- ans <- rep(NA_real_, length(p))
- for(i in which(p >= 0 & p < 1))
- ans[i] <- uniroot(f, c(0, 1), N=n, P=p[i], Fast=fast, extendInt="up")$root
- return(ans)
- }
-
- qAD
-})
-
-
-
-
-@
-
-
-1.5
-log
-@recognises standard distributions
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.4 $ $Date: 2014/06/09 05:07:09 $
-d39 15
-a53 2
- METHOD <- paste("Anderson-Darling test of", nullname)
- ALTERN <- paste("Not the", nullname)
-a55 1
- alternative = ALTERN,
-@
-
-
-1.4
-log
-@tweak
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.3 $ $Date: 2014/06/09 05:02:30 $
-d13 3
-a15 2
- if(missing(nullname))
- nullname <- if(identical(null, "punif")) "uniform distribution" else
-d17 1
-d50 1
-a50 1
-pAD <- function(q, n=Inf, lower.tail=TRUE) {
-d68 8
-d77 2
-a78 1
- z <- .C("ADprobInf",
-d85 1
-d94 2
-a95 2
- f <- function(x, N, P) {
- pAD(x, N) - P
-d98 1
-a98 1
- qAD <- function(p, n=Inf, lower.tail=TRUE) {
-d105 1
-a105 1
- ans[i] <- uniroot(f, c(0, 1), N=n, P=p[i], extendInt="up")$root
-@
-
-
-1.3
-log
-@buglet fix
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.2 $ $Date: 2014/06/09 04:34:57 $
-d35 1
-d91 2
-a92 1
- for(i in which(p > 0 & p < 1))
-@
-
-
-1.2
-log
-@tweaked
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.1 $ $Date: 2014/06/09 04:26:35 $
-d52 1
-a52 1
- if(any(zeroes <- (is.finite(q) & q < 0) | (is.infinite(q) & (q == -Inf))))
-d54 1
-a54 1
- ok <- is.finite(q) & (q >= 0)
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d6 1
-a6 1
-## $Revision$ $Date$
-d47 1
-a47 1
-pAnDarl <- function(q, n=Inf, lower.tail=TRUE) {
-d78 23
-@
diff --git a/R/oldRCS/cramer.R,v b/R/oldRCS/cramer.R,v
deleted file mode 100755
index 3a0eb16..0000000
--- a/R/oldRCS/cramer.R,v
+++ /dev/null
@@ -1,200 +0,0 @@
-head 1.2;
-access;
-symbols;
-locks
- adrian:1.2; strict;
-comment @# @;
-
-
-1.2
-date 2014.06.09.04.34.49; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.08.10.20.20; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.2
-log
-@renamed
-@
-text
-@##
-## cramer.R
-##
-## Distribution of the Cramer-Von Mises test statistic
-##
-## $Revision: 1.1 $ $Date: 2014/06/08 10:20:20 $
-##
-## ..................................................................
-##
-## From Matlab code written by Julian Faraway (faraway@@umich.edu)
-## Translated to R by Adrian Baddeley
-##
-## Reference: S. Csorgo and J.J. Faraway,
-## The exact and asymptotic distributions of Cramer-von Mises statistics
-## Journal of the Royal Statistical Society, Series B
-## 58 (1996) 221-234.
-##
-
-pCvM <- local({
-
- ## all functions are vectorised
- D2 <- function(x) {
- z <- (x^2)/4
- b <- besselK(x=z, nu=1/4) + besselK(x=z, nu=3/4)
- b * sqrt((x^3)/(8*pi))
- }
-
- D3 <- function(x) {
- z <- (x^2)/4
- b <- 2*besselK(z, nu=1/4) + 3*besselK(z, nu=3/4) - besselK(z, nu=5/4)
- b * sqrt((x^5)/(32 * pi))
- }
-
- ED2 <- function(x) { exp(-(x^2)/4) * D2(x) }
-
- ED3 <- function(x) { exp(-(x^2)/4) * D3(x) }
-
- Ak <- function(k, x) {
- twosqrtx <- 2 * sqrt(x)
- x34 <- x^(3/4)
- x54 <- x^(5/4)
- (2*k+1)*gamma(k+1/2)*ED2((4*k+3)/twosqrtx)/(9*x34) +
- gamma(k+1/2)*ED3((4*k+1)/twosqrtx)/(72*x54) +
- 2*(2*k+3)*gamma(k+3/2)*ED3((4*k+5)/twosqrtx)/(12*x54) +
- 7*(2*k+1)*gamma(k+1/2)*ED2((4*k+1)/twosqrtx)/(144*x34) +
- 7*(2*k+1)*gamma(k+1/2)*ED2((4*k+5)/twosqrtx)/(144*x34)
- }
-
- psi1 <- function(x) {
- ## Leading term in expansion of small-sample cdf of Cramer-Von Mises
- m <- length(x)
- tot <- numeric(m)
- active <- rep(TRUE, m)
- for(k in 0:20) {
- z <- -Ak(k,x[active])/(pi*factorial(k))
- tot[active] <- tot[active] + z
- active[active] <- (abs(z) >= 1e-7)
- if(!any(active)) break
- }
- return(tot + Vinf(x)/12)
- }
-
- Vinf <- function(x) {
- ## cdf of asymptotic distribution of Cramer-von Mises
- m <- length(x)
- tot <- numeric(m)
- active <- rep(TRUE, m)
- for(k in 0:10) {
- q <- (4*k+1)^2/(16*x[active])
- z <- ((-1)^k)*choose(-1/2,k)*sqrt(4*k+1)*
- exp(-q)*besselK(q, nu=1/4)/sqrt(x[active])
- tot[active] <- tot[active] + z
- active[active] <- (abs(z) >= 1e-7)
- if(!any(active)) break
- }
- return(tot/pi)
- }
-
- Vn <- function(x, n) {
- ## cdf of small-sample distribution of Cramer-von Mises statistic
- ## First order approximation, Csorgo and Faraway equation (1.8)
- Vinf(x) + psi1(x)/n
- }
-
- pCvM <- function(q, n=Inf, lower.tail=TRUE) {
- ## cdf of null distribution of Cramer-von Mises test statistic
- if(is.finite(n)) {
- lower <- 1/(12 * n)
- upper <- n/3
- } else {
- lower <- 0
- upper <- Inf
- }
- m <- length(q)
- p <- numeric(m)
- unknown <- rep(TRUE, m)
- if(any(zeroes <- (q <= lower))) {
- p[zeroes] <- 0
- unknown[zeroes] <- FALSE
- }
- if(any(ones <- (q >= upper))) {
- p[ones] <- 1
- unknown[ones] <- FALSE
- }
- if(any(unknown))
- p[unknown] <- if(is.infinite(n)) Vinf(q[unknown]) else Vn(q[unknown], n)
- return(if(lower.tail) p else 1-p)
- }
-
- pCvM
-})
-
-qCvM <- local({
-
- f <- function(x, N, P) {
- pCvM(x, N) - P
- }
-
- qCvM <- function(p, n=Inf, lower.tail=TRUE) {
- ## quantiles of null distribution of Cramer-von Mises test statistic
- stopifnot(all(p >= 0))
- stopifnot(all(p <= 1))
- if(!lower.tail) p <- 1-p
- lower <- if(is.finite(n)) (1/(12 * n)) else 0
- upper <- if(is.finite(n)) n/3 else Inf
- ans <- numeric(length(p))
- ans[p == 0] <- lower
- ans[p == 1] <- upper
- for(i in which(p > 0 & p < 1))
- ans[i] <- uniroot(f, c(lower, 1), N=n, P=p[i], extendInt="up")$root
- return(ans)
- }
-
- qCvM
-})
-
-
-
-
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d6 1
-a6 1
-## $Revision$ $Date$
-d19 1
-a19 1
-pcramer <- local({
-d85 1
-a85 1
- pcramer <- function(q, n=Inf, lower.tail=TRUE) {
-d110 1
-a110 1
- pcramer
-d113 1
-a113 1
-qcramer <- local({
-d116 1
-a116 1
- pcramer(x, N) - P
-d119 1
-a119 1
- qcramer <- function(p, n=Inf, lower.tail=TRUE) {
-d134 1
-a134 1
- qcramer
-@
diff --git a/R/oldRCS/cvmtest.R,v b/R/oldRCS/cvmtest.R,v
deleted file mode 100755
index 7f73b37..0000000
--- a/R/oldRCS/cvmtest.R,v
+++ /dev/null
@@ -1,147 +0,0 @@
-head 1.4;
-access;
-symbols;
-locks
- adrian:1.4; strict;
-comment @# @;
-
-
-1.4
-date 2014.06.24.02.13.27; author adrian; state Exp;
-branches;
-next 1.3;
-
-1.3
-date 2014.06.24.01.54.26; author adrian; state Exp;
-branches;
-next 1.2;
-
-1.2
-date 2014.06.08.11.32.51; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.08.11.05.58; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.4
-log
-@polished output
-@
-text
-@##
-## cvmtest.R
-##
-## Cramer-von Mises test
-##
-## $Revision: 1.3 $ $Date: 2014/06/24 01:54:26 $
-##
-
-cvm.test <- function(x, null="punif", ..., nullname) {
- xname <- deparse(substitute(x))
- nulltext <- deparse(substitute(null))
- if(is.character(null)) nulltext <- null
- if(missing(nullname) || is.null(nullname)) {
- reco <- recogniseCdf(nulltext)
- nullname <- if(!is.null(reco)) reco else
- paste("distribution", sQuote(nulltext))
- }
- stopifnot(is.numeric(x))
- x <- as.vector(x)
- n <- length(x)
- F0 <- if(is.function(null)) null else
- if(is.character(null)) get(null, mode="function") else
- stop("Argument 'null' should be a function, or the name of a function")
- U <- F0(x, ...)
- if(any(U < 0 | U > 1))
- stop("null distribution function returned values outside [0,1]")
- U <- sort(U)
- k <- seq_len(n)
- omega2 <- 1/(12 * n) + sum((U - (2*k - 1)/(2*n))^2)
- PVAL <- pCvM(omega2, n=n, lower.tail=FALSE)
- names(omega2) <- "omega2"
- METHOD <- c("Cramer-von Mises test of goodness-of-fit",
- paste("Null hypothesis:", nullname))
- extras <- list(...)
- parnames <- intersect(names(extras), names(formals(F0)))
- if(length(parnames) > 0) {
- pars <- extras[parnames]
- pard <- character(0)
- for(i in seq_along(parnames))
- pard[i] <- paste(parnames[i], "=", paste(pars[[i]], collapse=" "))
- pard <- paste("with",
- ngettext(length(pard), "parameter", "parameters"),
- " ",
- paste(pard, collapse=", "))
- METHOD <- c(METHOD, pard)
- }
- out <- list(statistic = omega2,
- p.value = PVAL,
- method = METHOD,
- data.name = xname)
- class(out) <- "htest"
- return(out)
-}
-
-@
-
-
-1.3
-log
-@recognises standard distributions
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.2 $ $Date: 2014/06/08 11:32:51 $
-d33 14
-a46 1
- paste("to", nullname))
-@
-
-
-1.2
-log
-@minor
-@
-text
-@d6 1
-a6 1
-## $Revision: 1.1 $ $Date: 2014/06/08 11:05:58 $
-d13 3
-a15 2
- if(missing(nullname))
- nullname <- if(identical(null, "punif")) "uniform distribution" else
-d17 1
-d30 1
-a30 1
- PVAL <- pcvm(omega2, n=n, lower.tail=FALSE)
-d32 2
-a33 2
- METHOD <- paste("Cramer-von Mises test of", nullname)
- ALTERN <- paste("Not the", nullname)
-a35 1
- alternative = ALTERN,
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d6 1
-a6 1
-## $Revision$ $Date$
-d10 2
-a11 2
- xname <- short.deparse(substitute(x))
- nulltext <- short.deparse(substitute(null))
-@
diff --git a/R/oldRCS/recog.R,v b/R/oldRCS/recog.R,v
deleted file mode 100755
index dce9ea5..0000000
--- a/R/oldRCS/recog.R,v
+++ /dev/null
@@ -1,124 +0,0 @@
-head 1.4;
-access;
-symbols;
-locks
- adrian:1.4; strict;
-comment @# @;
-
-
-1.4
-date 2014.06.24.02.13.35; author adrian; state Exp;
-branches;
-next 1.3;
-
-1.3
-date 2014.06.24.01.55.53; author adrian; state Exp;
-branches;
-next 1.2;
-
-1.2
-date 2014.06.24.01.49.05; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.24.01.48.14; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.4
-log
-@neatened
-@
-text
-@## recog.R
-##
-## $Revision: 1.3 $ $Date: 2014/06/24 01:55:53 $
-##
-
-recogniseCdf <- function(s="punif") {
- if(!is.character(s) || length(s) != 1) return(NULL)
- if(nchar(s) <= 1 || substr(s,1,1) != "p") return(NULL)
- root <- substr(s, 2, nchar(s))
- a <- switch(root,
- beta = "beta",
- binom = "binomial",
- birthday = "birthday coincidence",
- cauchy = "Cauchy",
- chisq = "chi-squared",
- exp = "exponential",
- f = "F",
- gamma = "Gamma",
- geom = "geometric",
- hyper = "hypergeometric",
- lnorm = "log-normal",
- logis = "logistic",
- nbinom = "negative binomial",
- norm = "Normal",
- pois = "Poisson",
- t = "Student's t",
- tukey = "Tukey (Studentized range)",
- unif = "uniform",
- weibull = "Weibull",
- NULL)
- if(!is.null(a))
- return(paste(a, "distribution"))
- b <- switch(root,
- AD = "Anderson-Darling",
- CvM = "Cramer-von Mises",
- wilcox = "Wilcoxon Rank Sum",
- NULL)
- if(!is.null(b))
- return(paste("null distribution of", b, "Test Statistic"))
- return(NULL)
-}
-
-
-@
-
-
-1.3
-log
-@minor
-@
-text
-@d3 1
-a3 1
-## $Revision: 1.2 $ $Date: 2014/06/24 01:49:05 $
-d6 1
-a6 1
-recogniseCdf <- function(s) {
-@
-
-
-1.2
-log
-@bug fix
-@
-text
-@d3 1
-a3 1
-## $Revision: 1.1 $ $Date: 2014/06/24 01:48:14 $
-d35 1
-a35 1
- CvM = "Cramer-von Mises"
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d3 1
-a3 1
-## $Revision$ $Date$
-d8 1
-a8 1
- if(substr(s,1,1) != "p" || nchar(s) > 1) return(NULL)
-@
diff --git a/build/partial.rdb b/build/partial.rdb
deleted file mode 100644
index 34c1576..0000000
Binary files a/build/partial.rdb and /dev/null differ
diff --git a/debian/changelog b/debian/changelog
index 67785e2..1500194 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,12 @@
-r-cran-goftest (1.2-3-2) UNRELEASED; urgency=medium
+r-cran-goftest (1.2-3+git20191127.1.ef942bf-1) UNRELEASED; urgency=medium
+ [ Andreas Tille ]
* Disable reprotest
- -- Andreas Tille <tille@debian.org> Wed, 13 Oct 2021 06:55:46 +0200
+ [ Debian Janitor ]
+ * New upstream snapshot.
+
+ -- Andreas Tille <tille@debian.org> Fri, 20 Jan 2023 01:20:58 -0000
r-cran-goftest (1.2-3-1) unstable; urgency=medium
diff --git a/man/RCS/ad.test.Rd,v b/man/RCS/ad.test.Rd,v
deleted file mode 100755
index 2978182..0000000
--- a/man/RCS/ad.test.Rd,v
+++ /dev/null
@@ -1,201 +0,0 @@
-head 1.5;
-access;
-symbols;
-locks
- adrian:1.5; strict;
-comment @# @;
-
-
-1.5
-date 2018.06.06.08.15.34; author adrian; state Exp;
-branches;
-next 1.4;
-
-1.4
-date 2018.06.06.08.05.03; author adrian; state Exp;
-branches;
-next 1.3;
-
-1.3
-date 2018.03.29.13.57.43; author adrian; state Exp;
-branches;
-next 1.2;
-
-1.2
-date 2014.06.09.08.37.42; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.09.04.48.21; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.5
-log
-@Summary: minor
-@
-text
-@\name{ad.test}
-\alias{ad.test}
-\title{
- Anderson-Darling Test of Goodness-of-Fit
-}
-\description{
- Performs the Anderson-Darling test
- of goodness-of-fit to a specified continuous univariate
- probability distribution.
-}
-\usage{
-ad.test(x, null = "punif", ..., estimated=FALSE, nullname)
-}
-\arguments{
- \item{x}{
- Numeric vector of data values.
- }
- \item{null}{
- A function, or a character string giving the name of a function,
- to compute the cumulative distribution function for the
- null distribution.
- }
- \item{\dots}{
- Additional arguments for the cumulative distribution function.
- }
- \item{estimated}{
- Logical value indicating whether the parameters of the distribution
- were estimated using the data \code{x} (composite null hypothesis),
- or were fixed in advance (simple null hypothesis, the default).
- }
- \item{nullname}{
- Optional character string describing the null distribution.
- The default is \code{"uniform distribution"}.
- }
-}
-\details{
- This command performs the Anderson-Darling test
- of goodness-of-fit to the distribution specified by the argument
- \code{null}. It is assumed that the values in \code{x} are
- independent and identically distributed random values, with some
- cumulative distribution function \eqn{F}.
- The null hypothesis is that \eqn{F} is the function
- specified by the argument \code{null}, while the alternative
- hypothesis is that \eqn{F} is some other function.
-
- By default, the test assumes that all the parameters of the null
- distribution are known in advance (a \emph{simple} null hypothesis).
- This test does not account for the effect of estimating the parameters.
-
- If the parameters of the distribution were estimated (that is,
- if they were calculated from the same data \code{x}),
- then this should be indicated by setting the argument \code{estimated=TRUE}.
- The test will then use the adjustment method of Braun (1980)
- to allow for parameter estimation. Braun's method involves randomly
- dividing the data into two equally-sized subsets, so the \eqn{p}-value
- is not the same if the test is repeated.
-}
-\value{
- An object of class \code{"htest"} representing the result of
- the hypothesis test.
-}
-\references{
- Anderson, T.W. and Darling, D.A. (1952)
- Asymptotic theory of certain 'goodness-of-fit' criteria based
- on stochastic processes.
- \emph{Annals of Mathematical Statistics} \bold{23}, 193--212.
-
- Anderson, T.W. and Darling, D.A. (1954)
- A test of goodness of fit.
- \emph{Journal of the American Statistical Association} \bold{49}, 765--769.
-
- Braun, H. (1980)
- A simple method for testing goodness-of-fit in the presence of
- nuisance parameters.
- \emph{Journal of the Royal Statistical Society} \bold{42}, 53--63.
-
- Marsaglia, G. and Marsaglia, J. (2004)
- Evaluating the Anderson-Darling Distribution.
- \emph{Journal of Statistical Software} \bold{9} (2), 1--5.
- February 2004.
- \url{http://www.jstatsoft.org/v09/i02}
-}
-\author{
- Original C code by George Marsaglia and John Marsaglia.
- \R interface by Adrian Baddeley.
-}
-\seealso{
- \code{\link{pAD}} for the null distribution of the test statistic.
-}
-\examples{
-x <- rnorm(10, mean=2, sd=1)
-ad.test(x, "pnorm", mean=2, sd=1)
-ad.test(x, "pnorm", mean=mean(x), sd=sd(x), estimated=TRUE)
-}
-\keyword{htest}
-@
-
-
-1.4
-log
-@Summary: new argument
-@
-text
-@d54 3
-a56 1
- to allow for parameter estimation.
-@
-
-
-1.3
-log
-@Summary: added message about simple null
-@
-text
-@d12 1
-a12 1
-ad.test(x, null = "punif", ..., nullname)
-d26 5
-d46 9
-a54 3
- This version of the test assumes that all the parameters of the null
- distribution are known (a \emph{simple} null hypothesis). It does not
- account for the effect of estimating the parameters.
-d70 5
-d91 1
-@
-
-
-1.2
-log
-@minor
-@
-text
-@d40 4
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d47 1
-a47 1
- Asymptotic theory of certain `goodness-of-fit’ criteria based
-d53 1
-a53 1
- \emph{Journal of the American Statistical Association} \bold{49}, 765-–769.
-d62 1
-a62 1
- C code by G. and J. Marsaglia.
-d69 2
-a70 2
-x <- runif(10)
-ad.test(x)
-a72 1
-
-@
diff --git a/man/RCS/cvm.test.Rd,v b/man/RCS/cvm.test.Rd,v
deleted file mode 100755
index 1dc4e31..0000000
--- a/man/RCS/cvm.test.Rd,v
+++ /dev/null
@@ -1,199 +0,0 @@
-head 1.6;
-access;
-symbols;
-locks
- adrian:1.6; strict;
-comment @# @;
-
-
-1.6
-date 2018.06.06.08.15.38; author adrian; state Exp;
-branches;
-next 1.5;
-
-1.5
-date 2018.06.06.08.04.55; author adrian; state Exp;
-branches;
-next 1.4;
-
-1.4
-date 2018.03.29.13.57.31; author adrian; state Exp;
-branches;
-next 1.3;
-
-1.3
-date 2014.06.09.08.37.47; author adrian; state Exp;
-branches;
-next 1.2;
-
-1.2
-date 2014.06.09.04.42.32; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.08.11.23.23; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.6
-log
-@Summary: minor
-@
-text
-@\name{cvm.test}
-\alias{cvm.test}
-\title{
- Cramer-Von Mises Test of Goodness-of-Fit
-}
-\description{
- Performs the
- \ifelse{latex}{\out{Cram\'er}}{Cramer}-von Mises test
- of goodness-of-fit to a specified continuous univariate
- probability distribution.
-}
-\usage{
-cvm.test(x, null = "punif", ..., estimated=FALSE, nullname)
-}
-\arguments{
- \item{x}{
- Numeric vector of data values.
- }
- \item{null}{
- A function, or a character string giving the name of a function,
- to compute the cumulative distribution function for the
- null distribution.
- }
- \item{\dots}{
- Additional arguments for the cumulative distribution function.
- }
- \item{estimated}{
- Logical value indicating whether the parameters of the distribution
- were estimated using the data \code{x} (composite null hypothesis),
- or were fixed in advance (simple null hypothesis, the default).
- }
- \item{nullname}{
- Optional character string describing the null distribution.
- The default is \code{"uniform distribution"}.
- }
-}
-\details{
- This command performs the
- \ifelse{latex}{\out{Cram\'er}}{Cramer}-von Mises test
- of goodness-of-fit to the distribution specified by the argument
- \code{null}. It is assumed that the values in \code{x} are
- independent and identically distributed random values, with some
- cumulative distribution function \eqn{F}.
- The null hypothesis is that \eqn{F} is the function
- specified by the argument \code{null}, while the alternative
- hypothesis is that \eqn{F} is some other function.
-
- By default, the test assumes that all the parameters of the null
- distribution are known in advance (a \emph{simple} null hypothesis).
- This test does not account for the effect of estimating the parameters.
-
- If the parameters of the distribution were estimated (that is,
- if they were calculated from the same data \code{x}),
- then this should be indicated by setting the argument \code{estimated=TRUE}.
- The test will then use the adjustment method of Braun (1980)
- to allow for parameter estimation. Braun's method involves randomly
- dividing the data into two equally-sized subsets, so the \eqn{p}-value
- is not the same if the test is repeated.
-}
-\value{
- An object of class \code{"htest"} representing the result of
- the hypothesis test.
-}
-\references{
- Braun, H. (1980)
- A simple method for testing goodness-of-fit in the presence of
- nuisance parameters.
- \emph{Journal of the Royal Statistical Society} \bold{42}, 53--63.
-
- \ifelse{latex}{\out{Cs\"org\H{o}}}{Csorgo}, S. and Faraway, J.J. (1996)
- The exact and asymptotic distributions of
- \ifelse{latex}{\out{Cram\'er}}{Cramer}-von Mises statistics.
- \emph{Journal of the Royal Statistical Society, Series B}
- \bold{58}, 221--234.
-}
-\author{
- Adrian Baddeley.
-}
-\seealso{
- \code{\link{pCvM}} for the null distribution of the test statistic.
-}
-\examples{
-x <- rnorm(10, mean=2, sd=1)
-cvm.test(x, "pnorm", mean=2, sd=1)
-cvm.test(x, "pnorm", mean=mean(x), sd=sd(x), estimated=TRUE)
-}
-\keyword{htest}
-
-@
-
-
-1.5
-log
-@Summary: new argument
-@
-text
-@d56 3
-a58 1
- to allow for parameter estimation.
-@
-
-
-1.4
-log
-@Summary: added message about simple null
-@
-text
-@d13 1
-a13 1
-cvm.test(x, null = "punif", ..., nullname)
-d27 5
-d48 9
-a56 3
- This version of the test assumes that all the parameters of the null
- distribution are known (a \emph{simple} null hypothesis). It does not
- account for the effect of estimating the parameters.
-d63 5
-d83 1
-@
-
-
-1.3
-log
-@minor
-@
-text
-@d42 4
-@
-
-
-1.2
-log
-@name change
-@
-text
-@d61 2
-a62 2
-x <- runif(10)
-cvm.test(x)
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d58 1
-a58 1
- \code{\link{pcramer}} for the null distribution of the test statistic.
-@
diff --git a/man/RCS/goftest-package.Rd,v b/man/RCS/goftest-package.Rd,v
deleted file mode 100755
index 4e69238..0000000
--- a/man/RCS/goftest-package.Rd,v
+++ /dev/null
@@ -1,205 +0,0 @@
-head 1.6;
-access;
-symbols;
-locks
- adrian:1.6; strict;
-comment @# @;
-
-
-1.6
-date 2018.06.06.08.23.51; author adrian; state Exp;
-branches;
-next 1.5;
-
-1.5
-date 2018.06.06.08.22.11; author adrian; state Exp;
-branches;
-next 1.4;
-
-1.4
-date 2018.03.29.13.57.19; author adrian; state Exp;
-branches;
-next 1.3;
-
-1.3
-date 2014.06.09.08.37.32; author adrian; state Exp;
-branches;
-next 1.2;
-
-1.2
-date 2014.06.09.05.19.07; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.09.05.11.00; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.6
-log
-@Summary: more stuff
-@
-text
-@\name{goftest-package}
-\alias{goftest-package}
-\alias{goftest}
-\docType{package}
-\title{
- Classical Goodness-of-Fit Tests
-}
-\description{
- \ifelse{latex}{\out{Cram\'er}}{Cramer}-von Mises
- and Anderson-Darling tests of goodness-of-fit
- for continuous univariate distributions, using modern
- algorithms to compute the null distributions.
-}
-\details{
- The \pkg{goftest} package contains implementations of the
- classical \ifelse{latex}{\out{Cram\'er}}{Cramer}-von Mises
- and Anderson-Darling tests of goodness-of-fit
- for continuous univariate distributions.
-
- The \ifelse{latex}{\out{Cram\'er}}{Cramer}-von Mises test
- is performed by \code{\link{cvm.test}}. The cumulative distribution
- function of the null distribution of the test statistic
- is computed by \code{\link{pCvM}}
- using the algorithm of \ifelse{latex}{\out{Cs\"org\H{o}}}{Csorgo}
- and Faraway (1996). The quantiles are computed by \code{\link{qCvM}}
- by root-finding.
-
- The Anderson-Darling test is performed by
- \code{\link{ad.test}}. The cumulative distribution
- function of the null distribution of the test statistic
- is computed by \code{\link{pAD}}
- using the algorithm of Marsaglia and Marsaglia (2004).
- The quantiles are computed by \code{\link{qAD}} by root-finding.
-
- By default, each test assumes that the parameters of the null
- distribution are known (a \emph{simple} null hypothesis).
- If the parameters were estimated (calculated from the data)
- then the user should set \code{estimated=TRUE} which uses
- the method of Braun (1980) to adjust for the effect of
- estimating the parameters from the data.
-}
-\author{
- Adrian Baddeley, Julian Faraway, John Marsaglia, George Marsaglia.
-
- Maintainer: Adrian Baddeley <adrian.baddeley@@uwa.edu.au>
-}
-\references{
- Braun, H. (1980)
- A simple method for testing goodness-of-fit in the presence of
- nuisance parameters.
- \emph{Journal of the Royal Statistical Society} \bold{42}, 53--63.
-
- \ifelse{latex}{\out{Cs\"org\H{o}}}{Csorgo}, S. and Faraway, J.J. (1996)
- The exact and asymptotic distributions of
- \ifelse{latex}{\out{Cram\'er}}{Cramer}-von Mises statistics.
- \emph{Journal of the Royal Statistical Society, Series B}
- \bold{58}, 221--234.
-
- Marsaglia, G. and Marsaglia, J. (2004)
- Evaluating the Anderson-Darling Distribution.
- \emph{Journal of Statistical Software} \bold{9} (2), 1--5.
- February 2004.
- \url{http://www.jstatsoft.org/v09/i02}
-}
-\keyword{package}
-\keyword{htest}
-\seealso{
- \code{\link[stats]{ks.test}}
-}
-\examples{
- x <- rnorm(30, mean=2, sd=1)
- # default behaviour: parameters fixed: simple null hypothesis
- cvm.test(x, "pnorm", mean=2, sd=1)
- ad.test(x, "pnorm", mean=2, sd=1)
- # parameters estimated: composite null hypothesis
- mu <- mean(x)
- sigma <- sd(x)
- cvm.test(x, "pnorm", mean=mu, sd=sigma, estimated=TRUE)
- ad.test(x, "pnorm", mean=mu, sd=sigma, estimated=TRUE)
-}
-@
-
-
-1.5
-log
-@Summary: more stuff
-@
-text
-@d37 3
-a39 1
- However, a method is provided to adjust for the effect of
-d48 5
-@
-
-
-1.4
-log
-@Summary: added message about simple null
-@
-text
-@d35 4
-a38 3
- It is assumed that all the parameters of the null
- distribution are known (a \emph{simple} null hypothesis). The calculation does not
- account for the effect of estimating the parameters.
-d64 2
-a65 1
- x <- rnorm(10, mean=2, sd=1)
-d68 5
-@
-
-
-1.3
-log
-@minor
-@
-text
-@d34 4
-@
-
-
-1.2
-log
-@prettified.
-@
-text
-@d22 2
-a23 1
- function of the null distribution is computed by \code{\link{pCvM}}
-d30 2
-a31 1
- function of the null distribution is computed by \code{\link{pAD}}
-d59 3
-a61 2
- x <- rnorm(10)
- cvm.test(x, "pnorm")
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d15 17
-a31 7
- \tabular{ll}{
- Package: \tab goftest\cr
- Type: \tab Package\cr
- Version: \tab 1.0-0\cr
- Date: \tab 2014-06-08\cr
- License: \tab GPL\cr
- }
-d34 1
-a34 1
- Adrian Baddeley, Julian Faraway, John Marsaglia, George Marsaglia
-@
diff --git a/man/RCS/pAD.Rd,v b/man/RCS/pAD.Rd,v
deleted file mode 100755
index c918db4..0000000
--- a/man/RCS/pAD.Rd,v
+++ /dev/null
@@ -1,149 +0,0 @@
-head 1.3;
-access;
-symbols;
-locks
- adrian:1.3; strict;
-comment @# @;
-
-
-1.3
-date 2014.06.09.08.37.37; author adrian; state Exp;
-branches;
-next 1.2;
-
-1.2
-date 2014.06.09.05.02.24; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.09.04.40.36; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.3
-log
-@minor
-@
-text
-@\name{pAD}
-\alias{pAD}
-\alias{qAD}
-\title{
- Null Distribution of Anderson-Darling Test Statistic
-}
-\description{
- \code{pAD} computes the cumulative distribution function,
- and \code{qAD} computes the quantile function,
- of the null distribution of the Anderson-Darling test
- statistic.
-}
-\usage{
- pAD(q, n = Inf, lower.tail = TRUE, fast=TRUE)
- qAD(p, n = Inf, lower.tail = TRUE, fast=TRUE)
-}
-\arguments{
- \item{q}{
- Numeric vector of quantiles (values for which the
- cumulative probability is required).
- }
- \item{p}{
- Numeric vector of probabilities.
- }
- \item{n}{
- Integer. Sample size for the Anderson-Darling test.
- }
- \item{lower.tail}{
- Logical. If \code{TRUE} (the default),
- probabilities are \eqn{P(X \le q)}{P(X <= q)},
- and otherwise they are \eqn{P(X > q)}.
- }
- \item{fast}{
- Logical value indicating whether to use a fast algorithm
- or a slower, more accurate algorithm, in the case \code{n=Inf}.
- }
-}
-\details{
- \code{pAD} uses the algorithms and C code described
- in Marsaglia and Marsaglia (2004).
-
- \code{qAD} uses \code{\link[stats]{uniroot}} to find the
- quantiles.
-
- The argument \code{fast} applies only when \code{n=Inf}
- and determines whether the asymptotic distribution is approximated
- using the faster algorithm \code{adinf} (accurate to 4-5 places)
- or the slower algorithm \code{ADinf} (accurate to 11 places)
- described in Marsaglia and Marsaglia (2004).
-}
-\value{
- A numeric vector of the same length as \code{p} or \code{q}.
-}
-\references{
- Anderson, T.W. and Darling, D.A. (1952)
- Asymptotic theory of certain 'goodness-of-fit' criteria based
- on stochastic processes.
- \emph{Annals of Mathematical Statistics} \bold{23}, 193--212.
-
- Anderson, T.W. and Darling, D.A. (1954)
- A test of goodness of fit.
- \emph{Journal of the American Statistical Association} \bold{49}, 765--769.
-
- Marsaglia, G. and Marsaglia, J. (2004)
- Evaluating the Anderson-Darling Distribution.
- \emph{Journal of Statistical Software} \bold{9} (2), 1--5.
- February 2004.
- \url{http://www.jstatsoft.org/v09/i02}
-}
-\author{
- Original C code by G. and J. Marsaglia.
- \R interface by Adrian Baddeley.
-}
-\seealso{
- \code{\link{ad.test}}
-}
-\examples{
- pAD(1.1, n=5)
- pAD(1.1)
- pAD(1.1, fast=FALSE)
-
- qAD(0.5, n=5)
- qAD(0.5)
-}
-\keyword{distribution}
-\keyword{htest}
-@
-
-
-1.2
-log
-@minor
-@
-text
-@d14 2
-a15 2
- pAD(q, n = Inf, lower.tail = TRUE)
- qAD(p, n = Inf, lower.tail = TRUE)
-d33 4
-d44 6
-d78 1
-d80 3
-a82 1
- pAD(1.1, n=5)
-a83 1
- qAD(0.5, n=5)
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d45 9
-@
diff --git a/man/RCS/pCvM.Rd,v b/man/RCS/pCvM.Rd,v
deleted file mode 100755
index 55833ae..0000000
--- a/man/RCS/pCvM.Rd,v
+++ /dev/null
@@ -1,95 +0,0 @@
-head 1.1;
-access;
-symbols;
-locks
- adrian:1.1; strict;
-comment @# @;
-
-
-1.1
-date 2014.06.08.11.23.35; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@\name{pcramer}
-\alias{pcramer}
-\alias{qcramer}
-\title{
- Null Distribution of Cramer-von Mises Test Statistic
-}
-\description{
- \code{pcramer} computes the cumulative distribution function,
- and \code{qcramer} computes the quantile function,
- of the null distribution of the
- \ifelse{latex}{\out{Cram\'er}}{Cramer}-von Mises test
- statistic.
-}
-\usage{
- pcramer(q, n = Inf, lower.tail = TRUE)
- qcramer(p, n = Inf, lower.tail = TRUE)
-}
-\arguments{
- \item{q}{
- Numeric vector of quantiles (values for which the
- cumulative probability is required).
- }
- \item{p}{
- Numeric vector of probabilities.
- }
- \item{n}{
- Integer. Sample size for the
- \ifelse{latex}{\out{Cram\'er}}{Cramer}-von Mises test.
- }
- \item{lower.tail}{
- Logical. If \code{TRUE} (the default),
- probabilities are \eqn{P(X \le q)}{P(X <= q)},
- and otherwise they are \eqn{P(X > q)}.
- }
-}
-\details{
- For finite \code{n} the cumulative distribution function is
- approximated by the first order expansion
- \eqn{V(x) + \psi_1(x)/n}{V(x) + psi1(x)/n},
- equation (1.8) of
- \ifelse{latex}{\out{Cs\"org\"o}}{Csorgo} and Faraway (1996).
-
- \code{qcramer} uses \code{\link[stats]{uniroot}} to find the
- quantiles.
-}
-\value{
- A numeric vector of the same length as \code{p} or \code{q}.
-}
-\references{
- \ifelse{latex}{\out{Cs\"org\H{o}}}{Csorgo}, S. and Faraway, J.J. (1996)
- The exact and asymptotic distributions of
- \ifelse{latex}{\out{Cram\'er}}{Cramer}-von Mises statistics.
- \emph{Journal of the Royal Statistical Society, Series B}
- \bold{58}, 221--234.
-}
-\author{
- Original Matlab code by Julian Faraway,
- translated to \R by Adrian Baddeley.
-}
-\seealso{
- \code{\link{cvm.test}}
-}
-\examples{
- pcramer(1.1)
- pcramer(1.1, n=5)
- qcramer(0.5)
- qcramer(0.5, n=5)
-}
-\keyword{distribution}
-\keyword{htest}
-
-@
diff --git a/man/ad.test.Rd b/man/ad.test.Rd
index 66270f1..25d9149 100755
--- a/man/ad.test.Rd
+++ b/man/ad.test.Rd
@@ -82,7 +82,7 @@ ad.test(x, null = "punif", ..., estimated=FALSE, nullname)
Evaluating the Anderson-Darling Distribution.
\emph{Journal of Statistical Software} \bold{9} (2), 1--5.
February 2004.
- \doi{10.18637/jss.v009.i02}
+ \url{http://www.jstatsoft.org/v09/i02}
}
\author{
Original C code by George Marsaglia and John Marsaglia.
diff --git a/man/goftest-package.Rd b/man/goftest-package.Rd
index 25a9f28..c44d3b2 100755
--- a/man/goftest-package.Rd
+++ b/man/goftest-package.Rd
@@ -60,7 +60,7 @@
Evaluating the Anderson-Darling Distribution.
\emph{Journal of Statistical Software} \bold{9} (2), 1--5.
February 2004.
- \doi{10.18637/jss.v009.i02}
+ \url{http://www.jstatsoft.org/v09/i02}
}
\keyword{package}
\keyword{htest}
diff --git a/man/pAD.Rd b/man/pAD.Rd
index bfba5d6..7c7b215 100755
--- a/man/pAD.Rd
+++ b/man/pAD.Rd
@@ -65,7 +65,7 @@
Evaluating the Anderson-Darling Distribution.
\emph{Journal of Statistical Software} \bold{9} (2), 1--5.
February 2004.
- \doi{10.18637/jss.v009.i02}
+ \url{http://www.jstatsoft.org/v09/i02}
}
\author{
Original C code by G. and J. Marsaglia.
diff --git a/src/RCS/ADinf.c,v b/src/RCS/ADinf.c,v
deleted file mode 100755
index 0ff82cf..0000000
--- a/src/RCS/ADinf.c,v
+++ /dev/null
@@ -1,137 +0,0 @@
-head 1.1;
-access;
-symbols;
-locks
- adrian:1.1; strict;
-comment @ * @;
-
-
-1.1
-date 2014.06.09.10.18.10; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@/*
- ADinf.c
-
- $Revision: 1.1 $ $Date: 2014/06/09 07:53:21 $
-
- Original C code by G. and J. Marsaglia
-
- R interface by Adrian Baddeley
-
-*/
-
-#include <Rmath.h>
-
-double ADinf(double z);
-
-/*
- A procedure for evaluating the limiting distribution of the
- Anderson-Darling statistic
- A_n=-n-(1/n)[ln(x_1(1-x_n)+3ln(x_2(1-x_{n-1})+5ln(x_3(1-x_{n-2})+...
- +(2n-1)ln(x_n(1-x_1))]
- where x_1<x_2<...<x_n is an ordered set of purported uniform [0,1) variates.
- The function is ADinf(z)=lim_{n->infty} Pr[A_n<z]. About 15 digit accuracy.
- If you don't need that much accuracy, use the quick-and-easy adinf(z).
- ADinf uses a two-term recursion for coefficients in series
- for which initial values require the complementary normal integral,
- included as cPhi(z). Otherwise, use erfc() if your C compiler has one with
- adequate accuracy.
-*/
-
-double cPhi(double z); /* prototype; listing follows main */
-
-double ADf(double z,int j){
- /* called by ADinf(); see article. */
- double t,f,fnew,a,b,c,r;
- int i;
- t=(4*j+1)*(4*j+1)*1.23370055013617/z;
- if(t>150.) return 0.;
- a=2.22144146907918*exp(-t)/sqrt(t);
- b=3.93740248643060*2.*cPhi(sqrt(2*t));/* initialization requires cPhi */
- /*if you have erfc(), replace 2*cPhi(sqrt(2*t)) with erfc(sqrt(t))*/
- r=z*.125; f=a+b*r;
- for(i=1;i<200;i++) {
- c=((i-.5-t)*b+t*a)/i;
- a=b; b=c; r*=z/(8*i+8);
- if(fabs(r)<1e-40 || fabs(c)<1.e-40) return f;
- fnew=f+c*r;
- if(f==fnew) return f;
- f=fnew;
- }
- return f;
-}
-
-double ADinf(double z){
- int j;
- double ad,adnew,r;
- if(z<.01) return 0.; /* avoids exponent limits; ADinf(.01)=.528e-52 */
- r=1./z;
- ad=r*ADf(z,0);
- for(j=1;j<100;j++){
- r*=(.5-j)/j;
- adnew=ad+(4*j+1)*r*ADf(z,j);
- if(ad==adnew) {return ad;}
- ad=adnew;
- }
- return ad;
-}
-
-/*
- Complementary normal distribution function
- cPhi(x) = integral from x to infinity of phi(x)=exp(-.5*t^2)/sqrt(2*pi)
- 13-15 digit accuracy for abs(x)<16.
- Stores R(0),R(2),R(4),...,R(16), with cPhi(x)=R(x)*phi(x), phi normal density,
- then uses Taylor series for
- R(z+h)=R(z)+hR'(z)+(1/2)h^2R''(z)+...
- with -1<h<1, and R(z) one of R(0),R(2),R(4),...,R(16)
- stored as v[0],v[1],...v[8].
- Examples: cPhi(2.75) needs R(2.75) and 2.75=2+.75 so use h=.75 and R(2)=v[1],
- cPhi(3.3) needs R(3.3) and 3.3=4-.7, so use h=-.7 and R(4)=v[2].
-*/
-double cPhi(double x){
- long double v[]={
- 1.25331413731550025, .421369229288054473, .236652382913560671,
- .162377660896867462, .123131963257932296, .0990285964717319214,
- .0827662865013691773, .0710695805388521071, .0622586659950261958
- };
- double h,a,b,z,t,s,pwr;
- int i,j;
- j=(fabs(x)+1.)/2.;
- a=v[j]; z=2*j; h=fabs(x)-z;
- b=z*a-1; pwr=1; s=a+h*b;
- for(i=2;i<100;i+=2){/* begin i loop */
- a=(a+z*b)/i;
- b=(b+z*a)/(i+1);
- pwr=pwr*h*h;
- t=s;
- s=s+pwr*(a+h*b);
- if(s==t){
- s*=exp(-.5*x*x-.91893853320467274178);
- return ((x>0) ? s: 1-s);
- }
- } /* end i loop */
- /* If not converged, return last estimate */
- return ((x>0) ? s: 1-s);
-}
-
-/* R interface */
-
-void ADprobExactInf(double *a, int *na, double *prob) {
- int i, m;
- m = *na;
- for(i = 0; i < m; i++)
- prob[i] = ADinf(a[i]);
-}
-@
diff --git a/src/RCS/AnDarl.c,v b/src/RCS/AnDarl.c,v
deleted file mode 100755
index 7cbce6a..0000000
--- a/src/RCS/AnDarl.c,v
+++ /dev/null
@@ -1,212 +0,0 @@
-head 1.2;
-access;
-symbols;
-locks
- adrian:1.2; strict;
-comment @ * @;
-
-
-1.2
-date 2018.03.29.08.07.08; author adrian; state Exp;
-branches;
-next 1.1;
-
-1.1
-date 2014.06.09.07.53.21; author adrian; state Exp;
-branches;
-next ;
-
-
-desc
-@@
-
-
-1.2
-log
-@Summary: bug fix
-@
-text
-@/*
- AnDarl.c
-
- $Revision: 1.1 $ $Date: 2014/06/09 07:53:21 $
-
- Original C code by G. and J. Marsaglia
-
- R interface by Adrian Baddeley
-
-*/
-
-#include <Rmath.h>
-
-/*
- Anderson-Darling test for uniformity. Given an ordered set
- x_1<x_2<...<x_n
- of purported uniform [0,1) variates, compute
- a = -n-(1/n)*[ln(x_1*z_1)+3*ln(x_2*z_2+...+(2*n-1)*ln(x_n*z_n)]
- where
- z_1=1-x_n
- z_2=1-x_(n-1)
- ...
- z_n=1-x_1,
- then find
- v=adinf(a)
- and return
- p=v+errfix(v),
- which should be uniform in [0,1),
- that is, the p-value associated with the observed x_1<x_2<...<x_n.
-
-*/
-
- /* prototypes */
-double adinf(double z);
-double errfix(int n,double x);
-double AD(int n,double z);
-
-/* Short, practical version of full ADinf(z), z>0. */
-double adinf(double z) {
- if(z<2.) return (
- exp(-1.2337141/z)/sqrt(z)
- )*(
- 2.00012+(.247105-
- (.0649821-
- (.0347962-
- (.011672-.00168691*z)
- *z)*z)*z)*z);
- /* max |error| < .000002 for z<2, (p=.90816...) */
- return exp(
- -exp(1.0776-(2.30695-(.43424-(.082433-(.008056 -.0003146*z)
- *z)*z)*z)*z));
- /* max |error|<.0000008 for 4<z<infinity */
-}
-
-/*
- The procedure errfix(n,x) corrects the error caused
- by using the asymptotic approximation, x=adinf(z).
- Thus x+errfix(n,x) is uniform in [0,1) for practical purposes;
- accuracy may be off at the 5th, rarely at the 4th, digit.
-*/
-
-double errfix(int n, double x) {
- double c,t;
- if(x>.8) return (-130.2137+
- (745.2337-
- (1705.091-
- (1950.646-
- (1116.360-255.7844*x)*x)*x)*x)*x)/n;
- c=.01265+.1757/n;
- if(x<c){
- t=x/c;
- t=sqrt(t)*(1.-t)*(49*t-102);
- return t*(.0037/(n*n)+.00078/n+.00006)/n;
- }
- t=(x-c)/(.8-c);
- t=-.00022633+(6.54034-(14.6538-(14.458-(8.259-1.91864*t)*t)*t)*t)*t;
- return (t*(.04213+.01365/n)/n);
-}
-
-/*
- The function AD(n,z) returns Prob(A_n<z) where
- A_n = -n-(1/n)*[ln(x_1*z_1)+3*ln(x_2*z_2+...+(2*n-1)*ln(x_n*z_n)]
- where
- z_1=1-x_n, z_2=1-x_(n-1)...z_n=1-x_1,
- and
- x_1<x_2<...<x_n is an ordered set of iid uniform [0,1) variates.
-*/
-
-double AD(int n,double z){
- double c,v,x;
- x=adinf(z);
- /* now x=adinf(z). Next, get v=errfix(n,x) and return x+v; */
- if(x>.8) {
- v=(-130.2137+(745.2337-(1705.091-(1950.646-(1116.360-255.7844*x)
- *x)*x)*x)*x)/n;
- return x+v;
- }
- c=.01265+.1757/n;
- if(x<c){
- v=x/c;
- v=sqrt(v)*(1.-v)*(49*v-102);
- return(x+v*(.0037/(n*n)+.00078/n+.00006)/n);
- }
- v=(x-c)/(.8-c);
- v=-.00022633+(6.54034-(14.6538-(14.458-(8.259-1.91864*v)*v)*v)*v)*v;
- return (x+v*(.04213+.01365/n)/n);
-}
-
-/* You must give the ADtest(int n, double *x) routine a sorted array
- x[0]<=x[1]<=..<=x[n-1]
- that you are testing for uniformity.
- It will return the p-value associated
- with the Anderson-Darling test, using
- the above adinf() and errfix( , )
- Not well-suited for n<7,
- (accuracy could drop to 3 digits).
-*/
-
-double ADtest(int n, double *x)
-{ int i;
- double t,z=0;
- for(i=0;i<n;i++) {
- t=x[i]*(1.-x[n-1-i]);
- z=z-(i+i+1)*log(t);
- }
- return AD(n,-n+z/n);
-}
-
-double ADstat(int n, double *x)
-{ int i;
- double t,z=0;
- for(i=0;i<n;i++) {
- t=x[i]*(1.-x[n-1-i]);
- z=z-(i+i+1)*log(t);
- }
- return (-n+z/n);
-}
-
-/* R interface */
-
-void ADprobN(double *a, int *na, int *nsample, double *prob) {
- int i, m, N;
- m = *na;
- N = *nsample;
- for(i = 0; i < m; i++)
- prob[i] = AD(N, a[i]);
-}
-
-void ADprobApproxInf(double *a, int *na, double *prob) {
- int i, m;
- m = *na;
- for(i = 0; i < m; i++)
- prob[i] = adinf(a[i]);
-}
-
-void ADtestR(double *x, int *n, double *adstat, double *pvalue) {
- double a, p;
- int N;
- N = *n;
- a = ADstat(N, x);
- p = AD(N, a);
- *adstat = a;
- *pvalue = 1. - p;
-}
-
-
-@
-
-
-1.1
-log
-@Initial revision
-@
-text
-@d4 1
-a4 1
- $Revision$ $Date$
-d149 1
-a149 1
-void ADprobInf(double *a, int *na, double *prob) {
-d157 2
-a158 1
- double N, a, p;
-@
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/lib/debug/.build-id/da/b77340109f78f347faa7a1786c51364d41cf17.debug
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/lib/debug/.build-id/be/a3a6538160795e0bc6e34463779dcbd9c745af.debug
Control files of package r-cran-goftest: lines which differ (wdiff format)
Depends: r-base-core (>= 4.2.2-1), 4.2.0-1~jan+unchanged1), r-api-4.0, libc6 (>= 2.4)
Control files of package r-cran-goftest-dbgsym: lines which differ (wdiff format)
Build-Ids: bea3a6538160795e0bc6e34463779dcbd9c745af dab77340109f78f347faa7a1786c51364d41cf17