Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mcguinlu/triangulate

Generalised implementation of bias-/indirectness-adjusted meta-analysis in R
https://github.com/mcguinlu/triangulate

Last synced: 10 days ago
JSON representation

Generalised implementation of bias-/indirectness-adjusted meta-analysis in R

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# triangulate

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/mcguinlu/triangulate/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/mcguinlu/triangulate/actions/workflows/R-CMD-check.yaml)

The goal of triangulate is to create a generalised version of the bias-adjusted meta-analysis approach originally proposed by Turner et al.

There are a number of steps to this process:

1. Define the causal question of interest
2. Identify relevant evidence sources and standardise effect directions
3. Specify an idealised version of each study
4. Assess the extent and direction of bias/indirectness in each result
5. Define modifying terms for bias and indirectness in each result
6. Calculate bias-/indirectness-adjusted results and perform meta-analysis

This package deals with steps 5 and 6.

## Installation

``` {r, eval = FALSE}
devtools::install_github("mcguinlutriangulate")
```

## :warning: WARNING NOTES


> *WARNING #1:* This package is under development, and as such the API is subject to change at any point without warning.


> *WARNING #2:* The approach described requires work in the preparation of data to work with the package. Please be sure to read the documentation and make use of helper functions to check whether your data is set-up right.


> *WARNING #3:* The approach described requires careful choice of valid prior distributions of bias/indirectness.


## Example

### Datasets

The approach described

```{r}
# Load libraries
library(magrittr)
library(triangulate)

# See column names of dat_bias

colnames(dat_bias)

head(dat_bias)

tri_dat_check(dat_bias)
```

For details on how to create these datasets, see the [Creating triangulation datasets]( https://mcguinlu.github.io/triangulate/articles/Creating-triangulation-datasets.html) vignette (under construction).

Once we load our data, helper functions will convert it to _long_ format and convert to absolute directions of bias/indirectness.

```{r}

dat_bias <- triangulate::dat_bias %>%

# Convert to long format
tri_to_long() %>%

tri_absolute_direction() %>%

tri_append_bias(triangulate::dat_bias_values)

```

Then apply the same approach to the indirectness dataset:

```{r}
dat_ind <- triangulate::dat_ind %>%
# Convert to long format
tri_to_long() %>%
tri_absolute_direction() %>%
tri_append_indirect(triangulate::dat_ind_values)

```

## Add prior distributions of bias/indirectness

```{r}
dat_bias_values
```

## Create final dataset and analyse

We now have two clean datasets, one for bias and one for indirectness, that we can use to

``` {r}
dat_final <- tri_prep_data(dat_bias, dat_ind)
```

At this point, we have an unadjusted (_yi_, _vi_) and adjusted (_yi_adj_, _vi_adj_) estimates for each result.

These estimates can then simply be passed to `metafor` for analysis

``` {r, out.height = 1800,out.height=400}

model <- metafor::rma(
yi = yi,
vi = vi,
data = dat_final,
slab = dat_final$study,
method = 'DL'
)

# Pass model to forest plot function
metafor::forest(
model,
atransf = exp,
)

model_adj <- metafor::rma(
yi = yi_adj,
vi = vi_adj,
data = dat_final,
slab = dat_final$study,
method = 'DL'
)

# Pass model to forest plot function
metafor::forest(
model_adj,
atransf = exp
)

```