synergylmm

A comprehensive statistical framework for designing and analyzing in vivo drug combination experiments.

https://github.com/rafromb/synergylmm

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.5%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

A comprehensive statistical framework for designing and analyzing in vivo drug combination experiments.

Basic Info
  • Host: GitHub
  • Owner: RafRomB
  • License: gpl-3.0
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 4.41 MB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Created almost 2 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



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

# SynergyLMM  SynergyLMM logo




[![CRAN status](https://www.r-pkg.org/badges/version/SynergyLMM)](https://CRAN.R-project.org/package=SynergyLMM)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)


A comprehensive statistical framework for designing and analyzing _in vivo_ drug combination experiments. 

## Table of Contents

- [Installation](#installation)
- [1. Fit Model](#1-fit-model)
- [1.1 Gompertz Growth Model](#11-gompertz-growth-model)
- [1.2 Specify Residual Variance Structure](#12-specify-residual-variance-structure)
- [1.3 Adjust Optimization Controls](#13-adjust-optimization-controls-to-solve-convergence-problems)
- [2. Synergy Analysis](#2-synergy-analysis)
- [3. Model Diagnosis](#3-model-diagnosis)
- [4. Power Analysis](#4-power-analysis)

## Installation

You can install the development version of SynergyLMM from [GitHub](https://github.com/) with:

``` r
# install.packages("pak")
pak::pak("RafRomB/SynergyLMM")
```

Or you can install the [CRAN-released version](https://cran.r-project.org/package=SynergyLMM) with:

``` r
install.packages("SynergyLMM")
```

## Wep-App

You can also use **SynergyLMM** directly in your browser at: https://synergylmm.uiocloud.no/ 

## Example Use of SynergyLMM

This is a basic example which shows how to use SynergyLMM to analyze synergy in a 2-drug combination _in vivo_ experiment.

```{r load_SynergyLMM}
library(SynergyLMM)
```

We start by loading the data (in long format). We will use the example data provided in the package:

```{r load_data}
data("grwth_data")
```

### 1. Fit Model

The first step is fitting the model from our data:

```{r fit_model, fig.width=8}
# Most simple model
lmm <- lmmModel(
  data = grwth_data,
  grwth_model = "exp",
  sample_id = "subject",
  time = "Time",
  treatment = "Treatment",
  tumor_vol = "TumorVolume",
  trt_control = "Control",
  drug_a = "DrugA",
  drug_b = "DrugB",
  combination = "Combination"
)
```

#### 1.1 Gompertz Growth Model
The previous example fits the model using an exponential growth. Users can also use a Gompertz growth model using `grwth_model = "gompertz"`:


```{r fit_model_gomp, fig.width=8}
lmm_gomp <- lmmModel(
  data = grwth_data,
  grwth_model = "gompertz", # Specify Gompertz growth model
  start_values = "selfStart",
  sample_id = "subject",
  time = "Time",
  treatment = "Treatment",
  tumor_vol = "TumorVolume",
  trt_control = "Control",
  drug_a = "DrugA",
  drug_b = "DrugB",
  combination = "Combination"
)
```

When using the Gompertz growth model, setting `start_values = "selfStart"` derives the initial values from a call to `stats::nls`, which can facilitate successful model fitting.

#### 1.2 Specify Residual Variance Structure

To address heteroscedasticity, users can define a variance structure using the argument `weights` and functions from the [`nlme`](https://cran.r-project.org/web/packages/nlme/index.html) R package. For example, a treatment-specific variance structure can be specify using `weights = nlme::varIdent(form = ~1|Treatment)`:

```{r varIdent}
lmmVar <- lmmModel(
  data = grwth_data,
  grwth_model = "exp",
  sample_id = "subject",
  time = "Time",
  treatment = "Treatment",
  tumor_vol = "TumorVolume",
  trt_control = "Control",
  drug_a = "DrugA",
  drug_b = "DrugB",
  combination = "Combination",
  weights = nlme::varIdent(form = ~1|Treatment),
  show_plot = FALSE
)
```

Other options are:

- Time-specific variance structure: `weights = nlme::varIdent(form = ~1|Time)`
- Subject-specific variance structure: `weights = nlme::varIdent(form = ~1|SampleID)`

Combinations of variance functions can also be specified using `nlme::varComb()`. For example, to model residual variance as varying independently across both individual samples and time points, users can specify:

- `weights = nlme::varComb(nlme::varIdent(form = ~1|SampleID), nlme::varIdent(form = ~1|Time))`

#### 1.3 Adjust Optimization Controls to Solve Convergence Problems

Convergence issues can appear when using complex variance or correlation structures, particularly with non-linear models like Gompertz.

User can customize optimization settings—e.g., number of iterations, convergence tolerance, or optimizer method—via the `control` argument in `lmmModel()` function. 

For example, to increase the maximum number of iterations for the optimization algorithm: `control = nlme::lmeControl(maxIter = 1000)`

```{r lmeControl}
lmmCont <- lmmModel(
  data = grwth_data,
  grwth_model = "exp",
  sample_id = "subject",
  time = "Time",
  treatment = "Treatment",
  tumor_vol = "TumorVolume",
  trt_control = "Control",
  drug_a = "DrugA",
  drug_b = "DrugB",
  combination = "Combination",
  control = nlme::lmeControl(maxIter = 1000),
  show_plot = FALSE
)
```

- For the exponential model use: `control = nlme::lmeControl()`
- For the Gompertz model use: `control = nlme::nlmeControl()`

#### 1.4 Model Estimates

We can obtain the model estimates and their standard deviation (sd) using:

```{r model_estimates}
lmmModel_estimates(lmm)
```

Also for the Gompertz model:

```{r}
lmmModel_estimates(lmm_gomp)
```

### 2. Synergy Analysis

Synergy calculation can be done using `lmmSynergy`. The reference model to assess the drug combination effect can be changed to Bliss independence, highest single agent, or response additivity, by setting `method = "Bliss"`, `method = "HSA"`, and `method = "RA"`, respectively.

**Bliss independence model**

```{r bliss_syn, fig.width=10}
lmmSynergy(lmm, method = "Bliss")
```

**Highest Single Agent model**

```{r hsa_syn, fig.width=10}
lmmSynergy(lmm, method = "HSA")
```

**Response Additivity**

```{r ra_syn, fig.width=10}
set.seed(123)
lmmSynergy(lmm, method = "RA", ra_nsim = 1000)
```

**Using Robust Estimates**

```{r robustSE, fig.width=10}
lmmSynergy(lmm, method = "Bliss", robust = TRUE)
```
- _Note: Sandwich-based robust estimates are only available for the exponential model._


### 3. Model Diagnostics

We can perform the model diagnostics using the following functions:

**Random Effects**

```{r ranef_diag, fig.width=8, fig.height=10}
ranefDiagnostics(lmm)
```
**Residuals Diagnostics**

```{r resid_diagnostics, fig.width=8, fig.height=12}
residDiagnostics(lmm)
```

**Observed versus Predicted Values**

```{r obs_vs_pred, fig.height=8, fig.width=10}
ObsvsPred(lmm)
```

**Influential Diagnostics**

_Cook's distances based on the change of fitted values_

```{r CooksD_fitted}
CookDistance(lmm)
```


_Cook's distances based on the change of fixed effects_

```{r CooksD_fixef}
CookDistance(lmm, type = "fixef")
```

_log likelihood displacements_

- _Note: The calculation of log likelihood displacements is only available for the exponential growth model._

```{r logLikDisp}
logLikSubjectDisplacements(lmm)
```


### 4. Power Analysis

- _Note: The_ post-hoc _power analysis and the_ a priori _power analysis are only available for the exponential growth model._

**Post-Hoc Power Analysis**

```{r posthoc_pwr}
set.seed(123)
PostHocPwr(lmm, method = "Bliss", time = 30)
```

**A Priori Power Analysis**

We will estimate the effect of sample size on statistical power based on the estimates from the model:

```{r pwrsamplesize, fig.width=12}
# Vector with different sample sizes per group
npg <- 3:15

# Obtain model estimates
(lmmestim <- lmmModel_estimates(lmm))

# Obtain time points

(timepoints <- unique(lmm$dt1$Time))

# Calculate power depending on sample size per group

PwrSampleSize(
  npg = npg,
  time = timepoints,
  grwrControl = round(lmmestim$Control,3),
  grwrA = round(lmmestim$DrugA,3),
  grwrB = round(lmmestim$DrugB,3),
  grwrComb = round(lmmestim$Combination,3),
  sd_ranef = round(lmmestim$sd_ranef,3),
  sgma = round(lmmestim$sd_resid,3),
  method = "Bliss"
)
```

Owner

  • Login: RafRomB
  • Kind: user

GitHub Events

Total
  • Issues event: 2
  • Watch event: 4
  • Delete event: 2
  • Issue comment event: 2
  • Public event: 1
  • Push event: 42
  • Pull request review event: 1
  • Pull request event: 3
  • Create event: 3
Last Year
  • Issues event: 2
  • Watch event: 4
  • Delete event: 2
  • Issue comment event: 2
  • Public event: 1
  • Push event: 42
  • Pull request review event: 1
  • Pull request event: 3
  • Create event: 3

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 2
  • Total pull requests: 2
  • Average time to close issues: 21 days
  • Average time to close pull requests: about 8 hours
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 2
  • Average time to close issues: 21 days
  • Average time to close pull requests: about 8 hours
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • RafRomB (2)
Pull Request Authors
  • zhizuio (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 255 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
cran.r-project.org: SynergyLMM

Statistical Framework for in Vivo Drug Combination Studies

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 255 Last month
Rankings
Dependent packages count: 27.2%
Dependent repos count: 33.6%
Average: 49.2%
Downloads: 86.8%
Maintainers (1)
Last synced: 10 months ago

Dependencies

.github/workflows/rhub.yaml actions
  • r-hub/actions/checkout v1 composite
  • r-hub/actions/platform-info v1 composite
  • r-hub/actions/run-check v1 composite
  • r-hub/actions/setup v1 composite
  • r-hub/actions/setup-deps v1 composite
  • r-hub/actions/setup-r v1 composite
DESCRIPTION cran
  • R >= 4.0 depends
  • MASS * imports
  • car * imports
  • clubSandwich * imports
  • cowplot >= 1.1.3 imports
  • dplyr >= 1.1.4 imports
  • fBasics * imports
  • ggplot2 >= 3.5.1 imports
  • lattice * imports
  • magrittr >= 2.0.3 imports
  • marginaleffects * imports
  • nlme >= 3.1 imports
  • nlmeU * imports
  • performance * imports
  • rlang * imports
  • knitr * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests