check_augment_data_specification {modeltests} | R Documentation |
Check that augment behavior is consistent for dataframes and tibbles
Description
Call this function to perform tests. If a tests fails, an informative error will be thrown. Otherwise silent.
Uses augment_data_helper()
to create copies of the same dataset as
a tibble, data frame and dataframe with rownames. When add_missing = TRUE
these
datasets have missing values along the diagonal, and one row of entirely missing
values. Once the datasets have been generated, tests that:
-
augment(fit, data = generated_dataset)
passescheck_tibble()
for each generated dataset. Output of
augment(fit, data = generated_dataset)
is the same for all three generated datasets, except the data frame with rownames should also generate a.rownames
column that the tibble and nameless data frame do not.
Additional tests when test_newdata = TRUE
:
-
head(aug(model, newdata = data))
equalsaug(head(model, newdata = data))
. This commutativity check catches issues where the output ofpredict
changes for the same data point depending on the rest of the dataset.
Usage
check_augment_data_specification(aug, model, data, add_missing, test_newdata)
Arguments
aug |
An augment method. For example, |
model |
A fit model object to call the augment method on. |
data |
A data frame or tibble to use when testing |
add_missing |
Logical indicating whether or not missing data should be
introduced into the datasets generated with |
test_newdata |
Logical indicating whether the |
Value
An invisible NULL
. This function should be called for side effects, not return values.