Nothing
## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.width = 6,
fig.height = 4
)
## ----simulate-----------------------------------------------------------------
library(metaLong)
dat <- sim_longitudinal_meta(
k = 10,
times = c(0, 6, 12, 24),
mu = c("0" = 0.30, "6" = 0.50, "12" = 0.42, "24" = 0.20),
tau = 0.20,
seed = 42
)
head(dat, 6)
## ----ml_meta------------------------------------------------------------------
meta <- ml_meta(dat, yi = "yi", vi = "vi", study = "study", time = "time")
print(meta)
## ----plot_meta----------------------------------------------------------------
plot(meta, main = "Pooled Effects Across Follow-Up")
## ----ml_sens------------------------------------------------------------------
sens <- ml_sens(dat, meta, yi = "yi", vi = "vi",
study = "study", time = "time")
print(sens)
## ----plot_sens----------------------------------------------------------------
plot(sens)
## ----sens_summary-------------------------------------------------------------
cat("Minimum ITCV_alpha:", round(attr(sens, "itcv_min"), 3), "\n")
cat("Mean ITCV_alpha: ", round(attr(sens, "itcv_mean"), 3), "\n")
cat("Fragile proportion:", round(attr(sens, "fragile_prop"), 3), "\n")
## ----ml_spline----------------------------------------------------------------
spl <- ml_spline(meta, df = 2)
print(spl)
## ----plot_spline--------------------------------------------------------------
plot(spl, main = "Spline Fit: Nonlinear Trajectory")
## ----ml_plot, fig.height = 6--------------------------------------------------
ml_plot(meta, sens_obj = sens, spline_obj = spl,
main = "Longitudinal Meta-Analysis Profile")
## ----ml_benchmark, eval = TRUE------------------------------------------------
bench <- ml_benchmark(
dat, meta, sens,
yi = "yi", vi = "vi", study = "study", time = "time",
covariates = c("pub_year", "quality")
)
print(bench)
## ----ml_fragility, eval = TRUE------------------------------------------------
frag <- ml_fragility(dat, meta,
yi = "yi", vi = "vi", study = "study", time = "time",
max_k = 1L, seed = 1)
print(frag)
## ----fits---------------------------------------------------------------------
f <- fits(meta)
cat("Stored model objects:", sum(!sapply(f, is.null)), "/", length(f), "\n")
Any 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.