[Rcpp-commits] r3889 - pkg/Rcpp/inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Nov 3 03:06:03 CET 2012
Author: edd
Date: 2012-11-03 03:06:02 +0100 (Sat, 03 Nov 2012)
New Revision: 3889
Modified:
pkg/Rcpp/inst/unitTests/runit.rmath.R
Log:
more Rmath
Modified: pkg/Rcpp/inst/unitTests/runit.rmath.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.rmath.R 2012-11-03 00:19:12 UTC (rev 3888)
+++ pkg/Rcpp/inst/unitTests/runit.rmath.R 2012-11-03 02:06:02 UTC (rev 3889)
@@ -139,6 +139,7 @@
return NumericVector::create(R::qt(x, a, 1, 0), R::qt(log(x), a, 1, 1),
R::qt(x, a, 0, 0), R::qt(log(x), a, 0, 1));')
+
,"runit_dbinom" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
return NumericVector::create(R::dbinom(x, a, b, 0), R::dbinom(x, a, b, 1));')
@@ -151,6 +152,161 @@
return NumericVector::create(R::qbinom(x, a, b, 1, 0), R::qbinom(log(x), a, b, 1, 1),
R::qbinom(x, a, b, 0, 0), R::qbinom(log(x), a, b, 0, 1));')
+
+ ,"runit_dcauchy" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::dcauchy(x, a, b, 0), R::dcauchy(x, a, b, 1));')
+ ,"runit_pcauchy" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_) ;
+ return NumericVector::create(R::pcauchy(x, a, b, 1, 0), R::pcauchy(log(x), a, b, 1, 1),
+ R::pcauchy(x, a, b, 0, 0), R::pcauchy(log(x), a, b, 0, 1));')
+ ,"runit_qcauchy" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::qcauchy(x, a, b, 1, 0), R::qcauchy(log(x), a, b, 1, 1),
+ R::qcauchy(x, a, b, 0, 0), R::qcauchy(log(x), a, b, 0, 1));')
+
+
+ ,"runit_dexp" = list(signature(x_ = "double", a_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_);
+ return NumericVector::create(R::dexp(x, a, 0), R::dexp(x, a, 1));')
+ ,"runit_pexp" = list(signature(x_ = "double", a_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_);
+ return NumericVector::create(R::pexp(x, a, 1, 0), R::pexp(log(x), a, 1, 1),
+ R::pexp(x, a, 0, 0), R::pexp(log(x), a, 0, 1));')
+ ,"runit_qexp" = list(signature(x_ = "double", a_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_);
+ return NumericVector::create(R::qexp(x, a, 1, 0), R::qexp(log(x), a, 1, 1),
+ R::qexp(x, a, 0, 0), R::qexp(log(x), a, 0, 1));')
+
+
+ ,"runit_dgeom" = list(signature(x_ = "double", a_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_);
+ return NumericVector::create(R::dgeom(x, a, 0), R::dgeom(x, a, 1));')
+ ,"runit_pgeom" = list(signature(x_ = "double", a_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_);
+ return NumericVector::create(R::pgeom(x, a, 1, 0), R::pgeom(log(x), a, 1, 1),
+ R::pgeom(x, a, 0, 0), R::pgeom(log(x), a, 0, 1));')
+ ,"runit_qgeom" = list(signature(x_ = "double", a_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_);
+ return NumericVector::create(R::qgeom(x, a, 1, 0), R::qgeom(log(x), a, 1, 1),
+ R::qgeom(x, a, 0, 0), R::qgeom(log(x), a, 0, 1));')
+
+
+ ,"runit_dhyper" = list(signature(x_ = "double", a_ = "double", b_ = "double", c_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_), c = as<double>(c_);
+ return NumericVector::create(R::dhyper(x, a, b, c, 0), R::dhyper(x, a, b, c, 1));')
+ ,"runit_phyper" = list(signature(x_ = "double", a_ = "double", b_ = "double", c_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_), c = as<double>(c_);
+ return NumericVector::create(R::phyper(x, a, b, c, 1, 0), R::phyper(log(x), a, b, c, 1, 1),
+ R::phyper(x, a, b, c, 0, 0), R::phyper(log(x), a, b, c, 0, 1));')
+ ,"runit_qhyper" = list(signature(x_ = "double", a_ = "double", b_ = "double", c_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_), c = as<double>(c_);
+ return NumericVector::create(R::qhyper(x, a, b, c, 1, 0), R::qhyper(log(x), a, b, c, 1, 1),
+ R::qhyper(x, a, b, c, 0, 0), R::qhyper(log(x), a, b, c, 0, 1));')
+
+
+ ,"runit_dnbinom" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::dnbinom(x, a, b, 0), R::dnbinom(x, a, b, 1));')
+ ,"runit_pnbinom" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_) ;
+ return NumericVector::create(R::pnbinom(x, a, b, 1, 0), R::pnbinom(log(x), a, b, 1, 1),
+ R::pnbinom(x, a, b, 0, 0), R::pnbinom(log(x), a, b, 0, 1));')
+ ,"runit_qnbinom" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::qnbinom(x, a, b, 1, 0), R::qnbinom(log(x), a, b, 1, 1),
+ R::qnbinom(x, a, b, 0, 0), R::qnbinom(log(x), a, b, 0, 1));')
+
+
+ ,"runit_dpois" = list(signature(x_ = "double", a_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_);
+ return NumericVector::create(R::dpois(x, a, 0), R::dpois(x, a, 1));')
+ ,"runit_ppois" = list(signature(x_ = "double", a_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_);
+ return NumericVector::create(R::ppois(x, a, 1, 0), R::ppois(log(x), a, 1, 1),
+ R::ppois(x, a, 0, 0), R::ppois(log(x), a, 0, 1));')
+ ,"runit_qpois" = list(signature(x_ = "double", a_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_);
+ return NumericVector::create(R::qpois(x, a, 1, 0), R::qpois(log(x), a, 1, 1),
+ R::qpois(x, a, 0, 0), R::qpois(log(x), a, 0, 1));')
+
+
+ ,"runit_dweibull" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::dweibull(x, a, b, 0), R::dweibull(x, a, b, 1));')
+ ,"runit_pweibull" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_) ;
+ return NumericVector::create(R::pweibull(x, a, b, 1, 0), R::pweibull(log(x), a, b, 1, 1),
+ R::pweibull(x, a, b, 0, 0), R::pweibull(log(x), a, b, 0, 1));')
+ ,"runit_qweibull" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::qweibull(x, a, b, 1, 0), R::qweibull(log(x), a, b, 1, 1),
+ R::qweibull(x, a, b, 0, 0), R::qweibull(log(x), a, b, 0, 1));')
+
+
+ ,"runit_dlogis" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::dlogis(x, a, b, 0), R::dlogis(x, a, b, 1));')
+ ,"runit_plogis" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_) ;
+ return NumericVector::create(R::plogis(x, a, b, 1, 0), R::plogis(log(x), a, b, 1, 1),
+ R::plogis(x, a, b, 0, 0), R::plogis(log(x), a, b, 0, 1));')
+ ,"runit_qlogis" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::qlogis(x, a, b, 1, 0), R::qlogis(log(x), a, b, 1, 1),
+ R::qlogis(x, a, b, 0, 0), R::qlogis(log(x), a, b, 0, 1));')
+
+
+ ,"runit_dnbeta" = list(signature(x_ = "double", a_ = "double", b_ = "double", c_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_), c = as<double>(c_);
+ return NumericVector::create(R::dnbeta(x, a, b, c, 0), R::dnbeta(x, a, b, c, 1));')
+ ,"runit_pnbeta" = list(signature(x_ = "double", a_ = "double", b_ = "double", c_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_), c = as<double>(c_);
+ return NumericVector::create(R::pnbeta(x, a, b, c, 1, 0), R::pnbeta(log(x), a, b, c, 1, 1),
+ R::pnbeta(x, a, b, c, 0, 0), R::pnbeta(log(x), a, b, c, 0, 1));')
+ ,"runit_qnbeta" = list(signature(x_ = "double", a_ = "double", b_ = "double", c_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_), c = as<double>(c_);
+ return NumericVector::create(R::qnbeta(x, a, b, c, 1, 0), R::qnbeta(log(x), a, b, c, 1, 1),
+ R::qnbeta(x, a, b, c, 0, 0), R::qnbeta(log(x), a, b, c, 0, 1));')
+
+
+ ,"runit_dnf" = list(signature(x_ = "double", a_ = "double", b_ = "double", c_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_), c = as<double>(c_);
+ return NumericVector::create(R::dnf(x, a, b, c, 0), R::dnf(x, a, b, c, 1));')
+ ,"runit_pnf" = list(signature(x_ = "double", a_ = "double", b_ = "double", c_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_), c = as<double>(c_);
+ return NumericVector::create(R::pnf(x, a, b, c, 1, 0), R::pnf(log(x), a, b, c, 1, 1),
+ R::pnf(x, a, b, c, 0, 0), R::pnf(log(x), a, b, c, 0, 1));')
+ ,"runit_qnf" = list(signature(x_ = "double", a_ = "double", b_ = "double", c_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_), c = as<double>(c_);
+ return NumericVector::create(R::qnf(x, a, b, c, 1, 0), R::qnf(log(x), a, b, c, 1, 1),
+ R::qnf(x, a, b, c, 0, 0), R::qnf(log(x), a, b, c, 0, 1));')
+
+
+ ,"runit_dnt" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::dnt(x, a, b, 0), R::dnt(x, a, b, 1));')
+ ,"runit_pnt" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::pnt(x, a, b, 1, 0), R::pnt(log(x), a, b, 1, 1),
+ R::pnt(x, a, b, 0, 0), R::pnt(log(x), a, b, 0, 1));')
+ ,"runit_qnt" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::qnt(x, a, b, 1, 0), R::qnt(log(x), a, b, 1, 1),
+ R::qnt(x, a, b, 0, 0), R::qnt(log(x), a, b, 0, 1));')
+
+ ,"runit_dwilcox" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::dwilcox(x, a, b, 0), R::dwilcox(x, a, b, 1));')
+ ,"runit_pwilcox" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_) ;
+ return NumericVector::create(R::pwilcox(x, a, b, 1, 0), R::pwilcox(log(x), a, b, 1, 1),
+ R::pwilcox(x, a, b, 0, 0), R::pwilcox(log(x), a, b, 0, 1));')
+ ,"runit_qwilcox" = list(signature(x_ = "double", a_ = "double", b_ = "double"), '
+ double x = as<double>(x_), a = as<double>(a_), b = as<double>(b_);
+ return NumericVector::create(R::qwilcox(x, a, b, 1, 0), R::qwilcox(log(x), a, b, 1, 1),
+ R::qwilcox(x, a, b, 0, 0), R::qwilcox(log(x), a, b, 0, 1));')
+
)
}
@@ -168,13 +324,13 @@
f <- .rcpp.rmath$runit_dnorm
checkEquals(f(x, a, b),
c(dnorm(x, a, b, log=FALSE), dnorm(x, a, b, log=TRUE)),
- msg = " rmath.norm")
+ msg = " rmath.dnorm")
f <- .rcpp.rmath$runit_pnorm
checkEquals(f(x, a, b),
c(pnorm(x, a, b, lower=TRUE, log=FALSE), pnorm(log(x), a, b, lower=TRUE, log=TRUE),
pnorm(x, a, b, lower=FALSE, log=FALSE), pnorm(log(x), a, b, lower=FALSE, log=TRUE)),
- msg = " rmath.qnorm")
+ msg = " rmath.pnorm")
f <- .rcpp.rmath$runit_qnorm
checkEquals(f(x, a, b),
@@ -190,13 +346,13 @@
f <- .rcpp.rmath$runit_dunif
checkEquals(f(x, a, b),
c(dunif(x, a, b, log=FALSE), dunif(x, a, b, log=TRUE)),
- msg = " rmath.unif")
+ msg = " rmath.dunif")
f <- .rcpp.rmath$runit_punif
checkEquals(f(x, a, b),
c(punif(x, a, b, lower=TRUE, log=FALSE), punif(log(x), a, b, lower=TRUE, log=TRUE),
punif(x, a, b, lower=FALSE, log=FALSE), punif(log(x), a, b, lower=FALSE, log=TRUE)),
- msg = " rmath.qunif")
+ msg = " rmath.punif")
f <- .rcpp.rmath$runit_qunif
checkEquals(f(x, a, b),
@@ -212,13 +368,13 @@
f <- .rcpp.rmath$runit_dgamma
checkEquals(f(x, a, b),
c(dgamma(x, a, b, log=FALSE), dgamma(x, a, b, log=TRUE)),
- msg = " rmath.gamma")
+ msg = " rmath.dgamma")
f <- .rcpp.rmath$runit_pgamma
checkEquals(f(x, a, b),
c(pgamma(x, a, b, lower=TRUE, log=FALSE), pgamma(log(x), a, b, lower=TRUE, log=TRUE),
pgamma(x, a, b, lower=FALSE, log=FALSE), pgamma(log(x), a, b, lower=FALSE, log=TRUE)),
- msg = " rmath.qgamma")
+ msg = " rmath.pgamma")
f <- .rcpp.rmath$runit_qgamma
checkEquals(f(x, a, b),
@@ -234,13 +390,13 @@
f <- .rcpp.rmath$runit_dbeta
checkEquals(f(x, a, b),
c(dbeta(x, a, b, log=FALSE), dbeta(x, a, b, log=TRUE)),
- msg = " rmath.beta")
+ msg = " rmath.dbeta")
f <- .rcpp.rmath$runit_pbeta
checkEquals(f(x, a, b),
c(pbeta(x, a, b, lower=TRUE, log=FALSE), pbeta(log(x), a, b, lower=TRUE, log=TRUE),
pbeta(x, a, b, lower=FALSE, log=FALSE), pbeta(log(x), a, b, lower=FALSE, log=TRUE)),
- msg = " rmath.qbeta")
+ msg = " rmath.pbeta")
f <- .rcpp.rmath$runit_qbeta
checkEquals(f(x, a, b),
@@ -257,13 +413,13 @@
f <- .rcpp.rmath$runit_dlnorm
checkEquals(f(x, a, b),
c(dlnorm(x, a, b, log=FALSE), dlnorm(x, a, b, log=TRUE)),
- msg = " rmath.lnorm")
+ msg = " rmath.dlnorm")
f <- .rcpp.rmath$runit_plnorm
checkEquals(f(x, a, b),
c(plnorm(x, a, b, lower=TRUE, log=FALSE), plnorm(log(x), a, b, lower=TRUE, log=TRUE),
plnorm(x, a, b, lower=FALSE, log=FALSE), plnorm(log(x), a, b, lower=FALSE, log=TRUE)),
- msg = " rmath.qlnorm")
+ msg = " rmath.plnorm")
f <- .rcpp.rmath$runit_qlnorm
checkEquals(f(x, a, b),
@@ -279,13 +435,13 @@
f <- .rcpp.rmath$runit_dchisq
checkEquals(f(x, a),
c(dchisq(x, a, log=FALSE), dchisq(x, a, log=TRUE)),
- msg = " rmath.chisq")
+ msg = " rmath.dchisq")
f <- .rcpp.rmath$runit_pchisq
checkEquals(f(x, a),
c(pchisq(x, a, lower=TRUE, log=FALSE), pchisq(log(x), a, lower=TRUE, log=TRUE),
pchisq(x, a, lower=FALSE, log=FALSE), pchisq(log(x), a, lower=FALSE, log=TRUE)),
- msg = " rmath.qchisq")
+ msg = " rmath.pchisq")
f <- .rcpp.rmath$runit_qchisq
checkEquals(f(x, a),
@@ -302,13 +458,13 @@
f <- .rcpp.rmath$runit_dnchisq
checkEquals(f(x, a, b),
c(dchisq(x, a, b, log=FALSE), dchisq(x, a, b, log=TRUE)),
- msg = " rmath.nchisq")
+ msg = " rmath.dnchisq")
f <- .rcpp.rmath$runit_pnchisq
checkEquals(f(x, a, b),
c(pchisq(x, a, b, lower=TRUE, log=FALSE), pchisq(log(x), a, b, lower=TRUE, log=TRUE),
pchisq(x, a, b, lower=FALSE, log=FALSE), pchisq(log(x), a, b, lower=FALSE, log=TRUE)),
- msg = " rmath.qnchisq")
+ msg = " rmath.pnchisq")
f <- .rcpp.rmath$runit_qnchisq
checkEquals(f(x, a, b),
@@ -325,13 +481,13 @@
f <- .rcpp.rmath$runit_df
checkEquals(f(x, a, b),
c(df(x, a, b, log=FALSE), df(x, a, b, log=TRUE)),
- msg = " rmath.f")
+ msg = " rmath.df")
f <- .rcpp.rmath$runit_pf
checkEquals(f(x, a, b),
c(pf(x, a, b, lower=TRUE, log=FALSE), pf(log(x), a, b, lower=TRUE, log=TRUE),
pf(x, a, b, lower=FALSE, log=FALSE), pf(log(x), a, b, lower=FALSE, log=TRUE)),
- msg = " rmath.qf")
+ msg = " rmath.pf")
f <- .rcpp.rmath$runit_qf
checkEquals(f(x, a, b),
@@ -347,13 +503,13 @@
f <- .rcpp.rmath$runit_dt
checkEquals(f(x, a),
c(dt(x, a, log=FALSE), dt(x, a, log=TRUE)),
- msg = " rmath.t")
+ msg = " rmath.dt")
f <- .rcpp.rmath$runit_pt
checkEquals(f(x, a),
c(pt(x, a, lower=TRUE, log=FALSE), pt(log(x), a, lower=TRUE, log=TRUE),
pt(x, a, lower=FALSE, log=FALSE), pt(log(x), a, lower=FALSE, log=TRUE)),
- msg = " rmath.qt")
+ msg = " rmath.pt")
f <- .rcpp.rmath$runit_qt
checkEquals(f(x, a),
@@ -370,13 +526,13 @@
f <- .rcpp.rmath$runit_dbinom
checkEquals(f(x, a, b),
c(dbinom(x, a, b, log=FALSE), dbinom(x, a, b, log=TRUE)),
- msg = " rmath.binom")
+ msg = " rmath.dbinom")
f <- .rcpp.rmath$runit_pbinom
checkEquals(f(x, a, b),
c(pbinom(x, a, b, lower=TRUE, log=FALSE), pbinom(log(x), a, b, lower=TRUE, log=TRUE),
pbinom(x, a, b, lower=FALSE, log=FALSE), pbinom(log(x), a, b, lower=FALSE, log=TRUE)),
- msg = " rmath.qbinom")
+ msg = " rmath.pbinom")
x <- x/a
f <- .rcpp.rmath$runit_qbinom
@@ -386,7 +542,292 @@
msg = " rmath.qbinom")
}
+
+test.rmath.cauchy <- function() {
+ x <- 0.25
+ a <- 0.8
+ b <- 2.5
+ f <- .rcpp.rmath$runit_dcauchy
+ checkEquals(f(x, a, b),
+ c(dcauchy(x, a, b, log=FALSE), dcauchy(x, a, b, log=TRUE)),
+ msg = " rmath.dcauchy")
+
+ f <- .rcpp.rmath$runit_pcauchy
+ checkEquals(f(x, a, b),
+ c(pcauchy(x, a, b, lower=TRUE, log=FALSE), pcauchy(log(x), a, b, lower=TRUE, log=TRUE),
+ pcauchy(x, a, b, lower=FALSE, log=FALSE), pcauchy(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.pcauchy")
+
+ f <- .rcpp.rmath$runit_qcauchy
+ checkEquals(f(x, a, b),
+ c(qcauchy(x, a, b, lower=TRUE, log=FALSE), qcauchy(log(x), a, b, lower=TRUE, log=TRUE),
+ qcauchy(x, a, b, lower=FALSE, log=FALSE), qcauchy(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.qcauchy")
}
+test.rmath.exp <- function() {
+ x <- 0.25
+ a <- 1.0
+ f <- .rcpp.rmath$runit_dexp
+ checkEquals(f(x, a),
+ c(dexp(x, a, log=FALSE), dexp(x, a, log=TRUE)),
+ msg = " rmath.dexp")
+ f <- .rcpp.rmath$runit_pexp
+ checkEquals(f(x, a),
+ c(pexp(x, a, lower=TRUE, log=FALSE), pexp(log(x), a, lower=TRUE, log=TRUE),
+ pexp(x, a, lower=FALSE, log=FALSE), pexp(log(x), a, lower=FALSE, log=TRUE)),
+ msg = " rmath.pexp")
+
+ f <- .rcpp.rmath$runit_qexp
+ checkEquals(f(x, a),
+ c(qexp(x, a, lower=TRUE, log=FALSE), qexp(log(x), a, lower=TRUE, log=TRUE),
+ qexp(x, a, lower=FALSE, log=FALSE), qexp(log(x), a, lower=FALSE, log=TRUE)),
+ msg = " rmath.qexp")
+}
+
+
+test.rmath.geom <- function() {
+ x <- 1
+ a <- 0.75
+ f <- .rcpp.rmath$runit_dgeom
+
+ checkEquals(f(x, a),
+ c(dgeom(x, a, log=FALSE), dgeom(x, a, log=TRUE)),
+ msg = " rmath.dgeom")
+
+ f <- .rcpp.rmath$runit_pgeom
+ checkEquals(f(x, a),
+ c(pgeom(x, a, lower=TRUE, log=FALSE), pgeom(log(x), a, lower=TRUE, log=TRUE),
+ pgeom(x, a, lower=FALSE, log=FALSE), pgeom(log(x), a, lower=FALSE, log=TRUE)),
+ msg = " rmath.pgeom")
+
+ f <- .rcpp.rmath$runit_qgeom
+ checkEquals(f(x, a),
+ c(qgeom(x, a, lower=TRUE, log=FALSE), qgeom(log(x), a, lower=TRUE, log=TRUE),
+ qgeom(x, a, lower=FALSE, log=FALSE), qgeom(log(x), a, lower=FALSE, log=TRUE)),
+ msg = " rmath.qgeom")
+}
+
+test.rmath.hyper <- function() {
+ x <- 5
+ a <- 10
+ b <- 7
+ c <- 8
+ f <- .rcpp.rmath$runit_dhyper
+ checkEquals(f(x, a, b, c),
+ c(dhyper(x, a, b, c, log=FALSE), dhyper(x, a, b, c, log=TRUE)),
+ msg = " rmath.dhyper")
+
+ f <- .rcpp.rmath$runit_phyper
+ checkEquals(f(x, a, b, c),
+ c(phyper(x, a, b, c, lower=TRUE, log=FALSE), phyper(log(x), a, b, c, lower=TRUE, log=TRUE),
+ phyper(x, a, b, c, lower=FALSE, log=FALSE), phyper(log(x), a, b, c, lower=FALSE, log=TRUE)),
+ msg = " rmath.phyper")
+
+ x <- x/a
+ f <- .rcpp.rmath$runit_qhyper
+ checkEquals(f(x, a, b, c),
+ c(qhyper(x, a, b, c, lower=TRUE, log=FALSE), qhyper(log(x), a, b, c, lower=TRUE, log=TRUE),
+ qhyper(x, a, b, c, lower=FALSE, log=FALSE), qhyper(log(x), a, b, c, lower=FALSE, log=TRUE)),
+ msg = " rmath.qhyper")
+}
+
+
+test.rmath.nbinom <- function() {
+ x <- 2
+ a <- 8
+ b <- 0.25
+ f <- .rcpp.rmath$runit_dnbinom
+ checkEquals(f(x, a, b),
+ c(dnbinom(x, a, b, log=FALSE), dnbinom(x, a, b, log=TRUE)),
+ msg = " rmath.dnbinom")
+
+ f <- .rcpp.rmath$runit_pnbinom
+ checkEquals(f(x, a, b),
+ c(pnbinom(x, a, b, lower=TRUE, log=FALSE), pnbinom(log(x), a, b, lower=TRUE, log=TRUE),
+ pnbinom(x, a, b, lower=FALSE, log=FALSE), pnbinom(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.pnbinom")
+
+ x <- x/a
+ f <- .rcpp.rmath$runit_qnbinom
+ checkEquals(f(x, a, b),
+ c(qnbinom(x, a, b, lower=TRUE, log=FALSE), qnbinom(log(x), a, b, lower=TRUE, log=TRUE),
+ qnbinom(x, a, b, lower=FALSE, log=FALSE), qnbinom(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.qnbinom")
+}
+
+
+test.rmath.pois <- function() {
+ x <- 2
+ a <- 1.0
+ f <- .rcpp.rmath$runit_dpois
+ checkEquals(f(x, a),
+ c(dpois(x, a, log=FALSE), dpois(x, a, log=TRUE)),
+ msg = " rmath.dpois")
+
+ f <- .rcpp.rmath$runit_ppois
+ checkEquals(f(x, a),
+ c(ppois(x, a, lower=TRUE, log=FALSE), ppois(log(x), a, lower=TRUE, log=TRUE),
+ ppois(x, a, lower=FALSE, log=FALSE), ppois(log(x), a, lower=FALSE, log=TRUE)),
+ msg = " rmath.ppois")
+
+ x <- 1/x
+ f <- .rcpp.rmath$runit_qpois
+ checkEquals(f(x, a),
+ c(qpois(x, a, lower=TRUE, log=FALSE), qpois(log(x), a, lower=TRUE, log=TRUE),
+ qpois(x, a, lower=FALSE, log=FALSE), qpois(log(x), a, lower=FALSE, log=TRUE)),
+ msg = " rmath.qpois")
+}
+
+
+test.rmath.weibull <- function() {
+ x <- 2
+ a <- 8
+ b <- 0.25
+ f <- .rcpp.rmath$runit_dweibull
+ checkEquals(f(x, a, b),
+ c(dweibull(x, a, b, log=FALSE), dweibull(x, a, b, log=TRUE)),
+ msg = " rmath.dweibull")
+
+ f <- .rcpp.rmath$runit_pweibull
+ checkEquals(f(x, a, b),
+ c(pweibull(x, a, b, lower=TRUE, log=FALSE), pweibull(log(x), a, b, lower=TRUE, log=TRUE),
+ pweibull(x, a, b, lower=FALSE, log=FALSE), pweibull(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.pweibull")
+
+ x <- x/a
+ f <- .rcpp.rmath$runit_qweibull
+ checkEquals(f(x, a, b),
+ c(qweibull(x, a, b, lower=TRUE, log=FALSE), qweibull(log(x), a, b, lower=TRUE, log=TRUE),
+ qweibull(x, a, b, lower=FALSE, log=FALSE), qweibull(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.qweibull")
+}
+
+
+test.rmath.logis <- function() {
+ x <- 2
+ a <- 8
+ b <- 0.25
+ f <- .rcpp.rmath$runit_dlogis
+ checkEquals(f(x, a, b),
+ c(dlogis(x, a, b, log=FALSE), dlogis(x, a, b, log=TRUE)),
+ msg = " rmath.dlogis")
+
+ f <- .rcpp.rmath$runit_plogis
+ checkEquals(f(x, a, b),
+ c(plogis(x, a, b, lower=TRUE, log=FALSE), plogis(log(x), a, b, lower=TRUE, log=TRUE),
+ plogis(x, a, b, lower=FALSE, log=FALSE), plogis(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.plogis")
+
+ x <- x/a
+ f <- .rcpp.rmath$runit_qlogis
+ checkEquals(f(x, a, b),
+ c(qlogis(x, a, b, lower=TRUE, log=FALSE), qlogis(log(x), a, b, lower=TRUE, log=TRUE),
+ qlogis(x, a, b, lower=FALSE, log=FALSE), qlogis(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.qlogis")
+}
+
+
+test.rmath.nbeta <- function() {
+ x <- 5
+ a <- 10
+ b <- 7
+ c <- 8
+ f <- .rcpp.rmath$runit_dnbeta
+ checkEquals(f(x, a, b, c),
+ c(dbeta(x, a, b, c, log=FALSE), dbeta(x, a, b, c, log=TRUE)),
+ msg = " rmath.dnbeta")
+
+ f <- .rcpp.rmath$runit_pnbeta
+ checkEquals(f(x, a, b, c),
+ c(pbeta(x, a, b, c, lower=TRUE, log=FALSE), pbeta(log(x), a, b, c, lower=TRUE, log=TRUE),
+ pbeta(x, a, b, c, lower=FALSE, log=FALSE), pbeta(log(x), a, b, c, lower=FALSE, log=TRUE)),
+ msg = " rmath.pnbeta")
+
+ x <- x/a
+ f <- .rcpp.rmath$runit_qnbeta
+ checkEquals(f(x, a, b, c),
+ c(qbeta(x, a, b, c, lower=TRUE, log=FALSE), qbeta(log(x), a, b, c, lower=TRUE, log=TRUE),
+ qbeta(x, a, b, c, lower=FALSE, log=FALSE), qbeta(log(x), a, b, c, lower=FALSE, log=TRUE)),
+ msg = " rmath.qnbeta")
+}
+
+
+test.rmath.nf <- function() {
+ x <- 5
+ a <- 10
+ b <- 7
+ c <- 8
+ f <- .rcpp.rmath$runit_dnf
+ checkEquals(f(x, a, b, c),
+ c(df(x, a, b, c, log=FALSE), df(x, a, b, c, log=TRUE)),
+ msg = " rmath.dnf")
+
+ f <- .rcpp.rmath$runit_pnf
+ checkEquals(f(x, a, b, c),
+ c(pf(x, a, b, c, lower=TRUE, log=FALSE), pf(log(x), a, b, c, lower=TRUE, log=TRUE),
+ pf(x, a, b, c, lower=FALSE, log=FALSE), pf(log(x), a, b, c, lower=FALSE, log=TRUE)),
+ msg = " rmath.pnf")
+
+ x <- x/a
+ f <- .rcpp.rmath$runit_qnf
+ checkEquals(f(x, a, b, c),
+ c(qf(x, a, b, c, lower=TRUE, log=FALSE), qf(log(x), a, b, c, lower=TRUE, log=TRUE),
+ qf(x, a, b, c, lower=FALSE, log=FALSE), qf(log(x), a, b, c, lower=FALSE, log=TRUE)),
+ msg = " rmath.qnf")
+}
+
+test.rmath.nt <- function() {
+ x <- 5
+ a <- 10
+ b <- 7
+ f <- .rcpp.rmath$runit_dnt
+ checkEquals(f(x, a, b),
+ c(dt(x, a, b, log=FALSE), dt(x, a, b, log=TRUE)),
+ msg = " rmath.dnt")
+
+ f <- .rcpp.rmath$runit_pnt
+ checkEquals(f(x, a, b),
+ c(pt(x, a, b, lower=TRUE, log=FALSE), pt(log(x), a, b, lower=TRUE, log=TRUE),
+ pt(x, a, b, lower=FALSE, log=FALSE), pt(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.pnt")
+
+ x <- x/a
+ f <- .rcpp.rmath$runit_qnt
+ checkEquals(f(x, a, b),
+ c(qt(x, a, b, lower=TRUE, log=FALSE), qt(log(x), a, b, lower=TRUE, log=TRUE),
+ qt(x, a, b, lower=FALSE, log=FALSE), qt(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.qnt")
+}
+
+test.rmath.wilcox <- function() {
+ x <- 2
+ a <- 4
+ b <- 6
+ f <- .rcpp.rmath$runit_dwilcox
+ checkEquals(f(x, a, b),
+ c(dwilcox(x, a, b, log=FALSE), dwilcox(x, a, b, log=TRUE)),
+ msg = " rmath.dwilcox")
+
+ f <- .rcpp.rmath$runit_pwilcox
+ checkEquals(f(x, a, b),
+ c(pwilcox(x, a, b, lower=TRUE, log=FALSE), pwilcox(log(x), a, b, lower=TRUE, log=TRUE),
+ pwilcox(x, a, b, lower=FALSE, log=FALSE), pwilcox(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.pwilcox")
+
+ x <- x/a
+ f <- .rcpp.rmath$runit_qwilcox
+ checkEquals(f(x, a, b),
+ c(qwilcox(x, a, b, lower=TRUE, log=FALSE), qwilcox(log(x), a, b, lower=TRUE, log=TRUE),
+ qwilcox(x, a, b, lower=FALSE, log=FALSE), qwilcox(log(x), a, b, lower=FALSE, log=TRUE)),
+ msg = " rmath.qwilcox")
+}
+
+
+
+}
+
+
+
More information about the Rcpp-commits
mailing list