[Rcpp-commits] r3342 - in pkg/Rcpp: . inst inst/include/Rcpp/stats inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Nov 13 20:05:49 CET 2011
Author: edd
Date: 2011-11-13 20:05:49 +0100 (Sun, 13 Nov 2011)
New Revision: 3342
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/inst/NEWS
pkg/Rcpp/inst/include/Rcpp/stats/f.h
pkg/Rcpp/inst/unitTests/runit.stats.R
Log:
minor bug fix in f.h to no require setting of ncp argument
new unit test for pf() to complement one for pnf()
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2011-11-13 18:45:37 UTC (rev 3341)
+++ pkg/Rcpp/ChangeLog 2011-11-13 19:05:49 UTC (rev 3342)
@@ -1,7 +1,9 @@
2011-11-13 Dirk Eddelbuettel <edd at debian.org>
- * inst/unitTests/runit.stats.R: Add unit test for pnf()
+ * inst/include/Rcpp/stats/f.h: Correct call to not require ncp parameter
+ * inst/unitTests/runit.stats.R: Add unit test for pf() and pnf()
+
2011-11-07 Romain Francois <romain at r-enthusiasts.com>
* include/Rcpp/internal/wrap.h: implemented wrap_dispatch_importer__impl
Modified: pkg/Rcpp/inst/NEWS
===================================================================
--- pkg/Rcpp/inst/NEWS 2011-11-13 18:45:37 UTC (rev 3341)
+++ pkg/Rcpp/inst/NEWS 2011-11-13 19:05:49 UTC (rev 3342)
@@ -8,7 +8,7 @@
of them. This work has been sponsored by the Google Open Source
Programs Office.
- o New unit test for pnf() (ie prob. function of a non-central F dist.)
+ o New unit test for pf() and pnf()
0.9.7 2011-09-29
Modified: pkg/Rcpp/inst/include/Rcpp/stats/f.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/stats/f.h 2011-11-13 18:45:37 UTC (rev 3341)
+++ pkg/Rcpp/inst/include/Rcpp/stats/f.h 2011-11-13 19:05:49 UTC (rev 3342)
@@ -22,7 +22,7 @@
#ifndef Rcpp__stats__f_h
#define Rcpp__stats__f_h
-RCPP_DPQ_3(f,::Rf_df,::Rf_pf,::Rf_qf)
+RCPP_DPQ_2(f,::Rf_df,::Rf_pf,::Rf_qf)
#endif
Modified: pkg/Rcpp/inst/unitTests/runit.stats.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.stats.R 2011-11-13 18:45:37 UTC (rev 3341)
+++ pkg/Rcpp/inst/unitTests/runit.stats.R 2011-11-13 19:05:49 UTC (rev 3342)
@@ -148,13 +148,24 @@
signature( x = "numeric" ),
'
NumericVector xx(x) ;
- return List::create(_["lowerNoLog"] = pnf( xx, 6.0, 8.0, 0.0, true ),
- _["lowerLog"] = pnf( xx, 6.0, 8.0, 0.0, true, true ),
- _["upperNoLog"] = pnf( xx, 6.0, 8.0, 0.0, false ),
- _["upperLog"] = pnf( xx, 6.0, 8.0, 0.0, false, true ));
+ return List::create(_["lowerNoLog"] = pnf( xx, 6.0, 8.0, 2.5, true ),
+ _["lowerLog"] = pnf( xx, 6.0, 8.0, 2.5, true, true ),
+ _["upperNoLog"] = pnf( xx, 6.0, 8.0, 2.5, false ),
+ _["upperLog"] = pnf( xx, 6.0, 8.0, 2.5, false, true ));
')
,
+ "runit_pf" = list(
+ signature( x = "numeric" ),
+ '
+ NumericVector xx(x) ;
+ return List::create(_["lowerNoLog"] = pf( xx, 6.0, 8.0 ),
+ _["lowerLog"] = pf( xx, 6.0, 8.0, true, true ),
+ _["upperNoLog"] = pf( xx, 6.0, 8.0, false ),
+ _["upperLog"] = pf( xx, 6.0, 8.0, false, true ));
+ ')
+
+ ,
"runit_pnorm" = list(signature( x = "numeric" ),
'
NumericVector xx(x) ;
@@ -383,8 +394,8 @@
# TODO: also borrow from R's d-p-q-r-tests.R
}
-test.stats.pnf <- function( ) {
- fx <- .rcpp.stats$runit_pnf
+test.stats.pf <- function( ) {
+ fx <- .rcpp.stats$runit_pf
v <- (1:9)/10
checkEquals(fx(v),
list(lowerNoLog = pf(v, 6, 8, lower=TRUE, log=FALSE),
@@ -395,6 +406,18 @@
msg = "stats.pf" )
}
+test.stats.pnf <- function( ) {
+ fx <- .rcpp.stats$runit_pnf
+ v <- (1:9)/10
+ checkEquals(fx(v),
+ list(lowerNoLog = pf(v, 6, 8, ncp=2.5, lower=TRUE, log=FALSE),
+ lowerLog = pf(v, 6, 8, ncp=2.5, log=TRUE ),
+ upperNoLog = pf(v, 6, 8, ncp=2.5, lower=FALSE),
+ upperLog = pf(v, 6, 8, ncp=2.5, lower=FALSE, log=TRUE)
+ ),
+ msg = "stats.pnf" )
+}
+
test.stats.pgamma <- function( ) {
fx <- .rcpp.stats$runit_pgamma
v <- (1:9)/10
More information about the Rcpp-commits
mailing list