R version 4.5.0 RC (2025-04-04 r88113 ucrt) -- "How About a Twenty-Six" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ############################################################################# > ## ## > ## Tests for wrapper functions for special distributions ## > ## ## > ############################################################################# > ## ## > ## Continuous univariate distributions ## > ## ## > ############################################################################# > ## ## > ## Remark: You must use named arguments when calling the test routines! ## > ## ## > ############################################################################# > > ## --- Load test routines and test parameters ------------------------------- > > source("test_routines.R") > > ## --- Chi^2 goodness-of-fit test ------------------------------------------- > > ## Beta distribution - (replacement for rbeta) ------------------------------ > for (i in 1:n.rep.domains) + unur.test.cont("beta", shape1=runif(1,0.2,10), shape2=runif(1,0.2,10), + domain=sort(runif(2))) beta(6.81705514341593,4.41307800058275) domain=(0.286624,0.682186): chisq test PASSed with p-value=0.351762 beta(5.15140540497378,0.620979281933978) domain=(0.0648648,0.50323): chisq test PASSed with p-value=0.0984035 > for (i in 1:n.rep.params) + unur.test.cont("beta", shape1=runif(1,0.2,10), shape2=runif(1,0.2,10)) beta(6.62448740317486,8.64444097811356): chisq test PASSed with p-value=0.359313 beta(7.0771231553983,1.29091997216456): chisq test PASSed with p-value=0.809978 beta(7.56985480971634,3.8821297197137): chisq test PASSed with p-value=0.826061 beta(7.39969612318091,5.57139844344929): chisq test PASSed with p-value=0.560271 beta(7.68855090402067,5.08204697975889): chisq test PASSed with p-value=0.772599 > > ## Burr family of distributions --------------------------------------------- > > ## Cauchy distribution - (replacement for rcauchy) -------------------------- > unur.test.cont("cauchy") cauchy(): chisq test PASSed with p-value=0.776227 > for (i in 1:n.rep.domains) + unur.test.cont("cauchy", domain=sort(rnorm(2))) cauchy() domain=(-0.501148,-0.126935): chisq test PASSed with p-value=0.482239 cauchy() domain=(-0.436924,1.17447): chisq test PASSed with p-value=0.288962 > for (i in 1:n.rep.params) + unur.test.cont("cauchy", location=rcauchy(1), scale=rgamma(1,shape=2)) cauchy(3.60859238504642,1.93127966200644): chisq test PASSed with p-value=0.419344 cauchy(2.19105642593061,4.75846190807757): chisq test PASSed with p-value=0.855744 cauchy(2.24555347888811,1.62648921523748): chisq test PASSed with p-value=0.712597 cauchy(-0.00589380823229108,0.499654004699005): chisq test PASSed with p-value=0.274188 cauchy(0.204881223117186,2.838298514788): chisq test PASSed with p-value=0.854833 > > ## Chi distribution --------------------------------------------------------- > > ## Chi^2 distribution - (replacement for rchisq) ---------------------------- > for (i in 1:n.rep.domains) + unur.test.cont("chisq", df=3, domain=sort(rexp(2))) chisq(3) domain=(0.0204655,0.12485): chisq test PASSed with p-value=0.637286 chisq(3) domain=(0.141758,0.721914): chisq test PASSed with p-value=0.0265982 > for (i in 1:n.rep.params) + unur.test.cont("chisq", df=rgamma(1,shape=2)) chisq(1.74926126718762): chisq test PASSed with p-value=0.0609148 chisq(1.62528709484464): chisq test PASSed with p-value=0.200853 chisq(3.68616749261012): chisq test PASSed with p-value=0.342009 chisq(0.63114549557566): chisq test PASSed with p-value=0.468332 chisq(0.372714625980362): chisq test PASSed with p-value=0.672384 > > ## Exponential distribution - (replacement for rexp) ------------------------ > for (i in 1:n.rep.domains) + unur.test.cont("exp", domain=sort(rexp(2))) exp() domain=(0.0513461,4.87062): chisq test PASSed with p-value=0.12874 exp() domain=(1.6306,1.7027): chisq test PASSed with p-value=0.494283 > for (i in 1:n.rep.params) + unur.test.cont("exp", rate=runif(1,0.1,10)) exp(8.54712262453977): chisq test PASSed with p-value=0.140652 exp(7.73234498905949): chisq test PASSed with p-value=0.698281 exp(4.13525811783038): chisq test PASSed with p-value=0.582151 exp(2.46102643208578): chisq test PASSed with p-value=0.0554586 exp(5.26924132993445): chisq test PASSed with p-value=0.0361433 > > ## Extreme value type I (Gumbel-type) distribution -------------------------- > > ## Extreme value type II (Frechet-type) distribution ------------------------ > > ## F distribution - (replacement for rf) ----------------------------------- > for (i in 1:n.rep.domains) + unur.test.cont("f", df1=runif(1,0.1,10), df2=runif(1,0.1,10), + domain=sort(runif(2))) f(3.36896235933527,2.75287351342849) domain=(0.237701,0.879721): chisq test PASSed with p-value=0.510278 f(7.76097613153979,3.13031070649158) domain=(0.628443,0.842403): chisq test PASSed with p-value=0.743015 > for (i in 1:n.rep.params) + unur.test.cont("f", df1=runif(1,0.1,10), df2=runif(1,0.1,10)) f(9.33085519103333,2.06053146556951): chisq test PASSed with p-value=0.810909 f(6.51911443953868,8.88032151169609): chisq test PASSed with p-value=0.906056 f(6.92483352716081,2.95202443713788): chisq test PASSed with p-value=0.215181 f(2.87101484481245,6.5069869739702): chisq test PASSed with p-value=0.297984 f(7.29725816568825,3.21722033575643): chisq test PASSed with p-value=0.119931 > > ## Gamma distribution - (replacement for rgamma) --------------------------- > for (i in 1:n.rep.domains) + unur.test.cont("gamma", shape=runif(1,0.1,10), domain=sort(rexp(2))) gamma(3.21812894830946) domain=(0.215691,0.759283): chisq test PASSed with p-value=0.811195 gamma(4.75450793218333) domain=(0.47232,1.2233): chisq test PASSed with p-value=0.783312 > for (i in 1:n.rep.params) + unur.test.cont("gamma", shape=runif(1,0.1,10), scale=runif(1,0.1,10)) gamma(9.6480686489027,5.22264166818932): chisq test PASSed with p-value=0.489964 gamma(7.90640894656535,8.31637016001623): chisq test PASSed with p-value=0.555758 gamma(2.35269568355288,6.34511161355767): chisq test PASSed with p-value=0.888747 gamma(3.84011739089619,4.77819908917882): chisq test PASSed with p-value=0.436095 gamma(1.77273897335399,7.18087799893692): chisq test PASSed with p-value=0.463345 > > ## Generalized inverse Gaussian --------------------------------------------- > > ## Hyperbolic distribution -------------------------------------------------- > > ## Laplace (double exponential) distribution -------------------------------- > > ## Lognormal distribution - (replacement for rlnorm) ----------------------- > unur.test.cont("lnorm") lnorm(): chisq test PASSed with p-value=0.479032 > for (i in 1:n.rep.domains) + unur.test.cont("lnorm", domain=sort(rexp(2))) lnorm() domain=(0.392021,0.886186): chisq test PASSed with p-value=0.562776 lnorm() domain=(0.0586158,0.438528): chisq test PASSed with p-value=0.171921 > for (i in 1:n.rep.params) + unur.test.cont("lnorm", meanlog=rnorm(1), sdlog=rgamma(1,shape=2)) lnorm(-0.965984055853981,1.70622822545274): chisq test PASSed with p-value=0.192371 lnorm(-0.158210807239597,3.5448055784699): chisq test PASSed with p-value=0.664989 lnorm(0.204223429462578,0.959256797657776): chisq test PASSed with p-value=0.825175 lnorm(-0.368029003661115,0.124466457662247): chisq test PASSed with p-value=0.224857 lnorm(1.35855856679245,3.57560811823964): chisq test PASSed with p-value=0.877669 > > ## Logistic distribution - (replacement for rlogistic) ---------------------- > unur.test.cont("logis") logis(): chisq test PASSed with p-value=0.434914 > for (i in 1:n.rep.domains) + unur.test.cont("logis", domain=sort(rnorm(2))) logis() domain=(-0.889112,0.444912): chisq test PASSed with p-value=0.614648 logis() domain=(-0.518531,0.575195): chisq test PASSed with p-value=0.175245 > for (i in 1:n.rep.params) + unur.test.cont("logis", location=rcauchy(1), scale=rgamma(1,shape=2)) logis(0.659346569687657,0.877764772747105): chisq test PASSed with p-value=0.56598 logis(-2.29684062022248,1.40639047812312): chisq test PASSed with p-value=0.849474 logis(1.1988802862882,2.63398878307916): chisq test PASSed with p-value=0.137067 logis(-0.440960932668582,0.817423855011185): chisq test PASSed with p-value=0.243992 logis(1.58497080114193,1.48178500545615): chisq test PASSed with p-value=0.573578 > > ## Lomax distribution (Pareto distribution of second kind) ------------------ > > ## Normal (Gaussian) distribution - (replacement for rnorm) ----------------- > unur.test.cont("norm") norm(): chisq test PASSed with p-value=0.521557 > for (i in 1:n.rep.domains) + unur.test.cont("norm", domain=sort(rnorm(2))) norm() domain=(0.981806,1.15301): chisq test PASSed with p-value=0.284047 norm() domain=(0.263851,0.473514): chisq test PASSed with p-value=0.625866 > for (i in 1:n.rep.params) + unur.test.cont("norm", mean=rcauchy(1), sd=rgamma(1,shape=2)) norm(0.209281716476036,0.936264993431488): chisq test PASSed with p-value=0.272807 norm(-2.13054931694253,1.49977640241298): chisq test PASSed with p-value=0.36237 norm(0.657539528988362,5.30040502230546): chisq test PASSed with p-value=0.156976 norm(3.04755960403938,0.867135792564587): chisq test PASSed with p-value=0.730156 norm(1.4689373149419,2.06051888369314): chisq test PASSed with p-value=0.265155 > > rud <- function (n) { + dist <- udnorm() + gen <- unuran.new(dist) + ur(gen,n) + } > unur.test.cont("udnorm", rfunc=rud, pfunc=pnorm) udnorm(): chisq test PASSed with p-value=0.836097 > rm(rud) > > ## Pareto distribution ------------------------------------------------------ > > ## Planck distribution ------------------------------------------------------ > > ## Powerexponential (Subbotin) distribution --------------------------------- > > ## Rayleigh distribution ---------------------------------------------------- > > ## Student's t distribution - (replacement for rt) -------------------------- > for (i in 1:n.rep.domains) + unur.test.cont("t", df=2, domain=sort(rnorm(2))) t(2) domain=(0.281565,0.434922): chisq test PASSed with p-value=0.710735 t(2) domain=(0.407459,0.788542): chisq test PASSed with p-value=0.219163 > for (i in 1:n.rep.params) + unur.test.cont("t", df=0.1+rgamma(1,shape=2)) t(3.34042873625745): chisq test PASSed with p-value=0.422856 t(1.00649102184341): chisq test PASSed with p-value=0.845896 t(0.554235527487395): chisq test PASSed with p-value=0.955415 t(1.66991426861522): chisq test PASSed with p-value=0.488759 t(1.33200935139533): chisq test PASSed with p-value=0.295187 > > ## Weibull distribution - (replacement for rweibull) ------------------------ > for (i in 1:n.rep.domains) { + s <- runif(1,0.1,10) + unur.test.cont("weibull", shape=s, domain=sort(urweibull(n=2,shape=s))) + } weibull(7.69240326746367) domain=(0.982032,1.01243): chisq test PASSed with p-value=0.753104 weibull(1.47640953203663) domain=(0.728682,2.19929): chisq test PASSed with p-value=0.952397 > for (i in 1:n.rep.params) + unur.test.cont("weibull", shape=runif(1,0.1,10), scale=runif(1,0.1,10)) weibull(1.33796671421733,9.0114796442911): chisq test PASSed with p-value=0.58593 weibull(4.76806582841091,9.40251804266591): chisq test PASSed with p-value=0.0600781 weibull(6.23218928382266,0.574085426214151): chisq test PASSed with p-value=0.524982 weibull(6.44516203354578,5.77117100975011): chisq test PASSed with p-value=0.961907 weibull(0.2966291958699,1.85272906075697): chisq test PASSed with p-value=0.618071 > > > ## -- Print statistics ------------------------------------------------------ > > unur.test.statistic() Tests for discrete distributions number of tests = 82 (number of warnings = 0 ) > > ## -- End ------------------------------------------------------------------- > > detach("package:Runuran",unload = TRUE) > > ## -------------------------------------------------------------------------- > > proc.time() user system elapsed 4.32 0.32 4.61