Skip to content

Commit

Permalink
Updates of vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
chstock committed Apr 21, 2023
1 parent 4e4bde3 commit 1c21ae2
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions vignettes/expert_elicitation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This vignette provides a brief description of how expert elicitation can be used
The data in this example are hypothetical data.

Loading the `tipmap` package:
```{r, eval=F, echo=T}
```{r, eval=T, echo=T}
library(tipmap)
```

Expand All @@ -52,7 +52,7 @@ Here, the expert data are assumed to be collected via the 'roulette method' (Gos
The experts are asked to place 10 chips into a grid to create histogram-like data that reflects their preferred weighting. No particular shape of symmetry is needed.

Data from a single expert:
```{r chips_single1, eval=F, echo=T}
```{r chips_single1, eval=T, echo=T}
chips_1exp <- c(1, 3, 4, 2, 0, 0, 0, 0, 0, 0)
sum(chips_1exp)
```
Expand All @@ -62,7 +62,7 @@ sum(chips_1exp)
The roulette data are assumed to follow a beta distribution. The following calculation and fitting of a beta distribution is similar to an implementation in `SHELF::fitdist` and yields identical results.

Data from a single expert:
```{r chips_single2, eval=F, echo=T}
```{r chips_single2, eval=T, echo=T}
# Compute cumulative probabilities
(x <- get_cum_probs_1exp(chips_1exp))
# Compute model inputs
Expand All @@ -73,7 +73,7 @@ Data from a single expert:

For multiple experts the individual steps are handled by the `fit_beta_mult_exp`-function:

```{r chips_multiple, eval=F, echo=T}
```{r chips_multiple, eval=T, echo=T}
beta_fits <- fit_beta_mult_exp(
chips_mult <-
rbind(
Expand All @@ -92,7 +92,7 @@ beta_fits

Summary statistics for a single expert:

```{r fit_beta_1a, eval=F, echo=T}
```{r fit_beta_1a, eval=T, echo=T}
(alpha <- fit_1exp[1]); (beta <- fit_1exp[2])
# Mean
Expand Down Expand Up @@ -123,27 +123,27 @@ sd(x)

Summary statistics for data from multiple experts:

```{r fit_beta_2a, eval=F, echo=T}
```{r fit_beta_2a, eval=T, echo=T}
expert_samples <- draw_beta_mixture_nsamples(n=10^3, chips_mult=chips_mult)
summary(expert_samples)
```

```{r fit_beta_2b, eval=F, echo=T}
```{r fit_beta_2b, eval=T, echo=T}
(mean_w <- round(mean(expert_samples), 2))
```

Mean or median values of the pooled distribution may be used as primary weights of the informative component of the robust MAP prior when pre-specifying the Bayesian analysis.

## Figures

```{r load_libs, eval=F, echo=T}
```{r load_libs, eval=T, echo=T}
# Load libraries
packages <- c("magrittr", "ggplot2", "tibble", "dplyr")
invisible(lapply(packages, library, character.only = T))
```

### Without linear pooling
```{r elicitfig1a, eval=F, echo=T}
```{r elicitfig1a, eval=T, echo=T}
# Create matrix
fits_mat <- as.matrix(beta_fits[,c(1,2)])
# Wide format
Expand All @@ -163,7 +163,7 @@ fit_beta_mult_plot_long <- fit_beta_mult_plot_wide %>%
values_to = "dens")
```

```{r elicitfig1b, eval=F, echo=T, fig.width=8, fig.height=5, dev=c('png'), out.width="95%"}
```{r elicitfig1b, eval=T, echo=T, fig.width=8, fig.height=5, dev=c('png'), out.width="95%"}
# Plot without linear pool
fig_betas_1 <- ggplot(
data = fit_beta_mult_plot_long,
Expand All @@ -178,7 +178,7 @@ print(fig_betas_1)
```

### With linear pooling
```{r elicitfig2a, eval=F, echo=T}
```{r elicitfig2a, eval=T, echo=T}
# Wide format
fit_beta_mult_plot_wide2 <- fit_beta_mult_plot_wide %>%
mutate(linpool = (Expert1 + Expert2 + Expert3 + Expert4 + Expert5)/5)
Expand All @@ -190,7 +190,7 @@ fit_beta_mult_plot_long2 <- fit_beta_mult_plot_wide %>%
values_to = "dens")
```

```{r elicitfig2b, eval=F, echo=T, fig.width=8, fig.height=5, dev=c('png'), out.width="95%"}
```{r elicitfig2b, eval=T, echo=T, fig.width=8, fig.height=5, dev=c('png'), out.width="95%"}
# Plot
fig_betas_2 <- ggplot(
data = fit_beta_mult_plot_long2,
Expand All @@ -215,7 +215,7 @@ Best, N., Dallow, N. and Montague, T. (2020) Prior Elicitation. In: Lesaffre E,

Dallow, N., Best, N. and Montague, T. H. (2018) Better decision making in drug development through adoption of formal prior elicitation. Pharm Stat, 17, 301–316.

Gosling, J. P. (2018) SHELF: The sheffield elicitation framework. In Elicitation: The Science and Art of Structuring Judgement (eds L. C. Dias, A. Morton, and J. Quigley), pp. 61–93. Springer International Publishing.
Gosling, J. P. (2018) SHELF: The Sheffield Elicitation Framework. In Elicitation: The Science and Art of Structuring Judgement (eds L. C. Dias, A. Morton, and J. Quigley), pp. 61–93. Springer International Publishing.

Ionan, A. C., Clark, J., Travis, J., et al. (2022) Bayesian Methods in Human Drug and Biological Products Development in CDER and CBER. Ther Innov Regul Sci,, to appear.

Expand Down

0 comments on commit 1c21ae2

Please sign in to comment.