Internal function for the Meta-Analytical Calibration Curve (MAC2)
MAC2.RdComputes meta-analytical calibration curves using multiple methods (logistic regression, loess or splines) and performs meta-analysis across clusters to generate aggregated calibration curves with confidence and prediction intervals.
Usage
MAC2(
data = NULL,
p,
y,
cluster,
grid,
cl.level = 0.95,
alpha.lr = 0.05/3,
plot = TRUE,
cluster_curves = FALSE,
knots = 3,
transf = "logit",
method_choice = c("splines", "log", "loess"),
method.tau = "REML",
prediction = TRUE,
random = TRUE,
sm = "PLOGIT",
hakn = FALSE,
linewidth = 1,
method.predict = "HTS",
verbose = FALSE
)Arguments
- data
optional data frame containing the variables
p,y, andcluster. If supplied, variable names should be given without quotation marks.- p
predicted probabilities (numeric vector) or name of the column in
data.- y
binary outcome variable or the name of the column in
data.- cluster
Cluster identifier (factor, character, or integer) or name of the column in
data.- grid
the grid for the calibration curve evaluation
- cl.level
the confidence level for the calculation of the confidence interval. Default is
0.95.- alpha.lr
the alpha-level used for the likelihood ratio test, selecting the number of knots for the restricted cubic splines
- plot
logical, indicates whether to plot the calibration curves. Default is
TRUE.- cluster_curves
logical, whether to include cluster-specific curves in the plot. Default is
FALSE.- knots
integer, number of knots for splines. Default is
3.- transf
character, transformation for predictions:
"logit"or"identity". Default is"logit".- method_choice
character, which method to use for meta-analysis. Options are:
"log","loess"or"splines". Default is"splines".- method.tau
character, method for between-study heterogeneity estimation. Default is
"REML". This argument is passed to themetagenfunction.- prediction
logical, whether to compute prediction intervals. Default is
TRUE. This argument is passed to thepredictionargument of themetagenfunction.- random
logical, whether to use random-effects model. Default is
TRUE. This argument is passed to therandomargument of themetagenfunction.- sm
character, summary measure for meta-analysis. Default is
"PLOGIT". This argument is passed to thesmargument of themetagenfunction.- hakn
logical, whether to use Hartung-Knapp adjustment. Default is
FALSE. This argument is passed to themethod.random.ciargument of themetagenfunction.- linewidth
numeric, line width for the meta-curve. Default is
1.- method.predict
character, method for prediction intervals. Default is
"HTS". This argument is passed to themethod.predictargument of themetagenfunction.- verbose
logical, indicates whether progress has to be printed in the console.
Value
A list containing:
cluster_dataData frame with linear predictors and standard errors for each method per cluster
plot_dataData frame with meta-analysis results including predictions and intervals
plotA
ggplot2object ifplot = TRUE, otherwiseNULL
Details
This function estimates the center-specific calibration curves using logistic regression,
loess or splines. Hereafter, it aggregates the calibration curves using meta-analytical techniques.
The meta-analysis is performed using the function metagen from the meta
package. The method_choice argument determines which method is for the meta-analytical aggregation.