Fit a mixed-effects meta-analysis model with inclusion of one or more spline terms
Source:R/splinemixmeta.R
splinemixmeta.RdFit a mixed-effects meta-analysis model with inclusion of one or more spline terms
Usage
splinemixmeta(
smooth = NULL,
formula,
se,
S = se^2,
manual_fixed = FALSE,
residual_re = TRUE,
data,
random = list(),
method = "reml",
bscov = "unstr",
...
)Arguments
- smooth
A smoothing term created by
mgcv::s(), or a list of such terms.- formula
A formula for the fixed effects part of the model.
- se
A vector of standard errors for the response variables.
- S
As an alternative to
se,Scan be provided in several formats to give variance-covariance information for the response variables.- manual_fixed
If
TRUE, the fixed-effect component (if any) of anysmoothterms is being manually included in theformulaand hence should not be extracted from thesmooth. Normally the "fixed-effect component" is the linear component. Hence one should either providesmooth = s(x)withxomitted fromformula(e.g.formula = yorformula = y ~ 1) and thusmanual_fixed = FALSE, or providesmooth = s(x)withxincluded informula(e.g.formula = y ~ x) andmanual_fixed = TRUE. The model fits should be identical but the coefficient forxwill differ becausexwill be scaled differently if it was automatically extracted from the spline basis functions (i.e. withmanual_fixed = FALSE).- residual_re
If
TRUE, a datum-level random effect for residual variation (beyond the measurement error specified byseorS) is automatically included (similar to the default behavior ofmixmeta::mixmeta()whenrandomis not specified). Normally this should beTRUE.- data
A data frame containing the variables in the model. If not provided, variables are sought from the where the function was called.
- random
See
mixmeta::mixmeta(). This is a list of one-sided formulas specifying additional random effects beyond those that will be created from thesmoothargument.- method
This must be
reml. It is provided as an argument to make clear that onlyremlis supported for estimating models where spline formulations are set up as random effects. This simplifies catching cases where a user might have tried to pass a differentmethodvalue tomixmeta::mixmeta()via....- bscov
See
mixmeta::mixmeta(). This is relevant only ifrandomis provided.- ...
Additional arguments passed to
mixmeta::mixmeta().'
Value
An object of class splinemixmeta, unless there are no smooth terms, in which case an object of class mixmeta is returned.
Details
This function combines capabilities of mgcv and mixmeta in order to provide spline meta-regression, which means a meta-regression
model where the shape of the relationship is unspecified and estimated from the data with smoothing splines. Spline components built from
mgcv can be represented as random effects (along with fixed effects, which are unpenalized, typically for linear terms). mixmeta
supports fairly flexible specification of fixed and random effects in (univariate or multivariate) meta-analysis regression (meta-regression)
models. splinemixmeta takes mgcv-style specifications of smooth (spline) terms, sets them up for mixmeta, and the calls
mixmeta to fit the model by REML.
Only a limited set of s options are supported. k should work. For bs, only basis functions for which smoothCon can
produce diagonal penalty matrices are supported (e.g. "tp", "cr", "cs", "cc"). fx, m, by, id, and sp are not supported should not
be provided. xt should work but is untested. pc is untested.
Note that bs="cc" (cyclic cubic regression spline) does not have unpenalized components, so if this is used, manual_fixed is not relevant.
splinemixmeta is not particularly optimized for large data sets.
See also
predict.splinemixmeta()for predictions based on BLUPs (best linear unbiased predictors) frommixmeta::blup.mixmeta()from fittedsplinemixmetamodelsplot.splinemixmeta()for plotting fitted spline meta-regression modelsmake_smm_smooth()for the internal function that sets up spline terms for use insplinemixmeta.