Skip to content

Commit

Permalink
Get package ready for release 1.2.4 (#393)
Browse files Browse the repository at this point in the history
* Updated cran comments for release 1.2.4
* Fixed several typos throughout documentation
* Included references in package description
  • Loading branch information
gowerc authored Sep 19, 2023
1 parent bd409c6 commit 91f070c
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 53 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/check_for_cran.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ jobs:
fail-fast: true
matrix:
config:
- { R: "devel", os: "ubuntu-20.04"}
- { R: "devel", os: "ubuntu-latest"}
- { R: "release", os: "macos-latest"}
- { R: "release", os: "windows-latest"}
- { R: "release", os: "ubuntu-20.04"}
- { R: "release", os: "ubuntu-latest"}

runs-on: ${{ matrix.config.os }}

Expand Down
9 changes: 7 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
Package: rbmi
Title: Reference Based Multiple Imputation
Version: 1.2.3
Version: 1.2.4
Authors@R: c(
person("Craig", "Gower-Page", email = "[email protected]", role = c("aut", "cre")),
person("Alessandro", "Noci", email = "[email protected]", role = c("aut")),
person("Marcel", "Wolbers", email = "[email protected]", role = "ctb"),
person("Roche", role = c("cph", "fnd"))
)
Description: Implements reference based multiple imputation allowing for the imputation of longitudinal datasets using predefined strategies.
Description: Implements standard and reference based multiple imputation methods for continuous
longitudinal endpoints (Gower-Page et al. (2022) <doi:10.21105/joss.04251>). In particular, rbmi
supports deterministic conditional mean imputation and jackknifing as described in Wolbers et al.
(2022) <doi:10.1002/pst.2234>, Bayesian multiple imputation as described in Carpenter et al. (2013)
<doi:10.1080/10543406.2013.834911>, and bootstrapped maximum likelihood imputation as described in
von Hippel and Bartlett (2021) <doi: 10.1214/20-STS793>.
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
Expand Down
7 changes: 5 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# rbmi (development version)
# rbmi 1.2.4

* Updated internal Stan code to ensure future compatibility (@andrjohns, #390)
* Updated package description to include relevant references (#393)
* Fixed documentation typos (#393)

* Updated internal Stan code to ensure future compatibility (Thank you @andrjohns)

# rbmi 1.2.3

Expand Down
10 changes: 5 additions & 5 deletions R/draws.R
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ draws.bmlmi <- function(data, data_ice = NULL, vars, method, ncores = 1, quiet =
#' the subject ids from the original dataset are returned. These values are used to tell [impute()]
#' what subjects should be used to derive the imputed dataset.
#' @param failure_limit Number of failed samples that are allowed before throwing an error
#' @param ncores Number of processes to parallise the job over
#' @param ncores Number of processes to parallelise the job over
#' @param quiet Logical, If `TRUE` will suppress printing of progress information that is printed to
#' the console.
#'
Expand Down Expand Up @@ -695,10 +695,10 @@ validate.draws <- function(x, ...) {
#'
#' @description
#'
#' Object is initalised with total number of iterations that are expected to occour.
#' Object is initalised with total number of iterations that are expected to occur.
#' User can then update the object with the `add` method to indicate how many more iterations
#' have just occoured.
#' Every time `step` * 100 % of iterations have occured a message is printed to the console.
#' have just occurred.
#' Every time `step` * 100 % of iterations have occurred a message is printed to the console.
#' Use the `quiet` argument to prevent the object from printing anything at all
#'
#' @import R6
Expand Down Expand Up @@ -739,7 +739,7 @@ progressLogger <- R6::R6Class(
#' this will add that number to the current step count (`step_current`) and will
#' print a progress message to the log if the step limit (`step`) has been reached.
#' This function will do nothing if `quiet` has been set to `TRUE`
#' @param n the number of sucessfully complete iterations since `add()` was last called
#' @param n the number of successfully complete iterations since `add()` was last called
add = function(n) {
if (self$quiet) {
return(invisible())
Expand Down
4 changes: 2 additions & 2 deletions R/longData.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ longDataConstructor <- R6::R6Class(
#' This list is defaulted to TRUE for all subjects & outcomes and is then
#' modified by calls to `self$set_strategies()`.
#' Note that this does not indicate which values are missing, this variable
#' is True for outcome values that either occoured before the ICE visit
#' is True for outcome values that either occurred before the ICE visit
#' or are post the ICE visit and have an imputation strategy of MAR
is_mar = list(),

Expand Down Expand Up @@ -475,7 +475,7 @@ longDataConstructor <- R6::R6Class(
assert_that(
identical(names(x), self$visits),
msg = paste(
"An unexpected error has occoured in check_has_data_at_each_visit()",
"An unexpected error has occurred in check_has_data_at_each_visit()",
"please report this to the developer"
)
)
Expand Down
8 changes: 4 additions & 4 deletions R/lsmeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#' categorical covariate and by setting any numerical covariates equal
#' to the mean.
#'
#' A final lsmean value is calculating by averaging these hypothetical
#' A final lsmean value is calculated by averaging these hypothetical
#' patients. If `.weights` equals `"proportional"` then the values are weighted
#' by the frequency in which they occour in the full dataset. If `.weights`
#' by the frequency in which they occur in the full dataset. If `.weights`
#' equals `"equal"` then each hypothetical patient is given an equal weight
#' regardless of what actually occours in the dataset.
#' regardless of what actually occurs in the dataset.
#'
#' Use the `...` argument to fix specific variables to specific values.
#'
Expand Down Expand Up @@ -83,7 +83,7 @@ lsmeans <- function(model, ..., .weights = c("proportional", "equal")) {
#' and standard error. `ls_design_equal` calculates it by
#' applying an equal weight per covariate combination whilst
#' `ls_design_proportional` applies weighting proportional
#' to the frequency in which the covariate combination occoured
#' to the frequency in which the covariate combination occurred
#' in the actual dataset.
#'
#' @param data A data.frame
Expand Down
4 changes: 2 additions & 2 deletions R/mmrm.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ extract_params <- function(fit) {
#' @param outcome a numeric vector. The outcome value to be regressed on in the MMRM model.
#' @param subjid a character / factor vector. The subject identifier used to link separate visits
#' that belong to the same subject.
#' @param visit a character / factor vector. Indicates which visit the outcome value occoured on.
#' @param visit a character / factor vector. Indicates which visit the outcome value occurred on.
#' @param group a character / factor vector. Indicates which treatment group the patient belongs to.
#' @param cov_struct a character value. Specifies which covariance structure to use. Must be one of
#' `"us"`, `"toep"`, `"cs"` or `"ar1"`
Expand Down Expand Up @@ -237,7 +237,7 @@ fit_mmrm <- function(designmat,
#' This function was originally developed for use with glmmTMB which needed
#' more hand-holding and dropping of false-positive warnings. It is not
#' as important now but is kept around encase we need to catch
#' false-postive warnings again in the future.
#' false-positive warnings again in the future.
#'
#' @examples
#' \dontrun{
Expand Down
2 changes: 1 addition & 1 deletion R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ as_dataframe <- function(x) {

#' Do not run this function
#'
#' This function only exists to supress the false positive
#' This function only exists to suppress the false positive
#' from R CMD Check about unused libraries
#'
#' Both rstantools and RcppParallel are required but are only used at
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<!-- badges: start -->
[![R-CMD-check](https://github.com/insightsengineering/rbmi/workflows/R-CMD-check/badge.svg)](https://github.com/insightsengineering/rbmi/actions)
[![CRAN
status](https://www.r-pkg.org/badges/version/rbmi)](https://cran.r-project.org/package=rbmi)
[![R-CMD-check](https://github.com/insightsengineering/rbmi/actions/workflows/on_push.yaml/badge.svg?branch=main)](https://github.com/insightsengineering/rbmi/actions/workflows/on_push.yaml)
<!-- badges: end -->


Expand Down
24 changes: 11 additions & 13 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
## Summary of Submission

This is a re-submission to ensure that our unit tests do not fail on CRANs servers.
The original uploads notes are as follows:

In this version I have:

* Replaced our dependencies from glmmTMB to mmrm to improve package performance and stability
* Upgraded our use of parallel processes to be more reliable in testing environments
* Updated our Stan syntax to ensure future compatibility
* Updated our package description to contain relevant references
* Fixed several typos in our documentation

## R CMD check results

Expand All @@ -15,9 +13,9 @@ There were no ERRORs or WARNINGs.
There were 2 NOTEs:

❯ checking installed package size ... NOTE
installed size is 57.4Mb
sub-directories of 1Mb or more:
libs 56.0Mb
installed size is 55.6Mb
sub-directories of 1Mb or more:
libs 54.3Mb

- This is a consequence of using Rstan which produces quite large binaries when compiled. As far as I'm aware there is no way for us to reduce this and is dependent on the Stan development team. Our understanding from the [developers](https://discourse.mc-stan.org/t/using-rstan-in-an-r-package-generates-r-cmd-check-notes/26628) is that this is acceptable to ignore.

Expand All @@ -33,11 +31,11 @@ There were 2 NOTEs:

The package was tested in the following environments:

- Ubuntu 20.04, R release (GitHub Actions)
- Windows latest, R release (Local Machine)
- Mac OS latest, R release (Local Machine + GitHub Actions)
- Ubuntu 20.04, R devel (GitHub Actions)

- Ubuntu, R release (GitHub Actions)
- Windows, R release (Local Machine + Rhub + Win-Builder)
- MacOS, R release (Local Machine + GitHub Actions)
- Ubuntu, R devel (GitHub Actions)
- Fedora, R devel (Rhub)

## Downstream dependencies

Expand Down
2 changes: 1 addition & 1 deletion man/as_mmrm_df.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/do_not_run.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/eval_mmrm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/fit_mmrm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_draws_mle.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/longDataConstructor.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/ls_design.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/lsmeans.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/progressLogger.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-draws.R
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ test_that("draws.bmlmi works as expected", {



test_that("quiet supress progress messages", {
test_that("quiet suppress progress messages", {

bign <- 90
sigma <- as_vcov(
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-mcmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ test_that("split_dim creates a list from an array as expected", {



test_that("Verbose supression works", {
test_that("Verbose suppression works", {

set.seed(301)
sigma <- as_vcov(c(6, 4, 4), c(0.5, 0.2, 0.3))
Expand Down
2 changes: 1 addition & 1 deletion vignettes/stat_specs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ Conditional mean imputation combined with the jackknife is the only method which
Bayesian MI methods rely on the specification of prior distributions and the usage of Markov chain Monte Carlo (MCMC) methods.
All other methods based on multiple imputation or bootstrapping require no other tuning parameters than the specification of the number of imputations $M$ or bootstrap samples $B$ and rely on numerical optimization for fitting the MMRM imputation models via REML. Conditional mean imputation combined with the jackknife has no tuning parameters.

In our `rbmi` implementation, the fitting of the MMRM imputation model via REML is computationally most expensive. MCMC sampling using `rstan` (@Rstan) is typically relatively fast in our setting and requires only a small burn-in and burn-between of the chains. In addition, the number of random imputations for reliable inference using Rubin's rules is often smaller than the number of resamples required for the jackknife or the bootstrap (see e.g. the discussions in @White2011multiple[Section 7] for Bayesian MI and the Appendix of @Wolbers2021 for the bootstrap). Thus, for many applications, we expect that conventional MI based on Bayesian posterior draws will be fastest, followed by conventional MI using approximate Bayesian posterior draws and conditional mean imputation combined with the jackknife. Conditional mean imputation combined with the bootstrap and bootstrapped MI methods will typically be most computationally demanding. Of note, all implemented methods are conceptually straightforward to parallelize and some parallelization support is provided by `rbmi`.
In our `rbmi` implementation, the fitting of the MMRM imputation model via REML is computationally most expensive. MCMC sampling using `rstan` (@Rstan) is typically relatively fast in our setting and requires only a small burn-in and burn-between of the chains. In addition, the number of random imputations for reliable inference using Rubin's rules is often smaller than the number of resamples required for the jackknife or the bootstrap (see e.g. the discussions in @White2011multiple[Section 7] for Bayesian MI and the Appendix of @Wolbers2021 for the bootstrap). Thus, for many applications, we expect that conventional MI based on Bayesian posterior draws will be fastest, followed by conventional MI using approximate Bayesian posterior draws and conditional mean imputation combined with the jackknife. Conditional mean imputation combined with the bootstrap and bootstrapped MI methods will typically be most computationally demanding. Of note, all implemented methods are conceptually straightforward to parallelise and some parallelisation support is provided by `rbmi`.

# Mapping of statistical methods to `rbmi` functions {#sec:rbmiFunctions}

Expand Down
Loading

0 comments on commit 91f070c

Please sign in to comment.