| ml_spline | R Documentation |
Fits a natural cubic spline meta-regression over follow-up time using the
pooled time-point estimates from ml_meta(). Produces a smooth pooled
trajectory with simultaneous pointwise confidence bands and tests for
nonlinearity.
ml_spline(meta_obj, df = 3L, n_pred = 200L, alpha = NULL, test_linear = TRUE)
meta_obj |
Output from |
df |
Degrees of freedom for the natural cubic spline. Default
|
n_pred |
Number of prediction points for the smooth curve. Default
|
alpha |
Confidence level (inherits from |
test_linear |
Logical. If |
The spline is fit by weighted least squares on the ml_meta() estimates,
using 1 / se^2 as weights (i.e., inverse squared SE weighting to reflect
the precision of each time-point estimate). This is a second-stage model.
For a fully joint spline model at the individual-effect level, users should
call metafor::rma.mv() directly with mods = ~ ns(time, df). This
function is primarily intended for visualisation and trajectory testing.
Object of class ml_spline with elements:
preddata.frame with time, fit, ci_lb, ci_ub for
the smooth prediction grid.
coefSpline coefficient estimates.
vcovCoefficient covariance matrix.
r_squaredWeighted R-squared of the spline fit.
p_nonlinearp-value for nonlinearity test (if requested).
dfSpline degrees of freedom used.
meta_objThe original ml_meta object (for plotting).
ml_meta(), ml_plot()
dat <- sim_longitudinal_meta(k = 10, times = c(0, 6, 12, 24), seed = 3)
meta <- ml_meta(dat, yi = "yi", vi = "vi", study = "study", time = "time")
spl <- ml_spline(meta, df = 2)
print(spl)
plot(spl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.