# mlondschien/ivmodels architecture

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

- Interactive diagram: https://gitdiagram.com/mlondschien/ivmodels
- Repository: https://github.com/mlondschien/ivmodels

## Overview

##### Main Components

a. Core Estimation Components:
- K-Class Estimators Module
- Test Statistics Module
- Confidence Sets Module
- Model Implementation Layer

b. Supporting Components:
- Utility Functions
- Simulation Tools
- Data Processing Layer

##### Specific Components to Highlight

Models Package:
**[K-Class Estimators] -- includes --> [LIML]**
- includes --> [TSLS]
**[Anchor Regression]**
**[PULSE]**
**[Space IV]**

Tests Package:
**[Anderson-Rubin Test]**
**[Lagrange Multiplier Test]**
**[Likelihood Ratio Test]**
**[Conditional Likelihood Ratio Test]**
**[Wald Test]**
**[J-Test]**
**[Rank Test]**

##### Important Elements to Emphasize

a. Relationship between:
- Models and their corresponding tests
- Confidence set calculations and test statistics
- Simulation utilities and model implementations

b. Modular nature of:
- Different estimator types
- Various test statistics
- Utility functions

## Diagram (Mermaid)

```mermaid
graph TD
    %% Styles and classes
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef test fill:#4CAF50,stroke:#2E7D32,color:white
    classDef util fill:#FFC107,stroke:#FFA000,color:black
    classDef infra fill:#9C27B0,stroke:#6A1B9A,color:white
    
    %% Main Layers
    subgraph Public_API
        API[Public API Interface]
    end
    
    subgraph Core_Implementation
        Models[Model Implementation Layer]
        Tests[Test Statistics Module]
        ConfSets[Confidence Sets Module]
    end
    
    subgraph Infrastructure
        Utils[Utility Functions]
        Sim[Simulation Tools]
        Quad[Quadric Computations]
        Summary[Summary Statistics]
    end
    
    %% Model Components
    subgraph Models_Detail
        KClass[K-Class Estimators]
        Anchor[Anchor Regression]
        Pulse[PULSE Estimator]
        SpaceIV[Space IV]
    end
    
    %% Test Components
    subgraph Tests_Detail
        AR[Anderson-Rubin Test]
        LM[Lagrange Multiplier Test]
        LR[Likelihood Ratio Test]
        CLR[Conditional LR Test]
        Wald[Wald Test]
        JTest[J-Test]
        RankTest[Rank Test]
    end
    
    %% Relationships
    API --> Models
    API --> Tests
    API --> ConfSets
    
    Models --> Models_Detail
    Tests --> Tests_Detail
    
    Models_Detail --> Utils
    Models_Detail --> Quad
    Tests_Detail --> Utils
    Tests_Detail --> Quad
    ConfSets --> Tests
    
    Utils --> Sim
    Utils --> Summary
    
    %% Styling
    class Models,KClass,Anchor,Pulse,SpaceIV core
    class Tests,AR,LM,LR,CLR,Wald,JTest,RankTest test
    class Utils,Summary util
    class Sim,Quad infra
    
    %% Click events
    click Models "https://github.com/mlondschien/ivmodels/tree/main/ivmodels/models/"
    click KClass "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/models/kclass.py"
    click Tests "https://github.com/mlondschien/ivmodels/tree/main/ivmodels/tests/"
    click ConfSets "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/confidence_set.py"
    click Utils "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/utils.py"
    click Sim "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/simulate.py"
    click Quad "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/quadric.py"
    click AR "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/tests/anderson_rubin.py"
    click LM "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/tests/lagrange_multiplier.py"
    click LR "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/tests/likelihood_ratio.py"
    click CLR "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/tests/conditional_likelihood_ratio.py"
    click Wald "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/tests/wald.py"
    click JTest "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/tests/j.py"
    click RankTest "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/tests/rank.py"
    click Anchor "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/models/anchor_regression.py"
    click Pulse "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/models/pulse.py"
    click SpaceIV "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/models/space_iv.py"
    click Summary "https://github.com/mlondschien/ivmodels/blob/main/ivmodels/summary.py"
```
