Generic calculate_rsq()
returns the root mean square error for the given
input.
calculate_rsq(x, ...)
# S3 method for default
calculate_rsq(x, ...)
# S3 method for trending_model
calculate_rsq(x, data, na.rm = TRUE, as_tibble = TRUE, ...)
# S3 method for list
calculate_rsq(x, data, na.rm = TRUE, ...)
# S3 method for trending_fit
calculate_rsq(x, new_data, na.rm = TRUE, as_tibble = TRUE, ...)
# S3 method for trending_fit_tbl
calculate_rsq(x, new_data, na.rm = TRUE, ...)
# S3 method for trending_predict
calculate_rsq(x, na.rm = TRUE, as_tibble = TRUE, ...)
# S3 method for trending_predict_tbl
calculate_rsq(x, na.rm = TRUE, ...)
# S3 method for trending_prediction
calculate_rsq(x, na.rm = TRUE, as_tibble = TRUE, ...)
An R object.
Not currently used.
a data.frame
containing data (including the response variable
and all predictors) used in the specified model.
Should NA values should be removed before calculation of metric (passed to the underlying function yardstick::rsq_vec).
Should the result be returned as tibble
(as_tibble = TRUE
) or a list (as_tibble = FALSE
).
a data.frame
containing data (including the response variable
and all predictors) on which to assess the model.
For a single trending_fit
input, if
as_tibble = FALSE
the object returned will be a list with entries:
metric: "rsq"
result: the resulting rsq value (NULL if the calculation failed)
warnings: any warnings generated during calculation
errors: any errors generated during calculation
If as_tibble = TRUE
, or for the other trending
classes, then the output
will be a tibble with one row for each fitted model
columns corresponding to output generated with single model input.
Specific methods are given for trending_model
(and lists of
these), trending_fit
,
trending_fit_tbl
,
trending_predict_tbl
,
trending_predict_tbl
and
trending_prediction
objects. Each of these are simply wrappers around the
yardstick::rsq_vec with the addition of explicit error handling.