[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ECP95T7ZCF9DY7GW4S3125":3,"skill-same:01M7ECP95T7ZCF9DY7GW4S3125":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":14,"repositoryHtmlUrl":33,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":35,"install":36,"resources":49},"01M7ECP95T7ZCF9DY7GW4S3125","bio-data-visualization-forest-funnel-plots",null,"Build forest plots (HR, OR, RR, beta-coefficient summaries with CIs) and funnel plots (meta-analysis publication-bias diagnostics) using forestplot, metafor, ggforest, and MendelianRandomization with proper axis-scaling, summary-diamond placement, subgroup nesting, and Egger \u002F trim-and-fill asymmetry tests. Use when summarizing effects across subgroups, trials, or instruments — meta-analysis, Mendelian randomization, subgroup HRs.","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-forest-funnel-plots\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-data-visualization-forest-funnel-plots\ndescription: Build forest plots (HR, OR, RR, beta-coefficient summaries with CIs) and funnel plots (meta-analysis publication-bias diagnostics) using forestplot, metafor, ggforest, and MendelianRandomization with proper axis-scaling, summary-diamond placement, subgroup nesting, and Egger \u002F trim-and-fill asymmetry tests. Use when summarizing effects across subgroups, trials, or instruments — meta-analysis, Mendelian randomization, subgroup HRs.\ntool_type: r\nprimary_tool: metafor\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"data-visualization\u002Fforest-funnel-plots\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: metafor 4.4+, forestplot 3.1+, ggforestplot 0.1+ (subgroup forests), ggforest from survminer 0.4.9+, MendelianRandomization 0.10+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name`\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.\n\n# Forest and Funnel Plots\n\n**\"Summarize effects across studies \u002F subgroups\"** -> Render each effect estimate (HR, OR, RR, β) as a square (size = inverse variance \u002F weight), horizontal bar (95% CI), and label, with an optional summary diamond at the bottom from a meta-analysis pool (fixed-effect or random-effects). The funnel plot diagnoses publication bias by plotting effect size vs precision; asymmetry indicates missing small-study-with-null-result publications (Egger 1997).\n\n- R: `metafor::forest`, `metafor::funnel`, `forestplot::forestplot`, `survminer::ggforest` (Cox HR forests), `MendelianRandomization::mr_forest`\n\n## The Single Most Important Modern Insight -- Heterogeneity Is the First Question\n\nA pooled effect estimate is meaningless if the underlying studies are heterogeneous. The Higgins I² statistic (Higgins-Thompson 2002 *Stat Med* 21:1539) quantifies between-study variance; the conventional 25\u002F50\u002F75% interpretation tiers come from the Cochrane Handbook §10.10.2 (Higgins et al editors), NOT the original Higgins-Thompson paper which cautioned against rigid cutoffs. A meta-analysis with I² > 75% and a pooled effect must explain the heterogeneity (subgroup analysis, meta-regression) — pooling without explanation is statistically defensible but biologically unhelpful.\n\nA forest plot's bottom must report: pooled estimate + 95% CI + I² + τ² (between-study variance) + Q-test p-value. Without these, the plot is a list of effects, not a meta-analysis.\n\n## Decision Tree by Analysis Type\n\n| Analysis | Tool | Pooling model | Forest method |\n|----------|------|---------------|---------------|\n| Single-trial subgroup HRs | survminer::ggforest | None (subgroup display) | Coxph object |\n| Meta-analysis of binary outcomes | metafor::rma -> forest() | DerSimonian-Laird or REML random-effects | Standard forest |\n| Meta-analysis of continuous outcomes | metafor::rma(yi, vi) | REML random-effects | Standard forest |\n| Mendelian randomization | MendelianRandomization::mr_forest | Multiple MR methods | MR-specific forest |\n| Subgroup forest with interaction p | metafor::rma + addpoly + interaction model | Subgroup REML | Nested forest |\n| Network meta-analysis | netmeta::forest.netmeta | Bayesian or frequentist | Network forest |\n| Cumulative meta-analysis (over time) | metafor::cumul + forest | – | Cumulative forest |\n\n## Fixed-Effect vs Random-Effects Meta-Analysis\n\n| Model | Assumption | When appropriate | Pooled estimate weight |\n|-------|------------|-------------------|------------------------|\n| Fixed-effect (Mantel-Haenszel, IVS) | All studies estimate the same true effect | Single mechanism, homogeneous design | 1 \u002F within-study variance |\n| Random-effects (DerSimonian-Laird, REML) | Studies estimate distinct true effects from a common distribution | Heterogeneous designs \u002F populations | 1 \u002F (within + between variance) |\n\n**Use random-effects by default.** Fixed-effect assumes all studies estimate the *same* parameter, which is almost never true across multi-center trials with different populations. REML is the modern default (Viechtbauer 2005); DerSimonian-Laird is the older default still commonly seen.\n\n## metafor::rma + forest -- The Reference Implementation\n\n**Goal:** Pool study-level effect estimates with random-effects meta-analysis; render a forest plot with study weights, individual effect+CI, and pooled summary diamond.\n\n**Approach:** Compute per-study yi (effect) and vi (sampling variance); fit REML random-effects model; pass to forest() with prediction interval if heterogeneity is non-trivial.\n\n```r\nlibrary(metafor)\n\n# Input: per-study effect (yi) and variance (vi)\n# For OR: yi = log(OR), vi = SE(log(OR))^2\n# For HR: yi = log(HR), vi = SE(log(HR))^2\nres \u003C- rma(yi = log_or, vi = log_or_se^2,\n           data = studies, slab = paste(author, year),\n           method = 'REML')\n\n# I^2 and tau^2 in the summary\nsummary(res)\n# I^2 (residual heterogeneity)\n# tau^2 (estimated amount of (residual) heterogeneity)\n# Q-test for heterogeneity\n\nforest(res,\n       atransf = exp,                           # display OR on natural scale\n       at = log(c(0.25, 0.5, 1, 2, 4)),         # ticks at meaningful OR values\n       refline = 0,                              # log(1) for OR\u002FHR\u002FRR\n       xlab = 'Odds Ratio (95% CI)',\n       header = c('Study', 'OR [95% CI]'),\n       mlab = bquote(paste('RE Model (Q = ', .(round(res$QE, 2)),\n                            ', df = ', .(res$k - 1),\n                            ', p = ', .(format.pval(res$QEp, digits = 2)),\n                            '; ', I^2, ' = ', .(round(res$I2, 1)), '%)')),\n       addpred = TRUE)                          # prediction interval per Higgins 2009\n```\n\n`addpred = TRUE` adds a 95% prediction interval — where a new study's effect is expected to fall (Higgins-Thompson-Spiegelhalter 2009 *JRSS-A*). This is the most honest summary when I² > 30%.\n\n## ggforest for Cox Subgroup Forests\n\n```r\nlibrary(survminer)\nfit \u003C- coxph(Surv(time, status) ~ treatment + age + sex + stage, data = df)\nggforest(fit,\n         data = df,\n         main = 'Subgroup HRs',\n         cpositions = c(0.02, 0.22, 0.4),\n         fontsize = 0.7,\n         refLabel = 'Reference',\n         noDigits = 2)\n```\n\nggforest produces a publication-ready subgroup forest from a coxph object. For pre-specified subgroup analyses (treatment × subgroup interaction), test interaction explicitly and annotate the p-value.\n\n## Small-k Regime -- When Meta-Analysis Asymptotics Break\n\nFor k \u003C 5 studies, the REML-based 95% CI from `metafor::rma()` is severely anti-conservative — it relies on chi-square asymptotics that fail with few studies. Use **Hartung-Knapp-Sidik-Jonkman (HKSJ)** adjustment (`test = 'knha'`):\n\n```r\nres_hksj \u003C- rma(yi = log_or, vi = log_or_se^2, data = studies,\n                method = 'REML', test = 'knha')           # HKSJ for k\u003C5\n```\n\nHKSJ uses a t-distribution with k-1 degrees of freedom and adjusts SE via the Q-statistic — well-calibrated even at k=3. For k \u003C 3 a meta-analysis is not advisable; report individual study effects in a forest plot without a pooled summary.\n\nAlso: I² is uninterpretable below k = 5 (Borenstein 2017 *Res Synth Methods* 8:5); the point estimate has wide CI dominated by k itself, not heterogeneity. **Do not report I² for k \u003C 5.**\n\n## Funnel Plot and Egger Test\n\n**Goal:** Diagnose publication bias by visual asymmetry of effect size vs precision.\n\n**Approach:** Plot effect (x) vs SE (inverted y); under no bias, points form a symmetric inverted funnel with the pooled estimate at the apex. Asymmetry suggests missing small-N null-result studies. Egger's regression test (Egger 1997 *BMJ* 315:629) formalizes the asymmetry.\n\n```r\nfunnel(res,\n       xlab = 'log(OR)',\n       refline = res$b)\n\n# Egger's test\nregtest(res, model = 'lm', predictor = 'sei')\n# significant p indicates asymmetry; suggests publication bias\n\n# Trim-and-fill (Duval-Tweedie 2000) -- adjusts for asymmetry\nres_tf \u003C- trimfill(res)\nforest(res_tf)\nfunnel(res_tf)\n```\n\n**Contour-enhanced funnel plot** (Peters 2008 *J Clin Epidemiol* 61:991) overlays significance contours (p \u003C 0.10, \u003C 0.05, \u003C 0.01); asymmetry concentrated in \"non-significant\" regions indicates publication bias more specifically than generic asymmetry.\n\n```r\nfunnel(res, level = c(90, 95, 99), shade = c('white', 'gray55', 'gray75'),\n       refline = 0, legend = TRUE)\n```\n\n## Per-Method Failure Modes\n\n### Pooling under high heterogeneity without explanation\n\n**Trigger:** Random-effects meta-analysis pooled with I² > 75%; no subgroup or meta-regression.\n\n**Mechanism:** Pooled estimate is a weighted average across substantively different effects; biologically meaningless.\n\n**Symptom:** Pooled OR = 1.5 with 95% CI (1.2-1.8) but per-study effects range 0.3-5.0.\n\n**Fix:** Run subgroup analysis or meta-regression to explain heterogeneity; report I², τ², and prediction interval; do NOT report a single pooled effect as the answer.\n\n### Fixed-effect when studies are heterogeneous\n\n**Trigger:** Default fixed-effect model on multi-population data.\n\n**Mechanism:** Fixed-effect weights = 1\u002Fwithin-study variance, ignoring between-study variance.\n\n**Symptom:** CI is misleadingly narrow; reviewer asks \"why fixed effect with high I²?\"\n\n**Fix:** Switch to REML random-effects (`method = 'REML'`); document the choice.\n\n### Egger test p-value over-interpreted\n\n**Trigger:** k \u003C 10 studies; significant Egger p taken as definitive publication bias.\n\n**Mechanism:** Egger's test is underpowered with few studies; sensitive to single outliers.\n\n**Symptom:** Conclusion \"publication bias\" from k=6 trials.\n\n**Fix:** Egger requires k ≥ 10 (Sterne 2011 *BMJ* 343:d4002); for fewer studies, visual funnel + contour-enhanced funnel is more reliable.\n\n### Trim-and-fill imputed studies presented as data\n\n**Trigger:** Reporting trim-and-fill adjusted estimate as \"the answer.\"\n\n**Mechanism:** Trim-and-fill is a sensitivity analysis; imputed studies are hypothetical.\n\n**Symptom:** Original pooled OR = 2.0; trim-and-fill adjusted to 1.5; report says \"adjusted estimate is 1.5.\"\n\n**Fix:** Present original AND trim-and-fill side-by-side; trim-and-fill is sensitivity, not primary.\n\n### Subgroup forest without interaction test\n\n**Trigger:** Subgroup HRs plotted; conclusion \"treatment works in subgroup X.\"\n\n**Mechanism:** Visual differences across subgroups don't establish significant interaction.\n\n**Symptom:** Subgroup forest shows HR=0.5 in subgroup A, HR=1.0 in subgroup B; no formal test.\n\n**Fix:** Add treatment × subgroup interaction term to the model; report interaction p; cite Brookes 2001 \u002F Wang 2007 for subgroup analysis caveats.\n\n### Forest plot axis on linear scale for ratios\n\n**Trigger:** OR\u002FHR\u002FRR plotted with linear x-axis.\n\n**Mechanism:** Ratios are multiplicatively symmetric; linear axis compresses \u003C 1 effects.\n\n**Symptom:** OR = 0.5 (halving) appears smaller than OR = 2 (doubling) on a linear scale, even though they are biologically equivalent.\n\n**Fix:** Always log-scale the x-axis for ratios. metafor's `atransf = exp` + `at = log(c(0.25, 0.5, 1, 2, 4))` is the canonical pattern.\n\n### Weights not visible (point sizes uniform)\n\n**Trigger:** Default forestplot package without weight encoding.\n\n**Mechanism:** Reader cannot tell study influence on pool.\n\n**Symptom:** A 5-patient pilot looks visually equivalent to a 5000-patient trial.\n\n**Fix:** Use metafor `forest()` which auto-encodes weight via box size. forestplot package needs `boxsize =` argument.\n\n## Reconciliation: When Methods Disagree\n\n| Pattern | Cause | Action |\n|---------|-------|--------|\n| Fixed-effect significant; random-effects n.s. | High heterogeneity inflates RE variance | Trust random-effects when I² > 30% |\n| Egger n.s. but funnel looks asymmetric | k \u003C 10 -> Egger underpowered | Trust visual; report contour-enhanced funnel |\n| Trim-and-fill imputes many studies | Severe asymmetry | Caution; sensitivity, not primary |\n| Subgroup forest suggests effect modification; interaction test n.s. | Visual difference does not establish formal interaction | Trust interaction test |\n| MR forest shows divergent estimates across methods | Pleiotropy or weak instruments | Run MR-Egger, weighted median, mode-based (sensitivity); cite Bowden 2015 |\n\n## Quantitative Thresholds\n\n| Threshold | Value | Source |\n|-----------|-------|--------|\n| I² substantial heterogeneity | > 50% | Cochrane Handbook §10.10.2 (Higgins et al editors) |\n| I² considerable heterogeneity | > 75% | Cochrane Handbook §10.10.2 (Higgins et al editors) |\n| Egger test min k | ≥ 10 | Sterne 2011 *BMJ* |\n| Prediction interval (where new study lands) | report when I² > 30% | Higgins-Thompson-Spiegelhalter 2009 |\n| Forest x-axis | log scale for ratios | Convention |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Pooled estimate with I² = 90% | No heterogeneity exploration | Subgroup \u002F meta-regression |\n| Linear x-axis for OR forest | Ratios should be log-symmetric | `atransf = exp, at = log(...)` |\n| Uniform point sizes | Weights not encoded | metafor::forest auto-encodes; forestplot needs boxsize |\n| Egger from k=5 | Underpowered | k ≥ 10 for Egger |\n| Trim-and-fill as primary | Sensitivity, not primary | Present both; document |\n| Subgroup effect without interaction test | Visual ≠ test | Add interaction term |\n| MR forest with single method | Pleiotropy risk | Triangulate methods |\n\n## References\n\n- Bowden J, Davey Smith G, Burgess S. 2015. Mendelian randomization with invalid instruments: effect estimation and bias detection through Egger regression. *Int J Epidemiol* 44(2):512-525.\n- Brookes ST, Whitley E, Peters TJ, et al. 2001. Subgroup analyses in randomised controlled trials: quantifying the risks of false-positives and false-negatives. *Health Technol Assess* 5(33):1-56.\n- DerSimonian R, Laird N. 1986. Meta-analysis in clinical trials. *Control Clin Trials* 7(3):177-188.\n- Duval S, Tweedie R. 2000. Trim and fill: a simple funnel-plot–based method of testing and adjusting for publication bias in meta-analysis. *Biometrics* 56:455-463.\n- Egger M, Davey Smith G, Schneider M, Minder C. 1997. Bias in meta-analysis detected by a simple, graphical test. *BMJ* 315(7109):629-634.\n- Higgins JPT, Thompson SG. 2002. Quantifying heterogeneity in a meta-analysis. *Stat Med* 21(11):1539-1558.\n- Higgins JPT, Thompson SG, Spiegelhalter DJ. 2009. A re-evaluation of random-effects meta-analysis. *JRSS-A* 172(1):137-159.\n- Peters JL, Sutton AJ, Jones DR, Abrams KR, Rushton L. 2008. Contour-enhanced meta-analysis funnel plots help distinguish publication bias from other causes of asymmetry. *J Clin Epidemiol* 61(10):991-996.\n- Sterne JAC, Sutton AJ, Ioannidis JPA, et al. 2011. Recommendations for examining and interpreting funnel plot asymmetry in meta-analyses of randomised controlled trials. *BMJ* 343:d4002.\n- Viechtbauer W. 2010. Conducting meta-analyses in R with the metafor package. *J Stat Softw* 36(3):1-48.\n- Hartung J, Knapp G. 2001. A refined method for the meta-analysis of controlled clinical trials with binary outcome. *Stat Med* 20(24):3875-3889.\n- IntHout J, Ioannidis JPA, Borm GF. 2014. The Hartung-Knapp-Sidik-Jonkman method for random effects meta-analysis is straightforward and considerably outperforms the standard DerSimonian-Laird method. *BMC Med Res Methodol* 14:25.\n- Borenstein M, Higgins JPT, Hedges LV, Rothstein HR. 2017. Basics of meta-analysis: I² is not an absolute measure of heterogeneity. *Res Synth Methods* 8(1):5-18.\n- Higgins JPT, Thomas J, Chandler J, et al (editors). *Cochrane Handbook for Systematic Reviews of Interventions* (current version). Section 10.10.2 — interpretation tiers for I².\n\n## Related Skills\n\n- clinical-biostatistics\u002Feffect-measures - HR \u002F OR \u002F RR \u002F NNT definitions\n- clinical-biostatistics\u002Fsubgroup-analysis - Interaction tests for subgroup HRs\n- causal-genomics\u002Fmendelian-randomization - MR-specific forest + sensitivity\n- clinical-biostatistics\u002Ftrial-reporting - CONSORT and meta-analysis reporting\n- data-visualization\u002Fcolor-palettes - Palette for multi-study or subgroup forests\n","## Version Compatibility\n\nReference examples tested with: metafor 4.4+, forestplot 3.1+, ggforestplot 0.1+ (subgroup forests), ggforest from survminer 0.4.9+, MendelianRandomization 0.10+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name`\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.\n\n# Forest and Funnel Plots\n\n**\"Summarize effects across studies \u002F subgroups\"** -> Render each effect estimate (HR, OR, RR, β) as a square (size = inverse variance \u002F weight), horizontal bar (95% CI), and label, with an optional summary diamond at the bottom from a meta-analysis pool (fixed-effect or random-effects). The funnel plot diagnoses publication bias by plotting effect size vs precision; asymmetry indicates missing small-study-with-null-result publications (Egger 1997).\n\n- R: `metafor::forest`, `metafor::funnel`, `forestplot::forestplot`, `survminer::ggforest` (Cox HR forests), `MendelianRandomization::mr_forest`\n\n## The Single Most Important Modern Insight -- Heterogeneity Is the First Question\n\nA pooled effect estimate is meaningless if the underlying studies are heterogeneous. The Higgins I² statistic (Higgins-Thompson 2002 *Stat Med* 21:1539) quantifies between-study variance; the conventional 25\u002F50\u002F75% interpretation tiers come from the Cochrane Handbook §10.10.2 (Higgins et al editors), NOT the original Higgins-Thompson paper which cautioned against rigid cutoffs. A meta-analysis with I² > 75% and a pooled effect must explain the heterogeneity (subgroup analysis, meta-regression) — pooling without explanation is statistically defensible but biologically unhelpful.\n\nA forest plot's bottom must report: pooled estimate + 95% CI + I² + τ² (between-study variance) + Q-test p-value. Without these, the plot is a list of effects, not a meta-analysis.\n\n## Decision Tree by Analysis Type\n\n| Analysis | Tool | Pooling model | Forest method |\n|----------|------|---------------|---------------|\n| Single-trial subgroup HRs | survminer::ggforest | None (subgroup display) | Coxph object |\n| Meta-analysis of binary outcomes | metafor::rma -> forest() | DerSimonian-Laird or REML random-effects | Standard forest |\n| Meta-analysis of continuous outcomes | metafor::rma(yi, vi) | REML random-effects | Standard forest |\n| Mendelian randomization | MendelianRandomization::mr_forest | Multiple MR methods | MR-specific forest |\n| Subgroup forest with interaction p | metafor::rma + addpoly + interaction model | Subgroup REML | Nested forest |\n| Network meta-analysis | netmeta::forest.netmeta | Bayesian or frequentist | Network forest |\n| Cumulative meta-analysis (over time) | metafor::cumul + forest | – | Cumulative forest |\n\n## Fixed-Effect vs Random-Effects Meta-Analysis\n\n| Model | Assumption | When appropriate | Pooled estimate weight |\n|-------|------------|-------------------|------------------------|\n| Fixed-effect (Mantel-Haenszel, IVS) | All studies estimate the same true effect | Single mechanism, homogeneous design | 1 \u002F within-study variance |\n| Random-effects (DerSimonian-Laird, REML) | Studies estimate distinct true effects from a common distribution | Heterogeneous designs \u002F populations | 1 \u002F (within + between variance) |\n\n**Use random-effects by default.** Fixed-effect assumes all studies estimate the *same* parameter, which is almost never true across multi-center trials with different populations. REML is the modern default (Viechtbauer 2005); DerSimonian-Laird is the older default still commonly seen.\n\n## metafor::rma + forest -- The Reference Implementation\n\n**Goal:** Pool study-level effect estimates with random-effects meta-analysis; render a forest plot with study weights, individual effect+CI, and pooled summary diamond.\n\n**Approach:** Compute per-study yi (effect) and vi (sampling variance); fit REML random-effects model; pass to forest() with prediction interval if heterogeneity is non-trivial.\n\n```r\nlibrary(metafor)\n\n# Input: per-study effect (yi) and variance (vi)\n# For OR: yi = log(OR), vi = SE(log(OR))^2\n# For HR: yi = log(HR), vi = SE(log(HR))^2\nres \u003C- rma(yi = log_or, vi = log_or_se^2,\n           data = studies, slab = paste(author, year),\n           method = 'REML')\n\n# I^2 and tau^2 in the summary\nsummary(res)\n# I^2 (residual heterogeneity)\n# tau^2 (estimated amount of (residual) heterogeneity)\n# Q-test for heterogeneity\n\nforest(res,\n       atransf = exp,                           # display OR on natural scale\n       at = log(c(0.25, 0.5, 1, 2, 4)),         # ticks at meaningful OR values\n       refline = 0,                              # log(1) for OR\u002FHR\u002FRR\n       xlab = 'Odds Ratio (95% CI)',\n       header = c('Study', 'OR [95% CI]'),\n       mlab = bquote(paste('RE Model (Q = ', .(round(res$QE, 2)),\n                            ', df = ', .(res$k - 1),\n                            ', p = ', .(format.pval(res$QEp, digits = 2)),\n                            '; ', I^2, ' = ', .(round(res$I2, 1)), '%)')),\n       addpred = TRUE)                          # prediction interval per Higgins 2009\n```\n\n`addpred = TRUE` adds a 95% prediction interval — where a new study's effect is expected to fall (Higgins-Thompson-Spiegelhalter 2009 *JRSS-A*). This is the most honest summary when I² > 30%.\n\n## ggforest for Cox Subgroup Forests\n\n```r\nlibrary(survminer)\nfit \u003C- coxph(Surv(time, status) ~ treatment + age + sex + stage, data = df)\nggforest(fit,\n         data = df,\n         main = 'Subgroup HRs',\n         cpositions = c(0.02, 0.22, 0.4),\n         fontsize = 0.7,\n         refLabel = 'Reference',\n         noDigits = 2)\n```\n\nggforest produces a publication-ready subgroup forest from a coxph object. For pre-specified subgroup analyses (treatment × subgroup interaction), test interaction explicitly and annotate the p-value.\n\n## Small-k Regime -- When Meta-Analysis Asymptotics Break\n\nFor k \u003C 5 studies, the REML-based 95% CI from `metafor::rma()` is severely anti-conservative — it relies on chi-square asymptotics that fail with few studies. Use **Hartung-Knapp-Sidik-Jonkman (HKSJ)** adjustment (`test = 'knha'`):\n\n```r\nres_hksj \u003C- rma(yi = log_or, vi = log_or_se^2, data = studies,\n                method = 'REML', test = 'knha')           # HKSJ for k\u003C5\n```\n\nHKSJ uses a t-distribution with k-1 degrees of freedom and adjusts SE via the Q-statistic — well-calibrated even at k=3. For k \u003C 3 a meta-analysis is not advisable; report individual study effects in a forest plot without a pooled summary.\n\nAlso: I² is uninterpretable below k = 5 (Borenstein 2017 *Res Synth Methods* 8:5); the point estimate has wide CI dominated by k itself, not heterogeneity. **Do not report I² for k \u003C 5.**\n\n## Funnel Plot and Egger Test\n\n**Goal:** Diagnose publication bias by visual asymmetry of effect size vs precision.\n\n**Approach:** Plot effect (x) vs SE (inverted y); under no bias, points form a symmetric inverted funnel with the pooled estimate at the apex. Asymmetry suggests missing small-N null-result studies. Egger's regression test (Egger 1997 *BMJ* 315:629) formalizes the asymmetry.\n\n```r\nfunnel(res,\n       xlab = 'log(OR)',\n       refline = res$b)\n\n# Egger's test\nregtest(res, model = 'lm', predictor = 'sei')\n# significant p indicates asymmetry; suggests publication bias\n\n# Trim-and-fill (Duval-Tweedie 2000) -- adjusts for asymmetry\nres_tf \u003C- trimfill(res)\nforest(res_tf)\nfunnel(res_tf)\n```\n\n**Contour-enhanced funnel plot** (Peters 2008 *J Clin Epidemiol* 61:991) overlays significance contours (p \u003C 0.10, \u003C 0.05, \u003C 0.01); asymmetry concentrated in \"non-significant\" regions indicates publication bias more specifically than generic asymmetry.\n\n```r\nfunnel(res, level = c(90, 95, 99), shade = c('white', 'gray55', 'gray75'),\n       refline = 0, legend = TRUE)\n```\n\n## Per-Method Failure Modes\n\n### Pooling under high heterogeneity without explanation\n\n**Trigger:** Random-effects meta-analysis pooled with I² > 75%; no subgroup or meta-regression.\n\n**Mechanism:** Pooled estimate is a weighted average across substantively different effects; biologically meaningless.\n\n**Symptom:** Pooled OR = 1.5 with 95% CI (1.2-1.8) but per-study effects range 0.3-5.0.\n\n**Fix:** Run subgroup analysis or meta-regression to explain heterogeneity; report I², τ², and prediction interval; do NOT report a single pooled effect as the answer.\n\n### Fixed-effect when studies are heterogeneous\n\n**Trigger:** Default fixed-effect model on multi-population data.\n\n**Mechanism:** Fixed-effect weights = 1\u002Fwithin-study variance, ignoring between-study variance.\n\n**Symptom:** CI is misleadingly narrow; reviewer asks \"why fixed effect with high I²?\"\n\n**Fix:** Switch to REML random-effects (`method = 'REML'`); document the choice.\n\n### Egger test p-value over-interpreted\n\n**Trigger:** k \u003C 10 studies; significant Egger p taken as definitive publication bias.\n\n**Mechanism:** Egger's test is underpowered with few studies; sensitive to single outliers.\n\n**Symptom:** Conclusion \"publication bias\" from k=6 trials.\n\n**Fix:** Egger requires k ≥ 10 (Sterne 2011 *BMJ* 343:d4002); for fewer studies, visual funnel + contour-enhanced funnel is more reliable.\n\n### Trim-and-fill imputed studies presented as data\n\n**Trigger:** Reporting trim-and-fill adjusted estimate as \"the answer.\"\n\n**Mechanism:** Trim-and-fill is a sensitivity analysis; imputed studies are hypothetical.\n\n**Symptom:** Original pooled OR = 2.0; trim-and-fill adjusted to 1.5; report says \"adjusted estimate is 1.5.\"\n\n**Fix:** Present original AND trim-and-fill side-by-side; trim-and-fill is sensitivity, not primary.\n\n### Subgroup forest without interaction test\n\n**Trigger:** Subgroup HRs plotted; conclusion \"treatment works in subgroup X.\"\n\n**Mechanism:** Visual differences across subgroups don't establish significant interaction.\n\n**Symptom:** Subgroup forest shows HR=0.5 in subgroup A, HR=1.0 in subgroup B; no formal test.\n\n**Fix:** Add treatment × subgroup interaction term to the model; report interaction p; cite Brookes 2001 \u002F Wang 2007 for subgroup analysis caveats.\n\n### Forest plot axis on linear scale for ratios\n\n**Trigger:** OR\u002FHR\u002FRR plotted with linear x-axis.\n\n**Mechanism:** Ratios are multiplicatively symmetric; linear axis compresses \u003C 1 effects.\n\n**Symptom:** OR = 0.5 (halving) appears smaller than OR = 2 (doubling) on a linear scale, even though they are biologically equivalent.\n\n**Fix:** Always log-scale the x-axis for ratios. metafor's `atransf = exp` + `at = log(c(0.25, 0.5, 1, 2, 4))` is the canonical pattern.\n\n### Weights not visible (point sizes uniform)\n\n**Trigger:** Default forestplot package without weight encoding.\n\n**Mechanism:** Reader cannot tell study influence on pool.\n\n**Symptom:** A 5-patient pilot looks visually equivalent to a 5000-patient trial.\n\n**Fix:** Use metafor `forest()` which auto-encodes weight via box size. forestplot package needs `boxsize =` argument.\n\n## Reconciliation: When Methods Disagree\n\n| Pattern | Cause | Action |\n|---------|-------|--------|\n| Fixed-effect significant; random-effects n.s. | High heterogeneity inflates RE variance | Trust random-effects when I² > 30% |\n| Egger n.s. but funnel looks asymmetric | k \u003C 10 -> Egger underpowered | Trust visual; report contour-enhanced funnel |\n| Trim-and-fill imputes many studies | Severe asymmetry | Caution; sensitivity, not primary |\n| Subgroup forest suggests effect modification; interaction test n.s. | Visual difference does not establish formal interaction | Trust interaction test |\n| MR forest shows divergent estimates across methods | Pleiotropy or weak instruments | Run MR-Egger, weighted median, mode-based (sensitivity); cite Bowden 2015 |\n\n## Quantitative Thresholds\n\n| Threshold | Value | Source |\n|-----------|-------|--------|\n| I² substantial heterogeneity | > 50% | Cochrane Handbook §10.10.2 (Higgins et al editors) |\n| I² considerable heterogeneity | > 75% | Cochrane Handbook §10.10.2 (Higgins et al editors) |\n| Egger test min k | ≥ 10 | Sterne 2011 *BMJ* |\n| Prediction interval (where new study lands) | report when I² > 30% | Higgins-Thompson-Spiegelhalter 2009 |\n| Forest x-axis | log scale for ratios | Convention |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Pooled estimate with I² = 90% | No heterogeneity exploration | Subgroup \u002F meta-regression |\n| Linear x-axis for OR forest | Ratios should be log-symmetric | `atransf = exp, at = log(...)` |\n| Uniform point sizes | Weights not encoded | metafor::forest auto-encodes; forestplot needs boxsize |\n| Egger from k=5 | Underpowered | k ≥ 10 for Egger |\n| Trim-and-fill as primary | Sensitivity, not primary | Present both; document |\n| Subgroup effect without interaction test | Visual ≠ test | Add interaction term |\n| MR forest with single method | Pleiotropy risk | Triangulate methods |\n\n## References\n\n- Bowden J, Davey Smith G, Burgess S. 2015. Mendelian randomization with invalid instruments: effect estimation and bias detection through Egger regression. *Int J Epidemiol* 44(2):512-525.\n- Brookes ST, Whitley E, Peters TJ, et al. 2001. Subgroup analyses in randomised controlled trials: quantifying the risks of false-positives and false-negatives. *Health Technol Assess* 5(33):1-56.\n- DerSimonian R, Laird N. 1986. Meta-analysis in clinical trials. *Control Clin Trials* 7(3):177-188.\n- Duval S, Tweedie R. 2000. Trim and fill: a simple funnel-plot–based method of testing and adjusting for publication bias in meta-analysis. *Biometrics* 56:455-463.\n- Egger M, Davey Smith G, Schneider M, Minder C. 1997. Bias in meta-analysis detected by a simple, graphical test. *BMJ* 315(7109):629-634.\n- Higgins JPT, Thompson SG. 2002. Quantifying heterogeneity in a meta-analysis. *Stat Med* 21(11):1539-1558.\n- Higgins JPT, Thompson SG, Spiegelhalter DJ. 2009. A re-evaluation of random-effects meta-analysis. *JRSS-A* 172(1):137-159.\n- Peters JL, Sutton AJ, Jones DR, Abrams KR, Rushton L. 2008. Contour-enhanced meta-analysis funnel plots help distinguish publication bias from other causes of asymmetry. *J Clin Epidemiol* 61(10):991-996.\n- Sterne JAC, Sutton AJ, Ioannidis JPA, et al. 2011. Recommendations for examining and interpreting funnel plot asymmetry in meta-analyses of randomised controlled trials. *BMJ* 343:d4002.\n- Viechtbauer W. 2010. Conducting meta-analyses in R with the metafor package. *J Stat Softw* 36(3):1-48.\n- Hartung J, Knapp G. 2001. A refined method for the meta-analysis of controlled clinical trials with binary outcome. *Stat Med* 20(24):3875-3889.\n- IntHout J, Ioannidis JPA, Borm GF. 2014. The Hartung-Knapp-Sidik-Jonkman method for random effects meta-analysis is straightforward and considerably outperforms the standard DerSimonian-Laird method. *BMC Med Res Methodol* 14:25.\n- Borenstein M, Higgins JPT, Hedges LV, Rothstein HR. 2017. Basics of meta-analysis: I² is not an absolute measure of heterogeneity. *Res Synth Methods* 8(1):5-18.\n- Higgins JPT, Thomas J, Chandler J, et al (editors). *Cochrane Handbook for Systematic Reviews of Interventions* (current version). Section 10.10.2 — interpretation tiers for I².\n\n## Related Skills\n\n- clinical-biostatistics\u002Feffect-measures - HR \u002F OR \u002F RR \u002F NNT definitions\n- clinical-biostatistics\u002Fsubgroup-analysis - Interaction tests for subgroup HRs\n- causal-genomics\u002Fmendelian-randomization - MR-specific forest + sensitivity\n- clinical-biostatistics\u002Ftrial-reporting - CONSORT and meta-analysis reporting\n- data-visualization\u002Fcolor-palettes - Palette for multi-study or subgroup forests\n",{"name":5,"source":24,"license":15,"tool_type":25,"description":7,"imported_at":26,"source_path":27,"primary_tool":28,"source_repository":29},"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills","r","2026-09-20","data-visualization\u002Fforest-funnel-plots\u002FSKILL.md","metafor","GPTomics\u002FbioSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-data-visualization-forest-funnel-plots","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-data-visualization-forest-funnel-plots",{"tool":42,"command":43},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-data-visualization-forest-funnel-plots",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-data-visualization-forest-funnel-plots","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-forest-funnel-plots\u002FSKILL.md",true,[50,56],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Fforest_phd.R","OTHER","其他",3716,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-forest-funnel-plots\u002Fexamples\u002Fforest_phd.R",{"path":57,"resourceType":58,"resourceTypeDesc":59,"sizeBytes":60,"sourceHtmlUrl":61},"usage-guide.md","REFERENCE","参考文档",4248,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-forest-funnel-plots\u002Fusage-guide.md",[63,71,78,85,92,99],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":70},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":70},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":70},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":70},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":70},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":70},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]