Testing Packages

From MCMCpack

Jump to: navigation, search

Stephen Haptonstahl and Jong-Hee Park are developing a test suite for MCMCpack. The purpose of this page is to:

  • Document some of the concepts or key code features we are using
  • Provide guidance for others trying to test packages

Contents

[edit] testMCMCpack package

A detailed description of testMCMCpack is in the MCMCpack specification. This package is for the use of developers of MCMCpack and is stored in the MCMCpack subverison repository.

[edit] How to Add an MCMC function to testMCMCpack

(coming soon)

[edit] How to Compile this (or any) R Package for Windows

(coming soon)

[edit] testMCMCpack TODO List

  • Abstract the plotting of z-score graphs
  • Incorporate feedback on v0.1 to complete v0.2
  • Neaten the output of the omnibus function testMCMCpack()
    • Suppress "Metropolis" output and all screen printing using R option
    • Display results in a table
  • Update this wiki (of course!)
  • Include a nice heading to be shown when people load testMCMCpack
  • Look over BayesValidate and link it to testMCMCpack if useful
    • Think about the possibility of generalizing testMCMCpack to other Bayesian R packages

[edit] R Features for Testing: not a solution to this problem

R has a very simple way to run a custom test suite automatically when running R CMD check. Unfortunately, our test suite takes a long time to run. Running the beta-version of the test on just MCMClogit took four hours on a dual-processor Xeon. Running all of these tests every time we want to be sure MCMCpack passes R CMD check would not be practical.

However, the features R has to include testing are simple and pretty powerful. Just create a tests folder in the root folder of the package source. Any file with a .R extension, say testFoo.R, in tests will be run automatically. The output is sent to testFoo.Rout in the tests/ folder where the results of R CMD che are saved. Then you can look at the results.

Even better, take a copy of testFoo.Rout that looks good and put it back into the (package root)/tests/ folder with the source (the same folder as testFoo.R. Rename it testFoo.Rout.save. Now, running R CMD check will diff the newly generated testFoo.Rout and the existing testFoo.Rout.save. This means it will compare them line-by-line and display any differences between them.

If you write testFoo.R well, this can be a great tool. We might use it for switch-flipping tests, but testing the posterior distributions takes too long to do this with every R CMD check.

Personal tools