# mostafa-abbas/indepassoc architecture

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

- Interactive diagram: https://gitdiagram.com/mostafa-abbas/indepassoc
- Repository: https://github.com/mostafa-abbas/indepassoc

## Overview

IndepAssoc is an R package for assessing whether an exposure–outcome association persists across five confounder-adjusted methods. Its documented workflow starts with a cohort and analysis specification, runs regression, matching, stratification, IPTW, and AIPW, and returns estimates alongside automatic propensity-score positivity and balance diagnostics; users can format the comparison for publication. The README also documents plotting and subgroup-analysis capabilities, represented as separate branches. No source excerpts were supplied, so edges are limited to relationships stated in the README; paths identify implementation files by the repository tree.

Main entry points: [`R/pipeline.R`](https://github.com/mostafa-abbas/indepassoc/blob/main/R/pipeline.R) (Analysis pipeline), [`R/balance.R`](https://github.com/mostafa-abbas/indepassoc/blob/main/R/balance.R) (Balance check), [`R/match.R`](https://github.com/mostafa-abbas/indepassoc/blob/main/R/match.R) (Matching), [`R/ps_model.R`](https://github.com/mostafa-abbas/indepassoc/blob/main/R/ps_model.R) (Propensity model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Association analysis"]
  node_pipeline["Analysis pipeline<br/>[pipeline.R]"]
  node_regression["Regression<br/>[fit_outcome.R]"]
  node_matching["Matching<br/>[match.R]"]
  node_stratification["Stratification<br/>[fit_outcome.R]"]
  node_iptw["IPTW<br/>[fit_outcome.R]"]
  node_aipw["AIPW<br/>[fit_outcome.R]"]
  node_ps_model["Propensity model<br/>[ps_model.R]"]
  node_estimates["Method estimates<br/>[outcome.R]"]
end

subgraph group_diagnostics["Model diagnostics"]
  node_positivity["Positivity check<br/>[positivity.R]"]
  node_balance["Balance check<br/>[balance.R]"]
  node_balance_plot["Balance plot"]
end

subgraph group_reporting["Results and reporting"]
  node_comparison_plot["Comparison plot<br/>[plot_comparison.R]"]
  node_comparison_table["Comparison table<br/>[format.R]"]
  node_tables["Result tables<br/>[tables.R]"]
  node_matched_table["Matched table<br/>[tables_matched.R]"]
end

subgraph group_extensions["Additional analyses"]
  node_subgroup["Subgroup analysis<br/>[subgroup.R]"]
end

node_analyst(("Analyst"))
node_cohort["Analysis cohort"]

node_analyst -->|"specifies analysis"| node_pipeline
node_cohort -->|"provides data"| node_pipeline
node_pipeline -->|"runs method"| node_regression
node_pipeline -->|"runs method"| node_matching
node_pipeline -->|"runs method"| node_stratification
node_pipeline -->|"runs method"| node_iptw
node_pipeline -->|"runs method"| node_aipw
node_pipeline -->|"returns estimates"| node_estimates
node_pipeline -->|"returns model"| node_ps_model
node_pipeline -->|"computes diagnostic"| node_positivity
node_pipeline -->|"computes diagnostic"| node_balance
node_matching -->|"checks matched data"| node_balance
node_ps_model -->|"checks positivity"| node_positivity
node_balance -->|"plots balance"| node_balance_plot
node_estimates -->|"formats comparison"| node_comparison_table
node_analyst -.->|"requests plot"| node_comparison_plot
node_analyst -.->|"requests tables"| node_tables
node_analyst -.->|"requests table"| node_matched_table
node_analyst -.->|"requests analysis"| node_subgroup

click node_pipeline "https://github.com/mostafa-abbas/indepassoc/blob/main/R/pipeline.R"
click node_regression "https://github.com/mostafa-abbas/indepassoc/blob/main/R/fit_outcome.R"
click node_matching "https://github.com/mostafa-abbas/indepassoc/blob/main/R/match.R"
click node_stratification "https://github.com/mostafa-abbas/indepassoc/blob/main/R/fit_outcome.R"
click node_iptw "https://github.com/mostafa-abbas/indepassoc/blob/main/R/fit_outcome.R"
click node_aipw "https://github.com/mostafa-abbas/indepassoc/blob/main/R/fit_outcome.R"
click node_ps_model "https://github.com/mostafa-abbas/indepassoc/blob/main/R/ps_model.R"
click node_estimates "https://github.com/mostafa-abbas/indepassoc/blob/main/R/outcome.R"
click node_positivity "https://github.com/mostafa-abbas/indepassoc/blob/main/R/positivity.R"
click node_balance "https://github.com/mostafa-abbas/indepassoc/blob/main/R/balance.R"
click node_balance_plot "https://github.com/mostafa-abbas/indepassoc/blob/main/R/plot_asmd_balance.R"
click node_comparison_plot "https://github.com/mostafa-abbas/indepassoc/blob/main/R/plot_comparison.R"
click node_comparison_table "https://github.com/mostafa-abbas/indepassoc/blob/main/R/format.R"
click node_tables "https://github.com/mostafa-abbas/indepassoc/blob/main/R/tables.R"
click node_matched_table "https://github.com/mostafa-abbas/indepassoc/blob/main/R/tables_matched.R"
click node_subgroup "https://github.com/mostafa-abbas/indepassoc/blob/main/R/subgroup.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_pipeline,node_regression,node_matching,node_stratification,node_iptw,node_aipw,node_ps_model,node_estimates toneBlue
class node_positivity,node_balance,node_balance_plot toneAmber
class node_comparison_plot,node_comparison_table,node_tables,node_matched_table toneMint
class node_subgroup toneRose
class node_analyst,node_cohort toneIndigo
```

## Components

### Association analysis

- [Analysis pipeline](https://github.com/mostafa-abbas/indepassoc/blob/main/R/pipeline.R): `R/pipeline.R`
- [Regression](https://github.com/mostafa-abbas/indepassoc/blob/main/R/fit_outcome.R): `R/fit_outcome.R`
- [Matching](https://github.com/mostafa-abbas/indepassoc/blob/main/R/match.R): `R/match.R`
- [Stratification](https://github.com/mostafa-abbas/indepassoc/blob/main/R/fit_outcome.R): `R/fit_outcome.R`
- [IPTW](https://github.com/mostafa-abbas/indepassoc/blob/main/R/fit_outcome.R): `R/fit_outcome.R`
- [AIPW](https://github.com/mostafa-abbas/indepassoc/blob/main/R/fit_outcome.R): `R/fit_outcome.R`
- [Propensity model](https://github.com/mostafa-abbas/indepassoc/blob/main/R/ps_model.R): `R/ps_model.R`
- [Method estimates](https://github.com/mostafa-abbas/indepassoc/blob/main/R/outcome.R): `R/outcome.R`

### Model diagnostics

- [Positivity check](https://github.com/mostafa-abbas/indepassoc/blob/main/R/positivity.R): `R/positivity.R`
- [Balance check](https://github.com/mostafa-abbas/indepassoc/blob/main/R/balance.R): `R/balance.R`
- [Balance plot](https://github.com/mostafa-abbas/indepassoc/blob/main/R/plot_asmd_balance.R): `R/plot_asmd_balance.R`

### Results and reporting

- [Comparison plot](https://github.com/mostafa-abbas/indepassoc/blob/main/R/plot_comparison.R): `R/plot_comparison.R`
- [Comparison table](https://github.com/mostafa-abbas/indepassoc/blob/main/R/format.R): `R/format.R`
- [Result tables](https://github.com/mostafa-abbas/indepassoc/blob/main/R/tables.R): `R/tables.R`
- [Matched table](https://github.com/mostafa-abbas/indepassoc/blob/main/R/tables_matched.R): `R/tables_matched.R`

### Additional analyses

- [Subgroup analysis](https://github.com/mostafa-abbas/indepassoc/blob/main/R/subgroup.R): `R/subgroup.R`

### Other components

- **Analyst**
- **Analysis cohort**

## Connections

- Analyst → Analysis pipeline: specifies analysis (evidence: `README.md`)
- Analysis cohort → Analysis pipeline: provides data (evidence: `README.md`)
- Analysis pipeline → Regression: runs method (evidence: `README.md`)
- Analysis pipeline → Matching: runs method (evidence: `README.md`)
- Analysis pipeline → Stratification: runs method (evidence: `README.md`)
- Analysis pipeline → IPTW: runs method (evidence: `README.md`)
- Analysis pipeline → AIPW: runs method (evidence: `README.md`)
- Analysis pipeline → Method estimates: returns estimates (evidence: `README.md`)
- Analysis pipeline → Propensity model: returns model (evidence: `README.md`)
- Analysis pipeline → Positivity check: computes diagnostic (evidence: `README.md`)
- Analysis pipeline → Balance check: computes diagnostic (evidence: `README.md`)
- Matching → Balance check: checks matched data (evidence: `README.md`)
- Propensity model → Positivity check: checks positivity (evidence: `README.md`)
- Balance check → Balance plot: plots balance (evidence: `README.md`)
- Method estimates → Comparison table: formats comparison (evidence: `README.md`)
- Analyst → Comparison plot: requests plot
- Analyst → Result tables: requests tables
- Analyst → Matched table: requests table
- Analyst → Subgroup analysis: requests analysis
