We welcome contributions and want to work closely with collaborators to ensure that ciTools is high quality statistical software. To that end, we have compiled a list of tips to help you write R functions that fit into our existing system.
- Make use of S3 methods. Each of the functions
add_{ci, pi, probs, quantile}
is a generic that always acceptsdf
as the first argument andfit
as the second argument. - Each method (and functions pertaining directly to that method) belongs in a separate file.
- Use existing interval estimation functions -- there is no reason to duplicate this effort. For example, addci.lm is just a wrapper around
predict.lm
. - But think twice before adding a dependency and keep the number of dependencies to a minimum. Only rely on other packages that are well trusted in the R ecosystem. Consider adding new dependencies to the "Enhances:" line of the DESCRIPTION file instead of the "Imports:" line.
- It's okay if you can only write one of the functions for a new method. Generally, writing
add_ci
will be different thanadd_pi
, but ifadd_pi
can be written and implemented, thenadd_quantile
andadd_probs
should follow without too much effort. - Use Roxygen to create documentation for your functions.
- You must have a GPL3 blurb at the top of each file that assigns copyright to Institute for Defense Analyses.
- Functions that are not generics or methods belong in a separate file such as the
helper_functions.R
file. - Don't submit your work until it is passing
devtools::check()
without any notes. - If you are writing a new method, you will need to justify your work so the maintainers can understand how the interval estimates are formed and, if there are multiple interval types included, why one of them should be the default type. The best way to accomplish this is by writing good documentation and a vignette that shows how to use your new methods in an analysis.
- If you have a novel solution to an interval estimates problem, you will need to prepare a simulation study that addresses coverage probabilities and interval widths. See the vignette on Linear Mixed Models for an example of this.
- If your solutions are well studied, include citations.