Running ‘run_testthat.R’
  Running ‘test_advanced.R’
  Running ‘test_deprecated.R’
  Running ‘test_distributions_cont.R’
  Running ‘test_distributions_discr.R’
  Running ‘test_routines.R’
  Running ‘test_ud.R’
  Running ‘test_universal.R’ [9s/11s]
  Running ‘test_unuran.R’
Running the tests in ‘tests/test_universal.R’ failed.
Complete output:
  > #############################################################################
  > ##                                                                         ##
  > ##   Tests for methods                                                     ##
  > ##                                                                         ##
  > #############################################################################
  > 
  > ## --- Load test routines and test parameters -------------------------------
  > 
  > source("test_routines.R")
  > 
  > #############################################################################
  > ##                                                                          #
  > ##  CONT: Chi^2 goodness-of-fit test                                        #
  > ##                                                                          #
  > #############################################################################
  > 
  > ## --- AROU (Automatic Ratio-Of-Uniforms Method) ----------------------------
  > 
  > ur.arou.norm <- function (n) {
  +         pdf <- function (x) { exp(-0.5*x^2) }
  +         dpdf <- function (x) { -x*exp(-0.5*x^2) }
  +         gen <- arou.new(pdf=pdf, dpdf=dpdf, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.arou.norm", rfunc=ur.arou.norm, pfunc=pnorm)
  ur.arou.norm(): chisq test PASSed with p-value=0.332373
  > rm(ur.arou.norm)
  > 
  > ur.arou.norm.wod <- function (n) {
  +         pdf <- function (x) { exp(-0.5*x^2) }
  +         gen <- arou.new(pdf=pdf, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.arou.norm.wod", rfunc=ur.arou.norm.wod, pfunc=pnorm)
  ur.arou.norm.wod(): chisq test PASSed with p-value=0.0321838
  > rm(ur.arou.norm.wod)
  > 
  > ur.arou.norm.wl <- function (n) {
  +         logpdf <- function (x) { -0.5*x^2 }
  +         dlogpdf <- function (x) { -x }
  +         gen <- arou.new(pdf=logpdf, dpdf=dlogpdf, islog=TRUE, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.arou.norm.wl", rfunc=ur.arou.norm.wl, pfunc=pnorm)
  ur.arou.norm.wl(): chisq test PASSed with p-value=0.738705
  > rm(ur.arou.norm.wl)
  > 
  > ur.arou.norm.wlwod <- function (n) {
  +         logpdf <- function (x) { -0.5*x^2 }
  +         gen <- arou.new(pdf=logpdf, islog=TRUE, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.arou.norm.wlwod", rfunc=ur.arou.norm.wlwod, pfunc=pnorm)
  ur.arou.norm.wlwod(): chisq test PASSed with p-value=0.702157
  > rm(ur.arou.norm.wlwod)
  > 
  > ## test arguments passed to PDF
  > ur.arou.norm.param <- function (n) {
  +         pdf <- function (x,a) { exp(a*x^2) }
  +         gen <- arou.new(pdf=pdf, lb=-Inf, ub=Inf, a=-1/2)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.arou.norm.param", rfunc=ur.arou.norm.param, pfunc=pnorm)
  ur.arou.norm.param(): chisq test PASSed with p-value=0.388697
  > rm(ur.arou.norm.param)
  > 
  > ur.arou.norm.R <- function (n) {
  +         gen <- arou.new(pdf=dnorm, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.arou.norm.R", rfunc=ur.arou.norm.R, pfunc=pnorm)
  ur.arou.norm.R(): chisq test PASSed with p-value=0.881014
  > rm(ur.arou.norm.R)
  > 
  > ur.arou.t.R <- function (n,df) {
  +         gen <- arou.new(pdf=dt, lb=-Inf, ub=Inf, df=df)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.arou.t.R", rfunc=ur.arou.t.R, pfunc=pt, df=8)
  ur.arou.t.R(8): chisq test PASSed with p-value=0.686902
  > rm(ur.arou.t.R)
  > 
  > 
  > ## --- ARS (Adaptive Rejection Sampling) ------------------------------------
  > 
  > ur.ars.norm.wl <- function (n) {
  +         logpdf <- function (x) { -0.5*x^2 }
  +         dlogpdf <- function (x) { -x }
  +         gen <- ars.new(logpdf=logpdf, dlogpdf=dlogpdf, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.ars.norm.wl", rfunc=ur.ars.norm.wl, pfunc=pnorm)
  ur.ars.norm.wl(): chisq test PASSed with p-value=0.99773
  > rm(ur.ars.norm.wl)
  > 
  > ur.ars.norm.wlwod <- function (n) {
  +         logpdf <- function (x) { -0.5*x^2 }
  +         gen <- ars.new(logpdf=logpdf, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.ars.norm.wlwod", rfunc=ur.ars.norm.wlwod, pfunc=pnorm)
  ur.ars.norm.wlwod(): chisq test PASSed with p-value=0.780679
  > rm(ur.ars.norm.wlwod)
  > 
  > ## test arguments passed to PDF
  > ur.ars.norm.param <- function (n) {
  +         logpdf <- function (x,a) { a*x^2 }
  +         gen <- ars.new(logpdf=logpdf, lb=-Inf, ub=Inf, a=-1/2)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.ars.norm.param", rfunc=ur.ars.norm.param, pfunc=pnorm)
  ur.ars.norm.param(): chisq test PASSed with p-value=0.90026
  > rm(ur.ars.norm.param)
  > 
  > 
  > ## --- ITDR (Inverse Transformed Density Rejection) -------------------------
  > 
  > ur.itdr.exp <- function (n) {
  +         pdf <- function (x) { exp(-x) }
  +         dpdf <- function (x) { -exp(-x) }
  +         gen <- itdr.new(pdf=pdf, dpdf=dpdf, lb=0, ub=Inf, pole=0)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.itdr.exp", rfunc=ur.itdr.exp, pfunc=pexp)
  ur.itdr.exp(): chisq test PASSed with p-value=0.00715335
  > rm(ur.itdr.exp)
  > 
  > cdf.gamma <- function(x) { pgamma(x,0.5) }
  > ur.itdr.gamma <- function (n) {
  +         pdf <- function (x) { x^(-0.5)*exp(-x) }
  +         dpdf <- function (x) { (-x^(-0.5) - 0.5*x^(-1.5))*exp(-x) }
  +         gen <- itdr.new(pdf=pdf, dpdf=dpdf, lb=0, ub=Inf, pole=0)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.itdr.gamma", rfunc=ur.itdr.gamma, pfunc=cdf.gamma)
  ur.itdr.gamma(): chisq test PASSed with p-value=0.790274
  > rm(ur.itdr.gamma)
  > rm(cdf.gamma)
  > 
  > 
  > ## --- PINV (Polynomial interpolation based INVersion) ----------------------
  > 
  > ur.pinv.norm.pdf <- function (n) {
  +         gen <- pinv.new(pdf=dnorm, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.pinv.norm.pdf", rfunc=ur.pinv.norm.pdf, pfunc=pnorm)
  ur.pinv.norm.pdf(): chisq test PASSed with p-value=0.126606
  > rm(ur.pinv.norm.pdf)
  > 
  > ur.pinv.norm.cdf <- function (n) {
  +         gen <- pinv.new(cdf=pnorm, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.pinv.norm.cdf", rfunc=ur.pinv.norm.cdf, pfunc=pnorm)
  ur.pinv.norm.cdf(): chisq test PASSed with p-value=0.117484
  > rm(ur.pinv.norm.cdf)
  > 
  > ur.pinv.norm.pdfcdf <- function (n) {
  +         gen <- pinv.new(pdf=dnorm,cdf=pnorm, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.pinv.norm.pdfcdf", rfunc=ur.pinv.norm.pdfcdf, pfunc=pnorm)
  ur.pinv.norm.pdfcdf(): chisq test PASSed with p-value=0.137485
  > rm(ur.pinv.norm.pdfcdf)
  > 
  > 
  > ## --- SROU (Simple Ratio-Of-Uniforms Method) -------------------------------
  > 
  > ur.srou.norm <- function (n) {
  +         gen <- srou.new(pdf=dnorm, lb=-Inf, ub=Inf, mode=0, area=1)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.srou.norm", rfunc=ur.srou.norm, pfunc=pnorm)
  ur.srou.norm(): chisq test PASSed with p-value=0.806951
  > rm(ur.srou.norm)
  > 
  > ur.srou.2.norm <- function (n) {
  +         gen <- srou.new(pdf=dnorm, lb=-Inf, ub=Inf, mode=0, area=1, r=2)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.srou.2.norm", rfunc=ur.srou.2.norm, pfunc=pnorm)
  ur.srou.2.norm(): chisq test PASSed with p-value=0.0376642
  > rm(ur.srou.2.norm)
  > 
  > 
  > ## --- TABL (TABLe based Rejection) -----------------------------------------
  > 
  > ur.tabl.norm <- function (n) {
  +         gen <- tabl.new(pdf=dnorm, lb=-Inf, ub=Inf, mode=0)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.tabl.norm", rfunc=ur.tabl.norm, pfunc=pnorm)
  ur.tabl.norm(): chisq test PASSed with p-value=0.225512
  > rm(ur.tabl.norm)
  > 
  > ur.tabl.2.norm <- function (n) {
  +         gen <- tabl.new(pdf=dnorm, lb=-Inf, ub=Inf, mode=0)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.tabl.2.norm", rfunc=ur.tabl.2.norm, pfunc=pnorm)
  ur.tabl.2.norm(): chisq test PASSed with p-value=0.549131
  > rm(ur.tabl.2.norm)
  > 
  > 
  > ## --- TDR (Transformed Density Rejection) ----------------------------------
  > 
  > ur.tdr.norm <- function (n) {
  +         pdf <- function (x) { exp(-0.5*x^2) }
  +         dpdf <- function (x) { -x*exp(-0.5*x^2) }
  +         gen <- tdr.new(pdf=pdf, dpdf=dpdf, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.tdr.norm", rfunc=ur.tdr.norm, pfunc=pnorm)
  ur.tdr.norm(): chisq test PASSed with p-value=0.366555
  > rm(ur.tdr.norm)
  > 
  > ur.tdr.norm.wod <- function (n) {
  +         pdf <- function (x) { exp(-0.5*x^2) }
  +         gen <- tdr.new(pdf=pdf, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.tdr.norm.wod", rfunc=ur.tdr.norm.wod, pfunc=pnorm)
  ur.tdr.norm.wod(): chisq test PASSed with p-value=0.375731
  > rm(ur.tdr.norm.wod)
  > 
  > ur.tdr.norm.wl <- function (n) {
  +         logpdf <- function (x) { -0.5*x^2 }
  +         dlogpdf <- function (x) { -x }
  +         gen <- tdr.new(pdf=logpdf, dpdf=dlogpdf, islog=TRUE, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.tdr.norm.wl", rfunc=ur.tdr.norm.wl, pfunc=pnorm)
  ur.tdr.norm.wl(): chisq test PASSed with p-value=0.315044
  > rm(ur.tdr.norm.wl)
  > 
  > ur.tdr.norm.wlwod <- function (n) {
  +         logpdf <- function (x) { -0.5*x^2 }
  +         gen <- tdr.new(pdf=logpdf, islog=TRUE, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.tdr.norm.wlwod", rfunc=ur.tdr.norm.wlwod, pfunc=pnorm)
  ur.tdr.norm.wlwod(): chisq test PASSed with p-value=0.686902
  > rm(ur.tdr.norm.wlwod)
  > 
  > ## test arguments passed to PDF
  > ur.tdr.norm.param <- function (n) {
  +         pdf <- function (x,a) { exp(a*x^2) }
  +         gen <- tdr.new(pdf=pdf, lb=-Inf, ub=Inf, a=-1/2)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.tdr.norm.param", rfunc=ur.tdr.norm.param, pfunc=pnorm)
  ur.tdr.norm.param(): chisq test PASSed with p-value=0.0645617
  > rm(ur.tdr.norm.param)
  > 
  > ur.tdr.norm.R <- function (n) {
  +         gen <- tdr.new(pdf=dnorm, lb=-Inf, ub=Inf)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.tdr.norm.R", rfunc=ur.tdr.norm.R, pfunc=pnorm)
  ur.tdr.norm.R(): chisq test PASSed with p-value=0.574676
  > rm(ur.tdr.norm.R)
  > 
  > ur.tdr.t.R <- function (n,df) {
  +         gen <- tdr.new(pdf=dt, lb=-Inf, ub=Inf, df=df)
  +         ur(gen,n)
  + }
  > unur.test.cont("ur.tdr.t.R", rfunc=ur.tdr.t.R, pfunc=pt, df=8)
  ur.tdr.t.R(8): chisq test PASSed with p-value=0.879403
  > rm(ur.tdr.t.R)
  > 
  > 
  > #############################################################################
  > ##                                                                          #
  > ##  DISCR: Chi^2 goodness-of-fit test                                       #
  > ##                                                                          #
  > #############################################################################
  > 
  > ## --- DARI (Discrete Automatic Rejection Inversion) ------------------------
  > 
  > size <- 1000
  > prob <- 0.2
  > binom.pmf <- function (x) { dbinom(x, size, prob) }
  > ur.dari.binom <- function (n,lb=0,ub=size) {
  +         gen <- dari.new(pmf=binom.pmf,lb=0,ub=size)
  +         ur(gen,n)
  + }
  > unur.test.discr("ur.dari.binom", rfunc=ur.dari.binom, dfunc=binom.pmf, domain=c(0,size))
  ur.dari.binom() domain=(0,1000): chisq test PASSed with p-value=0.399113
  > rm(ur.dari.binom)
  > rm(size,prob,binom.pmf)
  > 
  > size <- 100000
  > prob <- 0.1
  > geom.pmf <- function (x) { dgeom(x, prob) }
  > ur.dari.geom <- function (n,lb=0,ub=size,mode=0) {
  +         gen <- dari.new(pmf=geom.pmf,lb=0,ub=size)
  +         ur(gen,n)
  + }
  > unur.test.discr("ur.dari.geom", rfunc=ur.dari.geom, dfunc=geom.pmf, domain=c(0,size))
  ur.dari.geom() domain=(0,1e+05): chisq test PASSed with p-value=0.00331673
  > rm(ur.dari.geom)
  > rm(size,prob,geom.pmf)
  > 
  > 
  > ## --- DAU (Discrete Alias-Urn method) --------------------------------------
  > 
  > size <- 100
  > prob <- 0.3
  > binom.pmf <- function (x) { dbinom(x, size, prob) }
  > binom.probs <- dbinom(0:size, size, prob)
  > ur.dau.binom <- function (n,lb=0,ub=size) {
  +         gen <- dau.new(pv=binom.probs,from=lb)
  +         ur(gen,n)
  + }
  > unur.test.discr("ur.dau.binom", rfunc=ur.dau.binom, dfunc=binom.pmf, domain=c(0,size))
  ur.dau.binom() domain=(0,100): Warning: first chisq test FAILed with p-value=0.000944708
  Error: chisq test FAILED!  p-value=0.000323764
  Execution halted