jackknifeWeights.Rd
Compute model weights optimized for jackknifed model fits.
two or more fitted glm
objects, or a
list
of such, or an "averaging" object.
a data frame containing the variables in the model. It is
optional if all models are glm
.
a character string specifying the function to minimize. Either
"rmse"
or "loglik"
.
used only if type = "loglik"
, a family
object to be
used for likelihood calculation. Not needed if all models share the same
family
and link function.
an optional vector of ‘prior weights’
to be used in the model fitting process. Should be NULL
or
a numeric vector.
optional, optimisation method, passed to
optim
.
optional, the maximum number of iterations, passed to
optim
.
optional list of other arguments passed to
optim
.
starting values for model weights. Numeric of length equal the number of models.
for glm
, the glm.fit
function is used for
fitting models to the train data, which is much more efficient. Set to
TRUE
to use update
instead.
either a boolean value, then if TRUE
a jackknifed prediction
matrix is returned and if FALSE
a vector of jackknifed model weights, or
a N×M matrix (number of cases × number of models)
that is interpreted as a jackknifed prediction matrix and it is used for
optimisation (i.e. the jackknife procedure is skipped).
The function returns a numeric vector of model weights.
Model weights are chosen (using optim
) to minimise
RMSE or log-likelihood of
the prediction for data point i, of a model fitted omitting that
data point i. The jackknife procedure is therefore run for all
provided models and for all data points.
This procedure can give variable results depending on the
optimisation method and starting values. It is therefore
advisable to make several replicates using different optim.method
s.
See optim
for possible values for this argument.
Hansen, B. E. and Racine, J. S. 2012 Jackknife model averaging. Journal of Econometrics 979, 38–46
Dormann, C. et al. 2018 Model averaging in ecology: a review of Bayesian, information-theoretic, and tactical approaches for predictive inference. Ecological Monographs 88, 485–504.
Other model weights:
BGWeights()
,
bootWeights()
,
cos2Weights()
,
stackingWeights()
fm <- glm(Prop ~ mortality * dose, binomial(), Beetle, na.action = na.fail)
fits <- lapply(dredge(fm, eval = FALSE), eval)
#> Fixed term is "(Intercept)"
amJk <- amAICc <- model.avg(fits)
set.seed(666)
Weights(amJk) <- jackknifeWeights(fits, data = Beetle)
coef(amJk)
#> (Intercept) dose mortality dose:mortality
#> -2.6214077 0.1058768 -6.3219815 0.1814192
coef(amAICc)
#> (Intercept) dose mortality dose:mortality
#> -11.8251645 0.2323824 4.0101597 0.1814192