Refit a model with a new response.
refit_model(object, newresp, ...)
A model with same class as object
.
A model.
the new response, may be a vector or a matrix.
other arguments passed to refit
or update
.
This function uses newresp
to refit object
replacing its old response variable.
If the class is merMod
it uses refit
, otherwise uses stats::update()
.
The default method tries to update the model response using it's stats::model.frame()
,
if it errors it tries to update the model by inserting the newresp
directly into the object formula.