check_data_arg: Check that the model fit uses the data argument to provide...

View source: R/model_utils.R

check_data_argR Documentation

Check that the model fit uses the data argument to provide data

Description

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.

Usage

check_data_arg(fit)

Arguments

fit

A fitted model object, whose call is to be examined

Details

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.

Value

No value. Raises an error if no data argument was used in fit.


regressinator documentation built on Sept. 11, 2024, 6:50 p.m.