recalibrate is used to recalibrate a prediction model of classes metapred, glm or lm.
Arguments
- object
A model fit object to be recalibrated, of class
metapred, glmorlm, and more.- newdata
data.frame containing new data set for updating.
- f
formula. Which coefficients of the model should be updated? Default: intercept only. Left-hand side may be left out. See formula for details.
- estFUN
Function for model estimation. If left
NULL, the function is automatically retrieved formetapredobjects. For other objects, the function with name corresponding to the first class of the object is taken. E.g.glm()forglmobjects.- ...
Optional arguments to pass to
estFUN.
Value
Recalibrated model fit object, of the same class as object. Generally, updated coefficients can
be retrieved with coef().
Details
Currently only the coefficients are updated and the variances and other aspects are left untouched. For updating the entire model and all its statistics, see update.
Examples
data(DVTipd)
DVTipd$cluster <- 1:4 # Add a fictional clustering to the data set.
# Suppose we estimated the model in three studies:
DVTipd123 <- DVTipd[DVTipd$cluster <= 3, ]
mp <- metamisc:::metapred(DVTipd123, strata = "cluster", f = dvt ~ vein + malign,
family = binomial)
# and now want to recalibrate it for the fourth:
DVTipd4 <- DVTipd[DVTipd$cluster == 4, ]
metamisc:::recalibrate(mp, newdata = DVTipd4)
#> Call: metamisc:::recalibrate(object = mp, newdata = DVTipd4)
#>
#> Started with model:
#> dvt ~ vein + malign
#> <environment: 0x55b0d8cb64f8>
#>
#> Generalizability:
#> unchanged
#> 1 0.1332079
#>
#> Generalizability:
#> malign vein
#> 1 0.1344432 0.1314326
#>
#> Continued with model:
#> dvt ~ malign
#> <environment: 0x55b0d8cb64f8>
#>
#> Generalizability:
#> malign
#> 1 0.1342213
#>
#> Cross-validation stopped after 2 steps, as no improvement was possible. Final model:
#> Meta-analytic model of prediction models estimated in 3 strata. Coefficients:
#> (Intercept) malign
#> -1.775619 1.145096
