diff --git a/.Rbuildignore b/.Rbuildignore index 0f8cee0..05cdf89 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,3 +7,4 @@ ^docs$ ^pkgdown$ ^cran-comments\.md$ +^CRAN-SUBMISSION$ diff --git a/.aspell/pg.rds b/.aspell/pg.rds index 84c0c9d..d32bd54 100644 Binary files a/.aspell/pg.rds and b/.aspell/pg.rds differ diff --git a/.aspell/words.pws b/.aspell/words.pws index 6dc99a3..058bc37 100644 --- a/.aspell/words.pws +++ b/.aspell/words.pws @@ -1,6 +1,7 @@ -personal_ws-1.1 en 5 UTF-8 +personal_ws-1.1 en 6 UTF-8 Balamuta PG -Polya-Gamma Polya +Gamma performant +Polson diff --git a/DESCRIPTION b/DESCRIPTION index 69b3289..64543ad 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: pg -Title: Pólya-Gamma Distribution Sampler +Title: Polya Gamma Distribution Sampler Version: 0.2.4 Authors@R: c( @@ -10,9 +10,11 @@ Authors@R: email = "balamut2@illinois.edu" ) ) -Description: Provides access to a high performant random distribution - sampler for the Pólya-Gamma Distribution using either 'C++' headers for - 'Rcpp' or 'RcppArmadillo' and 'R'. +Description: Provides access to a series of highly performant random distribution + samplers for the Polya Gamma Distribution as described by + Polson, Scott, and Windle (2013) using either 'C++' headers + for 'Rcpp' or 'RcppArmadillo' and 'R'. The 'C++' header approach was developed + to enable computations in Balamuta (2021) . URL: https://tmsalab.github.io/pg/, https://github.com/tmsalab/pg BugReports: https://github.com/tmsalab/pg/issues License: GPL (>= 3) diff --git a/R/RcppExports.R b/R/RcppExports.R index e7c54bc..7393db2 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,9 +1,9 @@ # Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 -#' Sample from the Pólya-Gamma distribution PG(h, z) +#' Sample from the Polya Gamma distribution PG(h, z) #' -#' Chooses the most efficient implemented method to sample from a Pólya-Gamma +#' Chooses the most efficient implemented method to sample from a Polya Gamma #' distribution. Details on algorithm selection presented below. #' #' @param n The number of samples to taken from a PG(h, z). Used only by diff --git a/R/pg_theoretical.R b/R/pg_theoretical.R index 9de66c7..3df0de4 100644 --- a/R/pg_theoretical.R +++ b/R/pg_theoretical.R @@ -1,12 +1,12 @@ -#' Theoretical Polya-Gamma Distribution's Mean and Variance +#' Theoretical Polya Gamma Distribution's Mean and Variance #' -#' Compute the theoretical mean and variance for a Polya-Gamma variable. +#' Compute the theoretical mean and variance for a Polya Gamma variable. #' #' @param h A single `integer` value corresponding to the "shape" parameter. #' @param z A single `numeric` value corresponding to the "scale" parameter. #' #' @return -#' Either the theoretical mean or theoretical variance for a Polya-Gamma +#' Either the theoretical mean or theoretical variance for a Polya Gamma #' distribution. #' #' @export diff --git a/README.Rmd b/README.Rmd index 943f3be..82656e7 100644 --- a/README.Rmd +++ b/README.Rmd @@ -20,7 +20,7 @@ knitr::opts_chunk$set( [![Package-License](http://img.shields.io/badge/license-GPL%20(%3E=3)-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-3.0.html) -The goal of pg is to provide both _R_ and _C++_ header access to the Pólya-Gamma +The goal of pg is to provide both _R_ and _C++_ header access to the Polya Gamma distribution sampling routine. ## Installation @@ -35,7 +35,7 @@ devtools::install_github("tmsalab/pg") ## Usage -Let `X` be a Pólya-Gamma Distribution denoted by `PG(h, z)`, where `h` is the +Let `X` be a Polya Gamma Distribution denoted by `PG(h, z)`, where `h` is the "shape" parameter and `z` is the "scale" parameter. Presently, the following sampling cases are enabled: @@ -118,16 +118,16 @@ pg::rpg_vector(n, h, z) ## See also -The following are useful resources regarding the Pólya-Gamma distribution. +The following are useful resources regarding the Polya Gamma distribution. - Papers - "Bayesian Inference for Logistic Models Using Pólya–Gamma Latent Variables" by Nicholas G. Polson, James G. Scott, and Jesse Windle (2013) - [doi:10.1080/01621459.2013.829001](https://doi.org/10.1080/01621459.2013.829001). Paper that invented the Pólya-Gamma - - "Sampling Pólya-Gamma random variates: alternate and approximate techniques" + [doi:10.1080/01621459.2013.829001](https://doi.org/10.1080/01621459.2013.829001). Paper that invented the Polya Gamma + - "Sampling Polya Gamma random variates: alternate and approximate techniques" by Jesse Windle, Nicholas G. Polson, and James G. Scott (2014) . Provides an efficiency overview of the - different sampling approaches to sampling from a Pólya-Gamma distribution. + different sampling approaches to sampling from a Polya Gamma distribution. - R Implementations: - [`BayesLogit`](https://cran.r-project.org/package=BayesLogit) _R_ package by Nicholas G. Polson, James G. Scott, and Jesse Windle. Provides the @@ -142,7 +142,7 @@ The following are useful resources regarding the Pólya-Gamma distribution. - Support in other languages: - `Python` has the [`pypolyagamma`](https://github.com/slinderman/pypolyagamma) package by Scott Linderman. - - `Stan` [lacks an implementation](https://discourse.mc-stan.org/t/sampling-from-a-polya-gamma-distribution/8067) for the Pólya-Gamma distribution since it relies on joint proposals + - `Stan` [lacks an implementation](https://discourse.mc-stan.org/t/sampling-from-a-polya-gamma-distribution/8067) for the Polya Gamma distribution since it relies on joint proposals rather than full conditionals. ## Author diff --git a/README.md b/README.md index ef5e2b5..d91ccc6 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The goal of pg is to provide both *R* and *C++* header access to the -Pólya-Gamma distribution sampling routine. +Polya Gamma distribution sampling routine. ## Installation @@ -24,7 +24,7 @@ devtools::install_github("tmsalab/pg") ## Usage -Let `X` be a Pólya-Gamma Distribution denoted by `PG(h, z)`, where `h` +Let `X` be a Polya Gamma Distribution denoted by `PG(h, z)`, where `h` is the “shape” parameter and `z` is the “scale” parameter. Presently, the following sampling cases are enabled: @@ -111,7 +111,7 @@ pg::rpg_vector(n, h, z) ## See also -The following are useful resources regarding the Pólya-Gamma +The following are useful resources regarding the Polya Gamma distribution. - Papers @@ -119,12 +119,12 @@ distribution. Variables” by Nicholas G. Polson, James G. Scott, and Jesse Windle (2013) [doi:10.1080/01621459.2013.829001](https://doi.org/10.1080/01621459.2013.829001). - Paper that invented the Pólya-Gamma - - “Sampling Pólya-Gamma random variates: alternate and approximate + Paper that invented the Polya Gamma + - “Sampling Polya Gamma random variates: alternate and approximate techniques” by Jesse Windle, Nicholas G. Polson, and James G. Scott (2014) . Provides an efficiency overview of the different sampling approaches to sampling - from a Pólya-Gamma distribution. + from a Polya Gamma distribution. - R Implementations: - [`BayesLogit`](https://cran.r-project.org/package=BayesLogit) *R* package by Nicholas G. Polson, James G. Scott, and Jesse Windle. @@ -143,7 +143,7 @@ distribution. by Scott Linderman. - `Stan` [lacks an implementation](https://discourse.mc-stan.org/t/sampling-from-a-polya-gamma-distribution/8067) - for the Pólya-Gamma distribution since it relies on joint proposals + for the Polya Gamma distribution since it relies on joint proposals rather than full conditionals. ## Author diff --git a/data-raw/custom-dictionary.R b/data-raw/custom-dictionary.R index bbc5568..fe7f31b 100644 --- a/data-raw/custom-dictionary.R +++ b/data-raw/custom-dictionary.R @@ -34,9 +34,10 @@ author = c( ) other = c( "PG", - "Polya-Gamma", "Polya", - "performant" + "Gamma", + "performant", + "Polson" ) custom_words = c(author, other) diff --git a/inst/WORDLIST b/inst/WORDLIST index 0d2ca28..1d1e604 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,5 +1,6 @@ Balamuta PG -Polya-Gamma Polya +Gamma performant +Polson diff --git a/man/pg-package.Rd b/man/pg-package.Rd index 4ff4907..6e3060b 100644 --- a/man/pg-package.Rd +++ b/man/pg-package.Rd @@ -4,9 +4,9 @@ \name{pg-package} \alias{pg} \alias{pg-package} -\title{pg: Pólya-Gamma Distribution Sampler} +\title{pg: Polya Gamma Distribution Sampler} \description{ -Provides access to a high performant random distribution sampler for the Pólya-Gamma Distribution using either 'C++' headers for 'Rcpp' or 'RcppArmadillo' and 'R'. +Provides access to a series of highly performant random distribution samplers for the Polya Gamma Distribution as described by Polson, Scott, and Windle (2013) \href{https://arxiv.org/abs/1205.0310}{arXiv:1205.0310} using either 'C++' headers for 'Rcpp' or 'RcppArmadillo' and 'R'. The 'C++' header approach was developed to enable computations in Balamuta (2021) \url{https://www.ideals.illinois.edu/items/121209}. } \seealso{ Useful links: diff --git a/man/rpg-sampler.Rd b/man/rpg-sampler.Rd index ebfb455..1f2a766 100644 --- a/man/rpg-sampler.Rd +++ b/man/rpg-sampler.Rd @@ -8,7 +8,7 @@ \alias{rpg_devroye} \alias{rpg_sp} \alias{rpg_normal} -\title{Sample from the Pólya-Gamma distribution PG(h, z)} +\title{Sample from the Polya Gamma distribution PG(h, z)} \usage{ rpg_scalar(h, z) @@ -38,7 +38,7 @@ the vector sampler.} A single \code{numeric} value. } \description{ -Chooses the most efficient implemented method to sample from a Pólya-Gamma +Chooses the most efficient implemented method to sample from a Polya Gamma distribution. Details on algorithm selection presented below. } \details{ diff --git a/man/theoretical-pg.Rd b/man/theoretical-pg.Rd index f784255..76127f3 100644 --- a/man/theoretical-pg.Rd +++ b/man/theoretical-pg.Rd @@ -3,7 +3,7 @@ \name{pg_mean} \alias{pg_mean} \alias{pg_var} -\title{Theoretical Polya-Gamma Distribution's Mean and Variance} +\title{Theoretical Polya Gamma Distribution's Mean and Variance} \usage{ pg_mean(h, z) @@ -15,11 +15,11 @@ pg_var(h, z) \item{z}{A single \code{numeric} value corresponding to the "scale" parameter.} } \value{ -Either the theoretical mean or theoretical variance for a Polya-Gamma +Either the theoretical mean or theoretical variance for a Polya Gamma distribution. } \description{ -Compute the theoretical mean and variance for a Polya-Gamma variable. +Compute the theoretical mean and variance for a Polya Gamma variable. } \examples{ # Fixed parameter distribution simulation ---- diff --git a/src/rpg.cpp b/src/rpg.cpp index ed24e73..060d6b9 100644 --- a/src/rpg.cpp +++ b/src/rpg.cpp @@ -1,8 +1,8 @@ #include "pg.h" -//' Sample from the Pólya-Gamma distribution PG(h, z) +//' Sample from the Polya Gamma distribution PG(h, z) //' -//' Chooses the most efficient implemented method to sample from a Pólya-Gamma +//' Chooses the most efficient implemented method to sample from a Polya Gamma //' distribution. Details on algorithm selection presented below. //' //' @param n The number of samples to taken from a PG(h, z). Used only by