---
title: "Workspace Test Families"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Workspace Test Families}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
library(ggpower)
```

The **Power Workspace** module registers classical test families. This vignette
summarizes ANOVA/regression, exact proportions, correlations, GLM, and
nonparametric tests. See [t Tests](t-tests.html) for the t-test family.

## ANOVA and regression

```{r anova}
power_compute("f_anova_one_way", "a_priori", f = 0.25, alpha = 0.05,
              power = 0.8, groups = 4)
```

```{r mreg}
f2 <- effect_size_f2(0.10)
power_compute("f_mreg_omnibus", "post_hoc", f2 = f2,
              total_n = 95, predictors = 5)
```

## Exact and proportion tests

```{r binom}
power_compute("exact_binomial", "post_hoc", p0 = 0.5, p1 = 0.65,
              n = 80, alpha = 0.05, tails = "one")
```

```{r fisher}
power_compute("exact_fisher", "post_hoc", p0 = 0.4, p1 = 0.7,
              n1 = 12, n2 = 12, alpha = 0.05, tails = "greater")
```

```{r mcnemar}
power_compute("exact_mcnemar", "post_hoc", p0 = 0.5, p1 = 0.65, n = 60, alpha = 0.05)
```

## Correlation and z tests

```{r indep}
q <- effect_size_q(0.75, 0.88)
power_compute("z_corr_independent", "post_hoc", q_effect = q,
              n1 = 51, n2 = 260, alpha = 0.05)
```

```{r logist}
power_compute("z_logistic", "a_priori", odds_ratio = 1.5, p0 = 0.5,
              alpha = 0.05, power = 0.95, total_n = 300,
              r2_other = 0, x_variance = 1)
```

## Logistic and Poisson regression

```{r pois}
power_compute("z_poisson", "a_priori", exp_beta1 = 1.3,
              base_rate = 0.85, exposure = 1, alpha = 0.05,
              power = 0.95, r2_other = 0, x_variance = 0.25)
```

## Nonparametric tests

Nonparametric tests map rank-test planning to t-test noncentrality via ARE:
$d_{\text{eff}} = d \cdot \sqrt{\text{ARE}}$.

```{r wilcox-signed}
power_compute("wilcoxon_signed", "post_hoc", d = 0.5, n = 40,
              alpha = 0.05, are = 3 / pi)
```

```{r wilcox-mw}
power_compute("wilcoxon_mann_whitney", "post_hoc", d = 0.5,
              n1 = 30, n2 = 30, alpha = 0.05, are = 3 / pi)
```

## Related

- [t Tests](t-tests.html)
- [Analysis modes](analysis-modes.html)
- [Support matrix](support-matrix.html)
