Living analysis

Computationally extending the analysis.

Code reviewers

This section is for those considering helping out with this project.

The most important thing to check is that the code does what the manuscript says it does. Checking each target in the _targets.R file filters to things expected and so forth.

In this process, adding comments to the code of what your understanding of what it does is very useful. Adding to the documentation of the functions would also be very helpful. Another thing to consider is renaming the targets so that the pipeline conveys the analysis steps clearer.

Code reviewers may have ideas about the site structure and documentation, as well.

Most importantly, two questions need to be assessed:

  1. Do the visualisations answer the questions they are meant to answer?
  2. And, are the other analyses that need to be included?

Finally, don’t forget to update the DESCRIPTION file with your ORCID as a contributor.

Living data analysis

Code reviewers and other researchers may also wish to extend, that is, patch the script of this analysis. The rest of this document provides guidance on how to do that. A working version of R, and a willingess to learn a small set of functions, is all one needs to have in order to contribute to this analysis.

Ideally future studies are appended to the dataset so that it remains an up to date repository of all studies examining interventions for male infertility. A good example of a large-scale living analysis is Cochrane’s COVID-NMA, applying evidence synthesis to all COVID research as it comes out.

There may be a particular relevant skillset one has developed that would be a small effort but improve the analysis immensely.

GitHub

The usethis::pr_ functions are a blessing for this kind of thing. For getting your computer to talk to git, an invaluable resource (every time; every new computer) is Happy Git with R. Just a few functions to smooth the process of forking and contributing to a package. It does require an investment in reading the documentation for those few functions.

Issues are a great way of pooling knowledge. One person might have an idea for an extension, and another may know how to implement it quickly.

Reproducible environment with renv::

A frustration for analysts is often version conflicts between R packages. This analysis uses renv:: to snapshot the versions used for the code. The following function retrieves the correct versions of the packages.

renv::restore()

targets:: and tidyverse::

This analysis is implemented in tidverse:: script, and the analysis is structured as both a package and as a make-like pipeline.

library(targets) # for pipeline
library(tidyverse) # data science functions

Note, in particular, that circles are code blocks, and squares represent loops.

tar_visnetwork(
  # this first argument is only required for static output
  # https://github.com/ropensci/targets/discussions/819
  callr_arguments = list(spinner = FALSE), 
  targets_only = TRUE)
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
βœ” ggplot2 3.3.6     βœ” purrr   0.3.4
βœ” tibble  3.1.7     βœ” dplyr   1.0.9
βœ” tidyr   1.2.0     βœ” stringr 1.4.0
βœ” readr   2.1.2     βœ” forcats 0.5.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
βœ– dplyr::filter() masks stats::filter()
βœ– dplyr::lag()    masks stats::lag()
Loading required package: ggh4x

Attaching package: β€˜janitor’

The following objects are masked from β€˜package:stats’:

    chisq.test, fisher.test

For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores())

Attaching package: β€˜multinma’

The following objects are masked from β€˜package:stats’:

    dgamma, pgamma, qgamma

Loading required package: Matrix

Attaching package: β€˜Matrix’

The following objects are masked from β€˜package:tidyr’:

    expand, pack, unpack

Loading required package: metadat

Loading the 'metafor' package (version 3.4-0). For an
introduction to the package please type: help(metafor)

[conflicted] Will prefer dplyr::filter over any other package

Subsections of the pipeline can be viewed by name or by tidyverse:: selection tools. For example, the pipeline of head to head comparisons can be viewed thus.

tar_visnetwork(
  # this first argument is only required for static output
  callr_arguments = list(spinner = FALSE), 
  allow = starts_with("hth"))
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
βœ” ggplot2 3.3.6     βœ” purrr   0.3.4
βœ” tibble  3.1.7     βœ” dplyr   1.0.9
βœ” tidyr   1.2.0     βœ” stringr 1.4.0
βœ” readr   2.1.2     βœ” forcats 0.5.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
βœ– dplyr::filter() masks stats::filter()
βœ– dplyr::lag()    masks stats::lag()
Loading required package: ggh4x

Attaching package: β€˜janitor’

The following objects are masked from β€˜package:stats’:

    chisq.test, fisher.test

For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores())

Attaching package: β€˜multinma’

The following objects are masked from β€˜package:stats’:

    dgamma, pgamma, qgamma

Loading required package: Matrix

Attaching package: β€˜Matrix’

The following objects are masked from β€˜package:tidyr’:

    expand, pack, unpack

Loading required package: metadat

Loading the 'metafor' package (version 3.4-0). For an
introduction to the package please type: help(metafor)

[conflicted] Will prefer dplyr::filter over any other package

Implementing other models

Here is the pipeline for fitting the network meta-analysis models. Functions are documented using roxygen::2 and can be searched using R, for example ?smd_calc.

# fit dat and fit arms are the most relevant targets for the model implementation
tar_visnetwork(
  # this first argument is only required for static output
  callr_arguments = list(spinner = FALSE),
  names = c("fit_dat", "fit_arms"))
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
βœ” ggplot2 3.3.6     βœ” purrr   0.3.4
βœ” tibble  3.1.7     βœ” dplyr   1.0.9
βœ” tidyr   1.2.0     βœ” stringr 1.4.0
βœ” readr   2.1.2     βœ” forcats 0.5.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
βœ– dplyr::filter() masks stats::filter()
βœ– dplyr::lag()    masks stats::lag()
Loading required package: ggh4x

Attaching package: β€˜janitor’

The following objects are masked from β€˜package:stats’:

    chisq.test, fisher.test

For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores())

Attaching package: β€˜multinma’

The following objects are masked from β€˜package:stats’:

    dgamma, pgamma, qgamma

Loading required package: Matrix

Attaching package: β€˜Matrix’

The following objects are masked from β€˜package:tidyr’:

    expand, pack, unpack

Loading required package: metadat

Loading the 'metafor' package (version 3.4-0). For an
introduction to the package please type: help(metafor)

[conflicted] Will prefer dplyr::filter over any other package

New targets can be appended to the pipeline that calculate the data to be fitted differently, or add a different model algorithm. These can either replace or add to the existing pipeline.