We simulate by passing simulated data arguments to update(). If the original fit does not use the data argument, and instead refers directly to variables in the environment, the simulations will not behave as expected. This may result in the "simulated" fits all using the original data, for instance.
check_data_arg(fit)
No value. Raises an error if no data
argument was used in fit
.
A fitted model object, whose call is to be examined
For example, in lm(mtcars$mpg ~ mtcars$drat)
, simulating new data and
providing it in data =
will not change the data used for fitting.
Detect a missing data
argument and abort. It is still possible to provide
data
but also refer directly to the calling environment, but this is harder
to detect.