# sullivanstatistics/ballast architecture

> Architecture diagram of the GitHub repository sullivanstatistics/ballast, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sullivanstatistics/ballast
- Repository: https://github.com/sullivanstatistics/ballast
- Video tour (about a minute): https://gitdiagram.com/sullivanstatistics/ballast/video

## Overview

ballast is an R package for stress-testing a pre-specified repeated-measures model. The workflow defines or imports an analysis specification, fits the filed analysis, evaluates it under alternative data and analytic assumptions, then summarizes robustness and produces reports. A second major capability simulates planned designs to estimate conventional and robustness power. Relationships below are based on the README’s documented examples; source excerpts were not provided, so implementation-level calls are not verified.

Main entry points: [`R/spec.R`](https://github.com/sullivanstatistics/ballast/blob/main/R/spec.R) (Analysis specification), [`R/plan.R`](https://github.com/sullivanstatistics/ballast/blob/main/R/plan.R) (Plan runner), [`R/census.R`](https://github.com/sullivanstatistics/ballast/blob/main/R/census.R) (Stress census), [`R/design.R`](https://github.com/sullivanstatistics/ballast/blob/main/R/design.R) (Design evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Analysis setup"]
  node_specification["Analysis specification<br/>[spec.R]"]
  node_fit["Filed model fit<br/>[fit.R]"]
  node_plan["Stress plan<br/>[plan.R]"]
  node_standard_plan["Standard plan<br/>[standard.R]"]
  node_runner["Plan runner<br/>[plan.R]"]
end

subgraph group_stress["Stress testing"]
  node_families["Perturbation families<br/>[families.R]"]
  node_census["Stress census<br/>[census.R]"]
  node_curve["Continuous stress curve<br/>[curve.R]"]
  node_tipping["Tipping-point analysis<br/>[mi.R]"]
  node_fragility["Fragility search<br/>[fragility.R]"]
end

subgraph group_design["Design evaluation"]
  node_simulation["Trial simulation<br/>[simulate_rare.R]"]
  node_design_eval["Design evaluation<br/>[design.R]"]
end

subgraph group_outputs["Results and reporting"]
  node_verdict["Robustness verdict<br/>[direction.R]"]
  node_summary["Census summary<br/>[census.R]"]
  node_plots["Result plots<br/>[plots.R]"]
  node_report["Markdown report<br/>[deliverables.R]"]
  node_tables["Result tables<br/>[deliverables.R]"]
  node_html["Interactive report<br/>[html.R]"]
  node_audit_log["Audit log<br/>[deliverables.R]"]
end

node_analyst(("Analyst"))
node_input_data["Trial data or fit"]
node_external_mmrm["mmrm"]

node_analyst -->|"defines or imports"| node_specification
node_input_data -->|"supplies data"| node_specification
node_specification -->|"fits baseline"| node_fit
node_fit -.->|"uses model engine"| node_external_mmrm
node_specification -->|"configures stresses"| node_families
node_specification -->|"anchors census"| node_census
node_families -->|"supplies alternatives"| node_census
node_specification -->|"anchors curve"| node_curve
node_specification -->|"anchors analysis"| node_tipping
node_specification -->|"anchors search"| node_fragility
node_specification -->|"configures plan"| node_standard_plan
node_specification -->|"configures plan"| node_plan
node_standard_plan -->|"runs plan"| node_runner
node_plan -->|"runs plan"| node_runner
node_runner -->|"evaluates stresses"| node_census
node_runner -->|"writes report"| node_report
node_runner -->|"writes tables"| node_tables
node_runner -->|"writes HTML"| node_html
node_runner -->|"writes audit log"| node_audit_log
node_census -->|"summarizes rows"| node_summary
node_census -->|"classifies robustness"| node_verdict
node_census -->|"plots results"| node_plots
node_tipping -->|"plots p curve"| node_plots
node_analyst -->|"specifies design"| node_design_eval
node_design_eval -->|"simulates trials"| node_simulation
node_design_eval -->|"reports power"| node_analyst

click node_specification "https://github.com/sullivanstatistics/ballast/blob/main/R/spec.R"
click node_fit "https://github.com/sullivanstatistics/ballast/blob/main/R/fit.R"
click node_families "https://github.com/sullivanstatistics/ballast/blob/main/R/families.R"
click node_census "https://github.com/sullivanstatistics/ballast/blob/main/R/census.R"
click node_curve "https://github.com/sullivanstatistics/ballast/blob/main/R/curve.R"
click node_tipping "https://github.com/sullivanstatistics/ballast/blob/main/R/mi.R"
click node_fragility "https://github.com/sullivanstatistics/ballast/blob/main/R/fragility.R"
click node_plan "https://github.com/sullivanstatistics/ballast/blob/main/R/plan.R"
click node_standard_plan "https://github.com/sullivanstatistics/ballast/blob/main/R/standard.R"
click node_runner "https://github.com/sullivanstatistics/ballast/blob/main/R/plan.R"
click node_simulation "https://github.com/sullivanstatistics/ballast/blob/main/R/simulate_rare.R"
click node_design_eval "https://github.com/sullivanstatistics/ballast/blob/main/R/design.R"
click node_verdict "https://github.com/sullivanstatistics/ballast/blob/main/R/direction.R"
click node_summary "https://github.com/sullivanstatistics/ballast/blob/main/R/census.R"
click node_plots "https://github.com/sullivanstatistics/ballast/blob/main/R/plots.R"
click node_report "https://github.com/sullivanstatistics/ballast/blob/main/R/deliverables.R"
click node_tables "https://github.com/sullivanstatistics/ballast/blob/main/R/deliverables.R"
click node_html "https://github.com/sullivanstatistics/ballast/blob/main/R/html.R"
click node_audit_log "https://github.com/sullivanstatistics/ballast/blob/main/R/deliverables.R"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_specification,node_fit,node_plan,node_standard_plan,node_runner toneBlue
class node_families,node_census,node_curve,node_tipping,node_fragility toneAmber
class node_simulation,node_design_eval toneMint
class node_verdict,node_summary,node_plots,node_report,node_tables,node_html,node_audit_log toneRose
class node_analyst,node_input_data,node_external_mmrm toneIndigo
```

## Components

### Analysis setup

- [Analysis specification](https://github.com/sullivanstatistics/ballast/blob/main/R/spec.R): `R/spec.R`
- [Filed model fit](https://github.com/sullivanstatistics/ballast/blob/main/R/fit.R): `R/fit.R`
- [Stress plan](https://github.com/sullivanstatistics/ballast/blob/main/R/plan.R): `R/plan.R`
- [Standard plan](https://github.com/sullivanstatistics/ballast/blob/main/R/standard.R): `R/standard.R`
- [Plan runner](https://github.com/sullivanstatistics/ballast/blob/main/R/plan.R): `R/plan.R`

### Stress testing

- [Perturbation families](https://github.com/sullivanstatistics/ballast/blob/main/R/families.R): `R/families.R`
- [Stress census](https://github.com/sullivanstatistics/ballast/blob/main/R/census.R): `R/census.R`
- [Continuous stress curve](https://github.com/sullivanstatistics/ballast/blob/main/R/curve.R): `R/curve.R`
- [Tipping-point analysis](https://github.com/sullivanstatistics/ballast/blob/main/R/mi.R): `R/mi.R`
- [Fragility search](https://github.com/sullivanstatistics/ballast/blob/main/R/fragility.R): `R/fragility.R`

### Design evaluation

- [Trial simulation](https://github.com/sullivanstatistics/ballast/blob/main/R/simulate_rare.R): `R/simulate_rare.R`
- [Design evaluation](https://github.com/sullivanstatistics/ballast/blob/main/R/design.R): `R/design.R`

### Results and reporting

- [Robustness verdict](https://github.com/sullivanstatistics/ballast/blob/main/R/direction.R): `R/direction.R`
- [Census summary](https://github.com/sullivanstatistics/ballast/blob/main/R/census.R): `R/census.R`
- [Result plots](https://github.com/sullivanstatistics/ballast/blob/main/R/plots.R): `R/plots.R`
- [Markdown report](https://github.com/sullivanstatistics/ballast/blob/main/R/deliverables.R): `R/deliverables.R`
- [Result tables](https://github.com/sullivanstatistics/ballast/blob/main/R/deliverables.R): `R/deliverables.R`
- [Interactive report](https://github.com/sullivanstatistics/ballast/blob/main/R/html.R): `R/html.R`
- [Audit log](https://github.com/sullivanstatistics/ballast/blob/main/R/deliverables.R): `R/deliverables.R`

### Other components

- **Analyst**
- **Trial data or fit**
- **mmrm**

## Connections

- Analyst → Analysis specification: defines or imports (evidence: `README.md`)
- Trial data or fit → Analysis specification: supplies data (evidence: `README.md`)
- Analysis specification → Filed model fit: fits baseline (evidence: `README.md`)
- Filed model fit → mmrm: uses model engine (evidence: `README.md`)
- Analysis specification → Perturbation families: configures stresses (evidence: `README.md`)
- Analysis specification → Stress census: anchors census (evidence: `README.md`)
- Perturbation families → Stress census: supplies alternatives (evidence: `README.md`)
- Analysis specification → Continuous stress curve: anchors curve (evidence: `README.md`)
- Analysis specification → Tipping-point analysis: anchors analysis (evidence: `README.md`)
- Analysis specification → Fragility search: anchors search (evidence: `README.md`)
- Analysis specification → Standard plan: configures plan (evidence: `README.md`)
- Analysis specification → Stress plan: configures plan (evidence: `README.md`)
- Standard plan → Plan runner: runs plan (evidence: `README.md`)
- Stress plan → Plan runner: runs plan (evidence: `README.md`)
- Plan runner → Stress census: evaluates stresses (evidence: `README.md`)
- Plan runner → Markdown report: writes report (evidence: `README.md`)
- Plan runner → Result tables: writes tables (evidence: `README.md`)
- Plan runner → Interactive report: writes HTML (evidence: `README.md`)
- Plan runner → Audit log: writes audit log (evidence: `README.md`)
- Stress census → Census summary: summarizes rows (evidence: `README.md`)
- Stress census → Robustness verdict: classifies robustness (evidence: `README.md`)
- Stress census → Result plots: plots results (evidence: `README.md`)
- Tipping-point analysis → Result plots: plots p curve (evidence: `README.md`)
- Analyst → Design evaluation: specifies design (evidence: `README.md`)
- Design evaluation → Trial simulation: simulates trials (evidence: `README.md`)
- Design evaluation → Analyst: reports power (evidence: `README.md`)
