Commit 47e7c5f7 authored by Radford Neal's avatar Radford Neal

update tests with new ones, and .save to match new diagnostic output

parent b03b269c
R version 2.15.0 alpha (2012-03-02 r58556)
R version 2.15.0 alpha (2012-03-02 r58556) modified
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
......@@ -167,7 +167,8 @@ lxhalf 1.6615 6.4794
> ll <- function(ymax=15, xhalf=6)
+ -sum(stats::dpois(y, lambda=ymax/(1+x/xhalf), log=TRUE))
> fit <- mle(ll)
Warning in dpois(x, lambda, log) : NaNs produced
Warning in stats::dpois(y, lambda = ymax/(1 + x/xhalf), log = TRUE) :
NaNs produced
> ## note the recorded call contains ..1, a problem with S4 dispatch
> update(fit, fixed=list(xhalf=3))
......
......@@ -62,8 +62,14 @@ log(0) == -Inf
is.nan(log(-1))# TRUE and warning
rp <- c(1:2,Inf); rn <- rev(- rp)
r <- c(rn, 0, rp)
r <- c(rn, 0, rp, NA, NaN)
all(r^0 == 1)
ir <- suppressWarnings(as.integer(r))
all(ir^0 == 1)
all(ir^0L == 1)# not in R <= 2.15.0
all( 1^r == 1)# not in R 0.64
all(1L^r == 1)
all(1L^ir == 1)# not in R <= 2.15.0
all((rn ^ -3) == -((-rn) ^ -3))
#
all(c(1.1,2,Inf) ^ Inf == Inf)
......@@ -71,7 +77,6 @@ all(c(1.1,2,Inf) ^ -Inf == 0)
.9 ^ Inf == 0
.9 ^ -Inf == Inf
## Wasn't ok in 0.64:
all(1^c(-Inf,Inf) == 1)
all(is.nan(rn ^ .5))# in some C's : (-Inf) ^ .5 gives Inf, instead of NaN
......
R version 2.15.0 alpha (2012-03-02 r58556)
R version 2.15.0 Patched (2012-05-24 r59442) -- "Easter Beagle"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
......@@ -103,9 +103,20 @@ Warning message:
In log(-1) : NaNs produced
>
> rp <- c(1:2,Inf); rn <- rev(- rp)
> r <- c(rn, 0, rp)
> r <- c(rn, 0, rp, NA, NaN)
> all(r^0 == 1)
[1] TRUE
> ir <- suppressWarnings(as.integer(r))
> all(ir^0 == 1)
[1] TRUE
> all(ir^0L == 1)# not in R <= 2.15.0
[1] TRUE
> all( 1^r == 1)# not in R 0.64
[1] TRUE
> all(1L^r == 1)
[1] TRUE
> all(1L^ir == 1)# not in R <= 2.15.0
[1] TRUE
> all((rn ^ -3) == -((-rn) ^ -3))
[1] TRUE
> #
......@@ -118,8 +129,6 @@ In log(-1) : NaNs produced
> .9 ^ -Inf == Inf
[1] TRUE
> ## Wasn't ok in 0.64:
> all(1^c(-Inf,Inf) == 1)
[1] TRUE
> all(is.nan(rn ^ .5))# in some C's : (-Inf) ^ .5 gives Inf, instead of NaN
[1] TRUE
>
......@@ -206,7 +215,7 @@ In gamma(0:-47) : NaNs produced
+ all.equal(trigamma(x), psigamma(x,1), 2*Meps))# TRUE (+ NaN warnings)
Warning messages:
1: In digamma(x) : NaNs produced
2: In psigamma(x, deriv) : NaNs produced
2: In psigamma(x, 0) : NaNs produced
> ## very large x:
> x <- 1e30 ^ (1:10)
> a.relE <- function(appr, true) abs(1 - appr/true)
......@@ -315,5 +324,5 @@ Warning messages:
>
> ## Last Line:
> cat('Time elapsed: ', proc.time() - .proctime00,'\n')
Time elapsed: 0.37 0.004 0.376 0 0
Time elapsed: 0.333 0.003 0.336 0 0
>
......@@ -748,8 +748,13 @@ stopifnot(all.equal(pchisq(200, 4, ncp=.001, log.p=TRUE), -3.851e-42))
## logit() == qlogit() on the right extreme:
x <- c(10:80, 80 + 5*(1:24), 200 + 20*(1:25))
stopifnot(All.eq(x, qlogis(plogis(x, log.p=TRUE),
log.p=TRUE)))
log.p=TRUE)))
## qlogis() gave Inf much too early for R <= 2.12.1
## Part 2:
x <- c(x, seq(700, 800, by=10))
stopifnot(All.eq(x, qlogis(plogis(x, lower=FALSE, log.p=TRUE),
lower=FALSE, log.p=TRUE)))
# plogis() underflowed to -Inf too early for R <= 2.15.0
cat("Time elapsed: ", proc.time() - .ptime,"\n")
R version 2.15.0 alpha (2012-03-02 r58556)
R version 2.15.0 Patched (2012-05-24 r59442) -- "Easter Beagle"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
......@@ -248,8 +248,8 @@ n= 47 : ......................
+ pgamma(Inf,Inf,scale=Inf))))
[1] TRUE
Warning messages:
1: In pgamma(q, shape, scale, lower.tail, log.p) : NaNs produced
2: In pgamma(q, shape, scale, lower.tail, log.p) : NaNs produced
1: In pgamma(Inf, 1, scale = Inf) : NaNs produced
2: In pgamma(Inf, Inf, scale = Inf) : NaNs produced
> scLrg <- c(2,100, 1e300*c(.1, 1,10,100), 1e307, xMax, Inf)
> stopifnot(pgamma(Inf, 1, scale=xMax) == 1,
+ pgamma(xMax,1, scale=Inf) == 0,
......@@ -343,8 +343,8 @@ df = 100[1] TRUE
+ is.nan(qnorm(-.1)) # + warn
[1] TRUE
Warning messages:
1: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs produced
2: In qnorm(p, mean, sd, lower.tail, log.p) : NaNs produced
1: In qnorm(1.1) : NaNs produced
2: In qnorm(-0.1) : NaNs produced
>
> x <- c(-Inf, -1e100, 1:6, 1e200, Inf)
> rbind(d.s0 =dnorm(x,3,s=0), p.s0 = pnorm(x,3,s=0),
......@@ -1284,10 +1284,15 @@ Warning messages:
> ## logit() == qlogit() on the right extreme:
> x <- c(10:80, 80 + 5*(1:24), 200 + 20*(1:25))
> stopifnot(All.eq(x, qlogis(plogis(x, log.p=TRUE),
+ log.p=TRUE)))
+ log.p=TRUE)))
> ## qlogis() gave Inf much too early for R <= 2.12.1
> ## Part 2:
> x <- c(x, seq(700, 800, by=10))
> stopifnot(All.eq(x, qlogis(plogis(x, lower=FALSE, log.p=TRUE),
+ lower=FALSE, log.p=TRUE)))
> # plogis() underflowed to -Inf too early for R <= 2.15.0
>
>
> cat("Time elapsed: ", proc.time() - .ptime,"\n")
Time elapsed: 1.261 0.014 1.282 0 0
Time elapsed: 1.003 0.02 1.024 0 0
>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment