---
title: "Biomarker Endpoints"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Biomarker Endpoints}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
library(ggpower)
```

The **Biomarker Discovery** module covers expression, classification, survival,
and screening endpoints. Detailed per-topic articles remain on the pkgdown site.

## Differential expression

Two-group mean difference for expression biomarkers (wrapper around `t_two_sample`).

```{r de}
power_compute("ttest_biomarker", "post_hoc", d = 0.6, n1 = 40, n2 = 40,
              alpha = 0.05, tails = "two")
```

```{r de-apriori}
power_compute("ttest_biomarker", "a_priori", d = 0.5, alpha = 0.05,
              power = 0.8, allocation_ratio = 1)
```

## ROC and AUC

```{r roc-one}
power_compute(
  "roc_auc_one",
  analysis = "a_priori",
  auc = 0.75,
  auc0 = 0.5,
  n_pos = 50,
  n_neg = 50,
  alpha = 0.05,
  power = 0.8,
  tails = "two"
)
```

```{r roc-two}
power_compute(
  "roc_auc_two",
  analysis = "post_hoc",
  auc1 = 0.78,
  auc2 = 0.62,
  n1 = 80,
  n2 = 80,
  alpha = 0.05,
  tails = "two"
)
```

## Diagnostic accuracy

```{r diag}
power_compute("diagnostic_acc", "post_hoc", sensitivity = 0.85, specificity = 0.85,
              n_pos = 50, n_neg = 50, alpha = 0.05)
```

```{r diag-apriori}
power_compute("diagnostic_acc", "a_priori", sensitivity = 0.9, specificity = 0.9,
              alpha = 0.05, power = 0.8, allocation_ratio = 1)
```

## Survival (log-rank)

```{r surv}
power_compute("survival_logrank", "post_hoc", hazard_ratio = 0.65,
              total_n = 200, event_rate = 0.5, alpha = 0.05)
```

## Cox prognostic models

```{r cox}
power_compute("cox_regression", "post_hoc", hazard_ratio = 0.65,
              events = 100, alpha = 0.05)
```

```{r cox-apriori}
power_compute("cox_regression", "a_priori", hazard_ratio = 0.7,
              alpha = 0.05, power = 0.8)
```

## Multiplicity and FDR

```{r fdr}
power_compute("discovery_fdr", "post_hoc", effect_d = 0.5, m_tests = 1000,
              pi0 = 0.9, fdr_level = 0.05, n = 40, alpha = 0.05)
```

## Related

- [Clinical trials](clinical-trials.html)
- [Scenario guide](scenario-guide.html)
- [Support matrix](support-matrix.html)
