The Rate Stabilizing Tool R Package (RSTr): Gibbs Samplers for Bayesian Spatiotemporal CAR Models
The RSTr package is a tool that uses Bayesian spatiotemporal models in conjunction with C++ to help you quickly and easily generate spatially smoothed estimates for your spatiotemporal small area data. For the ArcGIS Plugin, visit the RST ArcGIS Plugin webpage.
To install the RSTr package, a few dependent packages are needed first. RSTr depends on the following:
- Rcpp: Rcpp is a package that allows integration of C++ code into R.
- RcppArmadillo: This is an addon for Rcpp that facilitates matrix and array manipulation.
- RcppDist: This is an addon for Rcpp that allows the generation of values for specialized distributions.
- abind: A package designed to combine multidimensional arrays. Necessary for the concatenation of large arrays when gathering samples.
- knitr: Allows for creation of package vignettes.
- RTools (Windows Only): C++ compiler for R. Necessary for Rcpp and its dependencies. Only necessary on Windows devices, as Linux and Mac devices have native C++ compilers.
From the R console, make sure that all the necessary dependencies are installed by running the following lines:
# Install dependent packages
install.packages(c("Rcpp", "RcppArmadillo", "RcppDist", "abind", "knitr"))
# Install RTools
install.packages("installr") # Optional for Windows users. RTools can also be downloaded and installed manually from the above URL.
installr::install.Rtools()
Then, the package can be installed from GitHub:
install.packages("remotes") # Optional if you already have an R package which can install from GitHub
remotes::install_github("CDCgov/RSTr", build_vignettes = TRUE)
If this is your first time using the RSTr package, check the introductory vignette to learn how to use the package:
vignette("RSTr")
To update RSTr, remove the package from R, restart R, and re-install from GitHub:
remove.packages("RSTr")
# Restart R to allow package installation
remotes::install_github("CDCgov/RSTr", build_vignettes = TRUE)
Thanks for checking out the RSTr package. I hope you find it useful in your spatiotemporal modeling! Please feel free to give feedback on bugs, ways to make the package more accessible to use, and features you'd like to see added to the package.