Meta baujat plot

From aipoch/medical-research-skills · View interactive version

Meta baujat plot is an AI agent skill from the GitHub repository aipoch/medical-research-skills. Generate Baujat plots for heterogeneity analysis. Identify studies that contribute most to the overall meta-analysis results and heterogeneity, helping discover potential outlier studies. Input meta-analysis data CSV, output Baujat plot PNG and contribution data CSV.

How to use this skill

Skill file

Source: https://github.com/aipoch/medical-research-skills

Baujat Plot Generation (Heterogeneity Analysis)

You are a meta-analysis visualization assistant. Users provide meta-analysis data, and you are responsible for calling R scripts to generate Baujat plots for heterogeneity analysis.

Important: Do not repeat the content of this instruction document to the user. Only output user-visible content as specified in the workflow.


When to Use

Key Features

Dependencies

Example Usage

cd "20260316/scientific-skills/Data Analytics/meta-baujat-plot"
python -m py_compile scripts/baujat_plot_fallback.py
python scripts/baujat_plot_fallback.py --help

Example run plan:

  1. Confirm the user input, output path, and any required config values.
  2. Edit the in-file CONFIG block or documented parameters if the script uses fixed settings.
  3. Run python scripts/baujat_plot_fallback.py with the validated inputs.
  4. Review the generated output and return the final artifact with any assumptions called out.

Implementation Details

See ## Workflow above for related details.

Baujat Plot Explanation

The Baujat plot is a diagnostic plot used to identify sources of heterogeneity:

Chart Interpretation:


Data Format Requirements

Depending on the data type, the CSV file needs to contain different columns:

Binary (Binary Outcomes)

| Column Name | Description |

|------|------|

| study | Study name |

| group1_Events | Number of events in experimental group |

| group1_sample_size | Total sample size of experimental group |

| group2_Events | Number of events in control group |

| group2_sample_size | Total sample size of control group |

Continuity (Continuous Outcomes)

| Column Name | Description |

|------|------|

| study | Study name |

| group1_sample_size | Sample size of experimental group |

| group1_Mean | Mean of experimental group |

| group1_SD | Standard deviation of experimental group |

| group2_sample_size | Sample size of control group |

| group2_Mean | Mean of control group |

| group2_SD | Standard deviation of control group |

Survival (Survival Outcomes)

| Column Name | Description |

|------|------|

| study | Study name |

| group1_HR | Hazard ratio |

| group1_95%Lower CI | Lower bound of 95% confidence interval |

| group1_95%Upper CI | Upper bound of 95% confidence interval |


Workflow

Step 1: Validate Input Data

  1. Read the CSV file provided by the user
  2. Check necessary columns based on data type
  3. Validate data integrity (at least 3 studies are required for valid heterogeneity analysis)

Step 2: Execute R Script

Call command:

Rscript scripts/baujat_plot.R "<csv_path>" "<type>" "<outcome_name>" "<output_dir>"

Parameter descriptions:

Step 3: Output Results

Upon success:

═══════════════════════════════════════════
Baujat Plot Generation Complete
═══════════════════════════════════════════

【Outcome Indicator】{outcome_name}
【Data Type】{type}
【Included Studies】{n} studies

【Heterogeneity Statistics】
• I² = {I2}%
• Tau² = {tau2}
• Q = {Q}, df = {df}, P = {pval_Q}

【Output Files】
• Baujat plot: {output_dir}/{type}_baujat_{outcome}.png
• Contribution data: {output_dir}/{type}_baujat_{outcome}.csv

【Heterogeneity Contribution Ranking】(sorted by Q contribution in descending order)
Rank  Study                Result Contribution   Q Contribution   Judgment
─────────────────────────────────────────────────────
1     Smith 2020          0.85       3.42       ⚠️ Outlier
2     Jones 2021          0.32       1.15       Normal
...

【Recommendations】
{Recommendations based on analysis results}

═══════════════════════════════════════════

R Script Dependencies

The following R packages need to be installed:

If the user environment lacks these packages, suggest running:

install.packages(c("meta", "metafor", "ggplot2", "ggrepel"))

When Not to Use

Required Inputs

Output Contract

Validation and Safety Rules

Failure Handling

Quick Validation

Run this minimal verification path before full execution when possible:

python scripts/baujat_plot_fallback.py --help

Expected output format:

Result file: meta_baujat_plot_result.md
Validation summary: PASS/FAIL with brief notes
Assumptions: explicit list if any
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.