Skip to content

Commit

Permalink
add POS case study and remove multinma dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-bean committed Jun 4, 2024
1 parent d5f7f51 commit d99b093
Show file tree
Hide file tree
Showing 6 changed files with 687 additions and 22 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Imports:
Matrix,
meta,
mmrm,
multinma,
mvtnorm,
netmeta,
nlme,
OncoBayes2,
parallel,
Expand Down
1 change: 1 addition & 0 deletions _quarto-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ book:
- src/02a_meta_analysis.qmd
- src/02ab_meta_analysis_trtdiff.qmd
- src/02ac_meta_analysis_strata.qmd
- src/02l_single_arm_pos.qmd
- src/02b_dose_finding.qmd
- src/02c_dose_escalation.qmd
- src/02cb_tte_dose_escalation.qmd
Expand Down
3 changes: 3 additions & 0 deletions src/02_case_studies.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ overview <- dplyr::tribble(
~Problem, ~Technique,
"@sec-use-hist-control-data", "nested random effects",
"@sec-map-treat-effects", "aggregate data modeling & varying exposure times of count data",
"@sec-use-hist-control-data-strata", "meta-analysis with covariates & use of mixture priors",
"@sec-pos", "prior elicitation and use of RBesT mixtures as priors",
"@sec-dose-finding", "non-linear models",
"@sec-onc-escalation", "constrained parameters",
"@sec-tte-oncology", "piece-wise constant survival model with Poisson regression & non-linear link function",
"@sec-multiple-imputation", "multi-variate outcome modeling",
"@sec-longitudinal-data", "longitudinal modeling with different covariance structures (MMRM)",
"@sec-mmrm", "unstructured MMRM for a continuous endpoint",
Expand Down
44 changes: 24 additions & 20 deletions src/02j_network_meta_analysis.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ library(posterior)
library(here)
library(knitr)
library(gt)
library(multinma) # for graphing the network & other NMA utils
library(netmeta) # for graphing the network & other NMA utils
# instruct brms to use cmdstanr as backend and cache all Stan binaries
options(brms.backend="cmdstanr", cmdstanr_write_stan_file_dir=here("_brms-cache"))
# create cache directory if not yet available
Expand Down Expand Up @@ -91,15 +91,26 @@ meta-analysis here would be to compare these different treatment in
terms of the odds of patients managing to stop smoking.

```{r smoking_cessation_data}
trt_levels <- c("No intervention", "Self-help",
"Individual counselling", "Group counselling")
smoking <- multinma::smoking %>%
mutate(study = factor(studyn),
trtc = factor(trtc, trt_levels))
levels(smoking$trtc) <- gsub(" ", "_", trt_levels)
levels(smoking$trtc) <- gsub("-", "_", levels(smoking$trtc))
data("smokingcessation", package = "netmeta")
recode_trt <- c("A" = "No_intervention",
"B" = "Self_help",
"C" = "Individual_counselling",
"D" = "Group_counselling")
smoking <- smokingcessation %>%
mutate(studyn = 1:n()) %>%
pivot_longer(-studyn,
names_to = c(".value", "trtid"),
names_pattern = "(.*)([1-9])") %>%
filter(!is.na(n)) %>%
transmute(
study = factor(studyn),
trtc = factor(recode_trt[treat], unname(recode_trt)),
trtn = as.numeric(trtc),
r = event,
n
)
gt_preview(smoking)
```
Expand All @@ -122,16 +133,9 @@ of treatments from randomized trials. Below, the thickness of the edges
is determined by the number of trials comparing each pair of treatments.

```{r}
network <- multinma::set_agd_arm(
data = smoking,
study = study,
trt = trtc,
r = r,
n = n,
trt_ref = "No_intervention"
)
plot(network)
nm <- netmeta(pairwise(treat = trtc, event = r, n = n, studlab = study,
data = smoking))
netgraph(nm)
```

## Model description
Expand Down
Loading

0 comments on commit d99b093

Please sign in to comment.