# tbaghfalaki/inla-jm-of-zi-event-time architecture

> Architecture diagram of the GitHub repository tbaghfalaki/inla-jm-of-zi-event-time, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tbaghfalaki/inla-jm-of-zi-event-time
- Repository: https://github.com/tbaghfalaki/inla-jm-of-zi-event-time

## Overview

This repository provides R and BUGS implementations for joint zero-inflated count and event-time modeling. Its workflow covers simulated-data generation, model fitting with INLA or OpenBUGS, and plotting estimated curves; it also includes analyses for pregnancy and HIV data. The README documents these capabilities, but no source excerpts were provided, so links are limited to relationships described there and to clear filename matches. The contents and exact use of the archived data files are not shown.

Main entry points: [`data_simulation_ZINB.R`](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/data_simulation_ZINB.R) (Simulate ZINB), [`data_simulation_ZIP.R`](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/data_simulation_ZIP.R) (Simulate ZIP), [`INLA-zinb.R`](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-zinb.R) (INLA ZINB), [`INLA-zip.R`](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-zip.R) (INLA ZIP)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation"]
  node_sim_zinb["Simulate ZINB"]
  node_sim_zip["Simulate ZIP"]
end

subgraph group_inla["INLA fitting"]
  node_inla_zinb["INLA ZINB<br/>[INLA-zinb.R]"]
  node_inla_zip["INLA ZIP<br/>[INLA-zip.R]"]
  node_inla_zinb_pl_bs["INLA ZINB PL spline"]
  node_inla_zinb_pl_tp["INLA ZINB PL basis"]
  node_inla_zip_pl_bs["INLA ZIP PL spline"]
  node_inla_zip_pl_tp["INLA ZIP PL basis"]
end

subgraph group_openbugs["OpenBUGS fitting"]
  node_bugs_zinb["OpenBUGS ZINB<br/>[OpenBUGS-zinb.R]"]
  node_bugs_zip["OpenBUGS ZIP<br/>[OpenBUGS-zip.R]"]
end

subgraph group_data_plot["Data and plots"]
  node_zinb_data["ZINB data"]
  node_zinb_pl_data["ZINB PL data"]
  node_zip_data["ZIP data"]
  node_zip_pl_data["ZIP PL data"]
  node_pregnancy_data["Pregnancy data<br/>[Pregnancy Data.rar]"]
  node_hiv_data["HIV data<br/>[HIV Data.rar]"]
  node_plot["Estimated curve plot<br/>[Plot of output.R]"]
end

node_user(("Analyst"))

node_user -->|"runs"| node_sim_zinb
node_user -->|"runs"| node_sim_zip
node_sim_zinb -->|"generates"| node_zinb_data
node_sim_zinb -->|"generates"| node_zinb_pl_data
node_sim_zip -->|"generates"| node_zip_data
node_sim_zip -->|"generates"| node_zip_pl_data
node_user -->|"fits model"| node_inla_zinb
node_user -->|"fits model"| node_inla_zip
node_user -->|"fits model"| node_inla_zinb_pl_bs
node_user -->|"fits model"| node_inla_zinb_pl_tp
node_user -->|"fits model"| node_inla_zip_pl_bs
node_user -->|"fits model"| node_inla_zip_pl_tp
node_user -->|"fits model"| node_bugs_zinb
node_user -->|"fits model"| node_bugs_zip
node_user -->|"analyzes"| node_pregnancy_data
node_user -->|"analyzes"| node_hiv_data
node_user -->|"draws curve"| node_plot

click node_sim_zinb "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/data_simulation_ZINB.R"
click node_sim_zip "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/data_simulation_ZIP.R"
click node_zinb_data "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/simulated_data_ZINB.txt"
click node_zinb_pl_data "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/simulated_data_ZINB_PL.txt"
click node_zip_data "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/simulated_data_ZIP.txt"
click node_zip_pl_data "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/simulated_data_ZIP_PL.txt"
click node_inla_zinb "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-zinb.R"
click node_inla_zip "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-zip.R"
click node_inla_zinb_pl_bs "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-ZINB-PL-B-spline.R"
click node_inla_zinb_pl_tp "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-ZINB-PL-truncated%20power%20basis.R"
click node_inla_zip_pl_bs "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-ZIP-PL-B-spline.R"
click node_inla_zip_pl_tp "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-ZIP-PL-truncated%20power%20basis.R"
click node_bugs_zinb "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/OpenBUGS-zinb.R"
click node_bugs_zip "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/OpenBUGS-zip.R"
click node_pregnancy_data "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/Pregnancy%20Data.rar"
click node_hiv_data "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/HIV%20Data.rar"
click node_plot "https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/Plot%20of%20output.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_sim_zinb,node_sim_zip toneBlue
class node_inla_zinb,node_inla_zip,node_inla_zinb_pl_bs,node_inla_zinb_pl_tp,node_inla_zip_pl_bs,node_inla_zip_pl_tp toneAmber
class node_bugs_zinb,node_bugs_zip toneMint
class node_zinb_data,node_zinb_pl_data,node_zip_data,node_zip_pl_data,node_pregnancy_data,node_hiv_data,node_plot toneRose
class node_user toneIndigo
```

## Components

### Simulation

- [Simulate ZINB](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/data_simulation_ZINB.R): `data_simulation_ZINB.R`
- [Simulate ZIP](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/data_simulation_ZIP.R): `data_simulation_ZIP.R`

### INLA fitting

- [INLA ZINB](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-zinb.R): `INLA-zinb.R`
- [INLA ZIP](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-zip.R): `INLA-zip.R`
- [INLA ZINB PL spline](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-ZINB-PL-B-spline.R): `INLA-ZINB-PL-B-spline.R`
- [INLA ZINB PL basis](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-ZINB-PL-truncated%20power%20basis.R): `INLA-ZINB-PL-truncated power basis.R`
- [INLA ZIP PL spline](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-ZIP-PL-B-spline.R): `INLA-ZIP-PL-B-spline.R`
- [INLA ZIP PL basis](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/INLA-ZIP-PL-truncated%20power%20basis.R): `INLA-ZIP-PL-truncated power basis.R`

### OpenBUGS fitting

- [OpenBUGS ZINB](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/OpenBUGS-zinb.R): `OpenBUGS-zinb.R`
- [OpenBUGS ZIP](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/OpenBUGS-zip.R): `OpenBUGS-zip.R`

### Data and plots

- [ZINB data](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/simulated_data_ZINB.txt): `simulated_data_ZINB.txt`
- [ZINB PL data](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/simulated_data_ZINB_PL.txt): `simulated_data_ZINB_PL.txt`
- [ZIP data](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/simulated_data_ZIP.txt): `simulated_data_ZIP.txt`
- [ZIP PL data](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/simulated_data_ZIP_PL.txt): `simulated_data_ZIP_PL.txt`
- [Pregnancy data](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/Pregnancy%20Data.rar): `Pregnancy Data.rar`
- [HIV data](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/HIV%20Data.rar): `HIV Data.rar`
- [Estimated curve plot](https://github.com/tbaghfalaki/inla-jm-of-zi-event-time/blob/master/Plot%20of%20output.R): `Plot of output.R`

### Other components

- **Analyst**

## Connections

- Analyst → Simulate ZINB: runs (evidence: `README.md`)
- Analyst → Simulate ZIP: runs (evidence: `README.md`)
- Simulate ZINB → ZINB data: generates (evidence: `README.md`)
- Simulate ZINB → ZINB PL data: generates (evidence: `README.md`)
- Simulate ZIP → ZIP data: generates (evidence: `README.md`)
- Simulate ZIP → ZIP PL data: generates (evidence: `README.md`)
- Analyst → INLA ZINB: fits model (evidence: `README.md`)
- Analyst → INLA ZIP: fits model (evidence: `README.md`)
- Analyst → INLA ZINB PL spline: fits model (evidence: `README.md`)
- Analyst → INLA ZINB PL basis: fits model (evidence: `README.md`)
- Analyst → INLA ZIP PL spline: fits model (evidence: `README.md`)
- Analyst → INLA ZIP PL basis: fits model (evidence: `README.md`)
- Analyst → OpenBUGS ZINB: fits model (evidence: `README.md`)
- Analyst → OpenBUGS ZIP: fits model (evidence: `README.md`)
- Analyst → Pregnancy data: analyzes (evidence: `README.md`)
- Analyst → HIV data: analyzes (evidence: `README.md`)
- Analyst → Estimated curve plot: draws curve (evidence: `README.md`)
