knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
get_funnel_plot() draws a base-graphics funnel plot using the original meta-analysis inputs and a fitted MAIVE/WAIVE result. Device management (e.g., png(), svg(), pdf(), base64 encoding) is left to you so you can embed the graphic wherever you need.
For a guided, interactive workflow, visit https://www.easymeta.org.
What it shows:
get_funnel_plot(dat, result, instrument = NULL, model_type = "MAIVE")
dat: data frame with numeric bs (effect sizes) and sebs (standard errors, > 0)result: list returned by maive() or waive()instrument: optional 0/1 to control whether adjusted SEs/weights are used; if NULL, inferred from resultmodel_type: label for plot text/legend (e.g., "MAIVE" or "WAIVE")The code below is set to eval = FALSE to keep the vignette fast. Run it interactively to produce the plot.
library(MAIVE) set.seed(123) n <- 40 dat <- data.frame( bs = rnorm(n, mean = 0.2, sd = 0.25), sebs = runif(n, min = 0.05, max = 0.3), Ns = sample(80:800, n, replace = TRUE), study_id = rep(1:10, each = 4) ) # Fit MAIVE (instrumented PET-PEESE, no weights, cluster-robust, wild bootstrap) res <- maive( dat = dat, method = 3, weight = 0, instrument = 1, studylevel = 2, SE = 3, AR = 1 ) # Draw to the current device get_funnel_plot(dat = dat, result = res, model_type = "MAIVE")
Device control is up to you; this pattern works for PNG. Replace png() with svg()/pdf() as needed.
png("maive-funnel.png", width = 1800, height = 1400, res = 200) get_funnel_plot(dat = dat, result = res, model_type = "MAIVE") dev.off()
instrument = 1.instrument = 0 or the result lacks SE_instrumented, the plot omits adjusted points and uses only raw SEs.dat$sebs are strictly positive and finite; the helper validates inputs and will stop otherwise.vignette("introduction", package = "MAIVE") for full estimator workflow?get_funnel_plot, ?maive, ?waiveAny scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.