Skip to content

yiyang-gao-1/maihda-r-package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Overview

The maihdaR package provides specialized tools for conducting Multilevel Analysis of Individual Heterogeneity and Discriminatory Accuracy (MAIHDA) in R. MAIHDA is an innovative intersectional approach that uses multilevel models to examine health disparities across multiple intersecting social identities while avoiding the "curse of dimensionality" that affects traditional interaction-based methods.

What is MAIHDA?

MAIHDA is a quantitative intersectional methodology that:

  • πŸ“Š Examines health outcomes across multiple intersecting identities (e.g., race Γ— gender Γ— class Γ— age)
  • 🎯 Quantifies both individual heterogeneity and discriminatory accuracy of social categorizations
  • πŸ“ˆ Uses multilevel models to handle high-dimensional intersectional strata
  • πŸ” Provides measures of how much health variation exists between vs. within social strata

This approach is particularly valuable for health equity research, allowing researchers to move beyond single-axis analyses (examining only race OR gender OR class) to understand how multiple identities interact to shape health outcomes.

Key Features

  • πŸ”§ Stratum Creation: Automated generation of intersectional strata from multiple identity variables

  • πŸ“Š Model Fitting: Streamlined workflows for fitting MAIHDA models with appropriate random effect structures

  • πŸ“ Diagnostic Metrics:

    • Intraclass Correlation Coefficient (ICC) for between-stratum variation
    • Proportional Change in Variance (PCV) for understanding fixed-effect contributions
    • Area Under the Curve (AUC) for discriminatory accuracy
    • Variance Partition Coefficient (VPC) calculations
  • πŸ“ˆ Visualization Tools:

    • Caterpillar plots for stratum-specific effects
    • Interaction plots for intersectional disparities
    • Diagnostic plots for model assessment
  • πŸ“‹ Reporting Functions: Generate publication-ready tables and summaries

Installation

Install the development version of maihdaR from GitHub:

# install.packages("devtools")
devtools::install_github(
  "yiyang-gao-1/maihda-r-package",
  dependencies = TRUE,
  build_vignettes = TRUE
)

Basic Usage

library(maihdaR)

# Load example data (simulated health survey data)
data("health_intersections")

# Create intersectional strata
health_intersections$strata <- create_strata(
  data = health_intersections,
  identity_vars = c("race", "gender", "education", "age_group")
)

# Fit a MAIHDA model
model <- fit_maihda(
  data = health_intersections,
  outcome = "self_rated_health",
  fixed_effects = c("race", "gender", "education", "age_group"),
  strata_var = "strata",
  family = gaussian()  # or binomial() for binary outcomes
)

# Calculate key diagnostics
icc_value <- calculate_icc(model)
print(paste("ICC:", round(icc_value, 3)))

# Visualize stratum effects
plot_strata_effects(model)

Extended Example

# More complex analysis with binary outcome
health_intersections$poor_health <- ifelse(
  health_intersections$self_rated_health < 3, 1, 0
)

# Fit model with binary outcome
model_binary <- fit_maihda(
  data = health_intersections,
  outcome = "poor_health",
  fixed_effects = c("race", "gender", "education", "age_group", "income"),
  strata_var = "strata",
  family = binomial()
)

# Calculate comprehensive diagnostics
diagnostics <- maihda_diagnostics(model_binary)
print(diagnostics)

# Generate report
maihda_report(model_binary, output_format = "html")

Theoretical Background

MAIHDA builds on intersectionality theory (Crenshaw, 1989) and multilevel modeling to address key questions:

  1. Between-stratum variation: How much do health outcomes vary between different intersectional groups?
  2. Discriminatory accuracy: How well do social identities predict individual health outcomes?
  3. Interaction effects: Are intersectional effects more than the sum of their parts?

Key references:

  • Evans, C. R., Leckie, G., Subramanian, S. V., Bell, A., & Merlo, J. (2024). A tutorial for conducting intersectional multilevel analysis of individual heterogeneity and discriminatory accuracy (MAIHDA). SSM – Population Health, 26, 101664.
  • Merlo, J. (2018). Multilevel analysis of individual heterogeneity and discriminatory accuracy (MAIHDA) within an intersectional framework. Social Science & Medicine, 203, 74–80.

Why Use This Package?

While multilevel models can be fit using existing packages like lme4, maihdaR provides:

  • βœ… Specialized functions designed specifically for intersectional analysis
  • βœ… Automated calculations of MAIHDA-specific metrics not readily available elsewhere
  • βœ… Consistent workflows that follow best practices from the MAIHDA literature
  • βœ… Built-in visualizations tailored for presenting intersectional findings
  • βœ… Helper functions for common data preparation tasks in intersectional analysis
  • βœ… Interpretive guides for understanding MAIHDA output in context

Development Roadmap

Current Development (v0.1.0)

  • Basic stratum creation
  • Model fitting wrapper
  • ICC calculation
  • Basic visualization

Planned Features (v0.2.0)

  • PCV and AUC calculations
  • Comprehensive diagnostic functions
  • Advanced plotting capabilities
  • Vignettes with real-world examples

Future Enhancements (v0.3.0+)

  • Power calculation tools
  • Model comparison functions
  • Integration with tidyverse workflows
  • Shiny app for interactive analysis
  • Support for longitudinal MAIHDA

Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • Reporting bugs
  • Suggesting enhancements
  • Submitting pull requests
  • Code of conduct

Getting Help

Citation

If you use maihdaR in your research, please cite:

citation("maihdaR")

Example (to be updated by your package’s CITATION file at release):

To cite package 'maihdaR' in publications use:

  Y Gao (2025). maihdaR: Multilevel Analysis of Individual
  Heterogeneity and Discriminatory Accuracy. R package version 0.1.0.
  https://github.com/yiyang-gao-1/maihda-r-package

A BibTeX entry for LaTeX users is

  @Manual{,
    title  = {maihdaR: Multilevel Analysis of Individual Heterogeneity and Discriminatory Accuracy},
    author = {Yiyang Gao},
    year   = {2025},
    note   = {R package version 0.1.0},
    url    = {https://github.com/yiyang-gao-1/maihda-r-package},
  }

License

This project is licensed under the MIT License β€” see the LICENSE file for details.

Acknowledgments

  • The MAIHDA methodology was developed by Clare R. Evans, Juan Merlo and colleagues
  • This package builds upon the excellent lme4 package for multilevel modeling
  • Inspired by the growing community of intersectional health researchers

Package Status: This package is under active development. Features and interfaces may change. We encourage you to try it out and provide feedback!


About

R package for Multilevel Analysis of Individual Heterogeneity and Discriminatory Accuracy (MAIHDA) - an intersectional approach to health disparities research using multilevel models

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages