Skip to content

Commit feab441

Browse files
mattsecrestgithub-actions[bot]gravesti
authored
Hex stickr (#183)
* make ggplot of distributions * good rough draft * tweaks * readme update * light tweaks * update wordlist * [skip actions] Restyle files * wip fixing the superlinter * fix markdown * new colours * update wordlist * [skip actions] Restyle files Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: gravesti <isaac.gravestock@roche.com> Co-authored-by: gravesti <83659704+gravesti@users.noreply.github.com>
1 parent a828703 commit feab441

File tree

5 files changed

+135
-21
lines changed

5 files changed

+135
-21
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ repos:
8181
rev: v0.32.2
8282
hooks:
8383
- id: markdownlint
84-
args: ["--ignore=tests/testthat/_snaps/*"]
84+
args: ["--ignore=tests/testthat/_snaps/*", "--disable=MD033"]

README.md

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,71 @@
1-
# psborrow2
1+
# psborrow2 <img src="./inst/img/psborrow2_hex.png" align="right" width="120" />
2+
3+
<!-- badges: start -->
4+
5+
[![Version](https://img.shields.io/static/v1.svg?label=github.com/genentech&message=v.0.0.1&color=DC0073)](https://github.com/Genentech/psborrow2)
6+
[![Lifecycle:
7+
maturing](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
8+
9+
<!-- badges: end -->
210

311
## Overview
412

5-
The `psborrow2` package exists to provide an efficient framework for users to
6-
conduct Bayesian Dynamic Borrowing (BDB) analyses (for more information on BDB,
7-
see Ibrahim et al., 2000; Hobbs et al., 2012; Schmidli et al., 2014;
8-
Lewis, et al., 2019).
13+
`psborrow2` provides an efficient framework for users to
14+
conduct Bayesian Dynamic Borrowing (BDB) analyses and other
15+
innovative analytical designs.[^1] [^2]
16+
`psborrow2` has two main objectives:
17+
18+
1. **Facilitate BDB analyses**. `psborrow2` has a user-friendly interface for
19+
conducting BDB analyses that handles the computationally-difficult MCMC sampling
20+
on behalf of the user.
921

10-
`psborrow2` has two main goals: First, facilitate simulation studies that
11-
compare different borrowing parameters (e.g. full borrowing, no borrowing, BDB)
12-
and other trial and BDB characteristics (e.g. sample size, covariates)
13-
in a unified way; and second, provide a user-friendly interface for applying
14-
BDB on the study results that handles the MCMC sampling on behalf of the user.
22+
2. **Facilitate simulation studies of BDB**. `psborrow2` includes a
23+
framework to compare different trial and BDB characteristics in a unified way
24+
in simulation studies to inform trial design.
1525

16-
`psborrow2` is the successor of
17-
[`psborrow`](https://github.com/Genentech/psborrow). Major updates to
18-
`psborrow2` include:
26+
## Background
1927

20-
* New MCMC software (STAN)
21-
* New user interface
22-
* Additional functionality
28+
`psborrow2` is the successor to
29+
[`psborrow`](https://github.com/Genentech/psborrow). `psborrow` is still freely
30+
available on [`CRAN`](https://cran.r-project.org/package=psborrow) with the
31+
same validated functionality; however, the package is not actively developed.
32+
Major updates in `psborrow2` include:
33+
34+
- New, more flexible user interface
35+
- New MCMC software (STAN)
36+
- Expanded functionality
37+
38+
The name `psborrow` combines propensity scoring (`ps`) and Bayesian dynamic
39+
`borrow`ing. As the name implies, this package can be used to combine dynamic
40+
borrowing and propensity-score adjustment/weighting methods.
2341

2442
## Installation
2543

26-
`psborrow2` is currently under development and should therefore be used with
27-
caution. You can install the development version via:
44+
You can install the latest version of `psborrow2` with:
2845

2946
```r
3047
remotes::install_github("Genentech/psborrow2")
3148
```
3249

33-
Please note that this package requires [`cmdstanr`](https://mc-stan.org/cmdstanr/)
34-
to be installed.
50+
Please note that this package requires [`cmdstanr`](https://mc-stan.org/cmdstanr/).
51+
52+
## Vignettes
53+
54+
To learn how to use the `psborrow2` R package, refer to the package vignettes:
55+
56+
```r
57+
browseVignettes("psborrow2")
58+
```
59+
60+
## Bibliography
61+
62+
[^1]:
63+
Lewis CJ, Sarkar S, Zhu J, Carlin BP. Borrowing from historical control data
64+
in cancer drug development: a cautionary tale and practical guidelines.
65+
Statistics in biopharmaceutical research. 2019 Jan 2;11(1):67-78.
66+
67+
[^2]:
68+
Viele K, Berry S, Neuenschwander B, Amzal B, Chen F, Enas N, Hobbs B,
69+
Ibrahim JG, Kinnersley N, Lindborg S, Micallef S. Use of historical control
70+
data for assessing treatment effects in clinical trials. Pharmaceutical
71+
statistics. 2014 Jan;13(1):41-54.

dev/hex_sticker.R

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Color palette reference: https://coolors.co/04e762-f5b700-00a1e4-dc0073-89fc00
2+
3+
# Make a ggplot2 image of 3 distributions
4+
make_ggplot_of_dists <- function() {
5+
# Dependancies
6+
require(ggplot2)
7+
require(showtext)
8+
require(dplyr)
9+
require(ggthemes)
10+
11+
# Three normal distributions
12+
log_x_vals <- seq(-15, 15, .01)
13+
x_vals <- exp(log_x_vals)
14+
norm_1 <- norm_2 <- norm_3 <- vector("numeric", length(log_x_vals))
15+
norm_1 <- dnorm(x = log_x_vals, mean = 3, sd = 3)
16+
norm_2 <- dnorm(x = log_x_vals, mean = .25, sd = 1.5)
17+
norm_3 <- dnorm(x = log_x_vals, mean = 2, sd = .9)
18+
19+
# Combine
20+
df <- data.frame(
21+
density = c(norm_1, norm_2, norm_3),
22+
x = rep(log_x_vals, 3),
23+
analysis = factor(rep(1:3, each = length(x_vals)))
24+
)
25+
26+
# Plot
27+
ggplot(df) +
28+
geom_density(
29+
aes(
30+
x = x,
31+
y = density,
32+
fill = analysis,
33+
color = analysis
34+
),
35+
stat = "identity",
36+
alpha = 0.8,
37+
show.legend = FALSE
38+
) +
39+
scale_fill_manual(values = c("#F5B700", "#00A1E4", "#DC0073")) +
40+
scale_color_manual(values = c("#F5B700", "#00A1E4", "#DC0073")) +
41+
theme_void()
42+
}
43+
44+
make_hexplot <- function(out_path = "./inst/img/psborrow2_hex.png") {
45+
# Dependancies
46+
require(hexSticker)
47+
require(showtext)
48+
49+
# HexSticker
50+
hexSticker::sticker(
51+
subplot = make_ggplot_of_dists(),
52+
package = "psborrow2",
53+
p_size = 140,
54+
p_color = "#094F26",
55+
p_y = 1.4,
56+
s_y = .83,
57+
s_x = .7,
58+
s_width = 4.5,
59+
s_height = .7,
60+
h_fill = "#b7fed4",
61+
h_color = "#094F26",
62+
h_size = 2,
63+
url = "github.com/Genentech/psborrow2",
64+
u_size = 24,
65+
filename = out_path,
66+
p_family = "mono",
67+
dpi = 2000
68+
)
69+
}
70+
71+
make_hexplot()

inst/WORDLIST

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ ATT
22
Acknowledgements
33
Amzal
44
BDB
5+
CJ
56
BayesPPD
67
Bove
78
CMD
@@ -13,14 +14,17 @@ IPTW
1314
Ibrahim
1415
Jiawen
1516
Kinnersley
17+
Lifecycle
1618
Lindborg
1719
MatchIt
1820
Micallef
1921
Neuenschwander
22+
PSweight
2023
Pharmaceut
2124
RCT
2225
Roychoudhury
2326
Sabanes
27+
Sarkar
2428
Schmidli
2529
Statist
2630
Viele
@@ -32,6 +36,7 @@ approxeq
3236
bernoulli
3337
binarization
3438
binarizing
39+
biopharmaceutical
3540
cauchy
3641
cmdstanr
3742
commensurability
@@ -51,6 +56,7 @@ https
5156
hyperprior
5257
hyperpriors
5358
infty
59+
ing
5460
interpretable
5561
mc
5662
operatorname

inst/img/psborrow2_hex.png

438 KB
Loading

0 commit comments

Comments
 (0)