# muhammedalkhalaf/qardlr architecture

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

- Interactive diagram: https://gitdiagram.com/muhammedalkhalaf/qardlr
- Repository: https://github.com/muhammedalkhalaf/qardlr

## Overview

qardlr is an R package for quantile autoregressive distributed-lag modeling. Its primary workflow is to estimate a model, inspect its results, test parameter constancy, and produce a publication-ready table. Separate documented capabilities support lag selection, ECM form, rolling stability analysis, and Monte Carlo simulation. The README documents these user-facing relationships, but no source excerpts were provided, so internal calls between implementation modules are not asserted.

Main entry points: [`R/qardl.R`](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl.R) (QARDL estimation), [`R/qardl_print.R`](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_print.R) (Result presentation), [`R/qardl_rolling.R`](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_rolling.R) (Rolling estimation), [`R/qardl_bic.R`](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_bic.R) (BIC lag selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_estimation["Model estimation"]
  node_qardl["QARDL estimation<br/>[qardl.R]"]
  node_bic["BIC lag selection<br/>[qardl_bic.R]"]
  node_cks["QARDL estimation core<br/>[qardl_cks.R]"]
  node_ecm["ECM utilities<br/>[qardl_utils.R]"]
end

subgraph group_analysis["Model analysis"]
  node_wald["Constancy tests<br/>[qardl_wald.R]"]
  node_rolling["Rolling estimation<br/>[qardl_rolling.R]"]
  node_simulation["Monte Carlo simulation<br/>[qardl_simulate.R]"]
end

subgraph group_outputs["Results and output"]
  node_printing["Result presentation<br/>[qardl_print.R]"]
end

node_researcher(("Researcher"))

node_researcher -->|"estimates model"| node_qardl
node_qardl -->|"selects lags"| node_bic
node_researcher -->|"tests constancy"| node_wald
node_researcher -->|"estimates rolling"| node_rolling
node_researcher -->|"runs simulation"| node_simulation
node_researcher -->|"formats results"| node_printing
node_qardl -->|"summarizes fit"| node_printing
node_rolling -->|"plots estimates"| node_printing

click node_qardl "https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl.R"
click node_bic "https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_bic.R"
click node_cks "https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_cks.R"
click node_ecm "https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_utils.R"
click node_wald "https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_wald.R"
click node_rolling "https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_rolling.R"
click node_simulation "https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_simulate.R"
click node_printing "https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_print.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_qardl,node_bic,node_cks,node_ecm toneBlue
class node_wald,node_rolling,node_simulation toneAmber
class node_printing toneMint
class node_researcher toneIndigo
```

## Components

### Model estimation

- [QARDL estimation](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl.R): `R/qardl.R`
- [BIC lag selection](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_bic.R): `R/qardl_bic.R`
- [QARDL estimation core](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_cks.R): `R/qardl_cks.R`
- [ECM utilities](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_utils.R): `R/qardl_utils.R`

### Model analysis

- [Constancy tests](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_wald.R): `R/qardl_wald.R`
- [Rolling estimation](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_rolling.R): `R/qardl_rolling.R`
- [Monte Carlo simulation](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_simulate.R): `R/qardl_simulate.R`

### Results and output

- [Result presentation](https://github.com/muhammedalkhalaf/qardlr/blob/main/R/qardl_print.R): `R/qardl_print.R`

### Other components

- **Researcher**

## Connections

- Researcher → QARDL estimation: estimates model (evidence: `README.md`)
- QARDL estimation → BIC lag selection: selects lags (evidence: `README.md`)
- Researcher → Constancy tests: tests constancy (evidence: `README.md`)
- Researcher → Rolling estimation: estimates rolling (evidence: `README.md`)
- Researcher → Monte Carlo simulation: runs simulation (evidence: `README.md`)
- Researcher → Result presentation: formats results (evidence: `README.md`)
- QARDL estimation → Result presentation: summarizes fit (evidence: `README.md`)
- Rolling estimation → Result presentation: plots estimates (evidence: `README.md`)
