update
-method for "twinstim"
Update and (by default) re-fit a "twinstim"
. This method is
especially useful if one wants to add the model
environment
(which is required for some methods) to a fitted model object a posteriori.
# S3 method for twinstim
update(object, endemic, epidemic,
control.siaf, optim.args, model,
..., use.estimates = TRUE, evaluate = TRUE)
If evaluate = TRUE
the re-fitted object, otherwise the updated call.
a previous "twinstim"
fit.
changes to the formulae -- see
update.formula
and twinstim
.
a list (see twinstim
) to replace
the given elements in the original control.siaf
list.
If NULL
, the original list of control arguments is removed
from the call, i.e., the defaults are used in twinstim
.
see twinstim
. If a list, it will
modify the original optim.args
using modifyList
.
see twinstim
. If this is the only argument
to update, re-fitting is cleverly circumvented.
Enriching the fit by the model environment is, e.g., required for
intensityplot.twinstim
.
Additional arguments to the call, or arguments with changed
values.
If start
values are specified, they need to be in the same
format as in the original call object$call$start
,
which is either a named list of named numeric vectors or a named
numeric vector; see the argument description in twinstim
.
logical indicating if the estimates of
object
should be used as initial values for the new fit
(in the start
argument of twinstim
). Defaults to TRUE
.
If TRUE
(default), evaluate the new call else
return the call.
Sebastian Meyer
Inspiration and some pieces of code originate from
update.default
by the R Core Team.
data("imdepi", "imdepifit")
## add another epidemic covariate
## (but fix siaf-parameter so that this example runs quickly)
imdepifit2 <- update(imdepifit, epidemic = ~. + log(popdensity),
optim.args = list(fixed="e.siaf.1"))
## compare by AIC
AIC(imdepifit, imdepifit2)
Run the code above in your browser using DataLab