tests/testthat/test_gof.R

##################################
## Test Goodness of fit test
###################################
set.seed(1)

u <- seq(1000-.05)/1000
x <- qAmax(u, c(100,30,-.1), 'gev')

fit <- FitAmax(x, 'gev', varcov = FALSE)
out <- GofTest(fit, nsim = 5)
expect_true(out$pvalue > .9)
expect_equal(signif(out$stat), 0.00575411)

fit <- FitAmax(u, 'gev', varcov = FALSE)
out <- GofTest(fit, nsim = 5)
expect_true(out$pvalue < .1)

## Just make sure that they don't create error
fit <- FitAmax(x, 'glo', method = 'mle', varcov = FALSE)
GofTest(fit, method = 'ad', nsim = 5)

fit <- FitAmax(x, 'pe3', method = 'lmom', varcov = FALSE)
GofTest(fit, method = 'shapiro', nsim = 5)

##################################
## Test Goodness of fit test
###################################

x <- qgpa(u, 1.1, .1)
f <- FitPot(x , u = 0)
out <- GofTest(f)
expect_equal(signif(out$stat), 0.0116379)
GofTest(f, method = 'ad', nsim = 5)
martindurocher/floodStat documentation built on May 31, 2019, 12:42 a.m.