Learn R Programming

asympDiag (version 0.3.1)

refit_model: Refit Model

Description

Refit a model with a new response.

Usage

refit_model(object, newresp, ...)

Value

A model with same class as object.

Arguments

object

A model.

newresp

the new response, may be a vector or a matrix.

...

other arguments passed to refit or update.

Details

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.