Closed jrdnmdhl closed 7 years ago
It looks like the tests for pgompertz are actually expecting that S(t) = 0 as t -> Inf. Should that be the case? My expectation is that providing an infinite value for t should return the value of the limit.
test_that("Gompertz with chance of living forever",{
shape <- -0.6; rate <- 1.8
x <- c(0.8, 0.9, 0.97, 0.99)
expect_equal(qgompertz(x, shape=shape, rate=rate), c(1.28150707286845, 2.4316450975351, Inf, Inf))
# qgeneric(pgompertz, p=x, shape=shape, rate=rate) # won't work - needs smoothness
expect_equal(pgompertz(Inf, shape=shape, rate=rate), 1)
})
For the Gompertz distribution, it is possible to have survival probabilities which reach a non-zero asymptote as q -> Inf. However, pgompertz incorrectly will return zero if you pass an infinite value for q.