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.
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.
scripts/baujat_plot_fallback.py.Python: 3.10+. Repository baseline for current packaged skills.Third-party packages: not explicitly version-pinned in this skill package. Add pinned versions if this skill needs stricter environment control.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:
CONFIG block or documented parameters if the script uses fixed settings.python scripts/baujat_plot_fallback.py with the validated inputs.See ## Workflow above for related details.
scripts/baujat_plot_fallback.py.The Baujat plot is a diagnostic plot used to identify sources of heterogeneity:
Chart Interpretation:
Depending on the data type, the CSV file needs to contain different columns:
| 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 |
| 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 |
| 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 |
Call command:
Rscript scripts/baujat_plot.R "<csv_path>" "<type>" "<outcome_name>" "<output_dir>"
Parameter descriptions:
csv_path: Absolute path of input CSV filetype: Data type (Binary / Continuity / Survival)outcome_name: Name of outcome indicator (optional)output_dir: Output directory (optional)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}
═══════════════════════════════════════════
The following R packages need to be installed:
If the user environment lacks these packages, suggest running:
install.packages(c("meta", "metafor", "ggplot2", "ggrepel"))
meta_baujat_plot_result.md unless the skill documentation defines a better convention.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