fit_aarr_data() calculates AARR and then generates a prediction based on calculated AARR.
Usage
fit_aarr_model(
df,
response,
interpolate,
test_col,
sort_col,
sort_descending,
sort_col_min,
group_col,
group_models,
obs_filter,
pred_col
)Arguments
- df
Data frame of model data.
- response
Column name of prevalence variable to be used to calculate AARR.
- interpolate
Logical value, whether or not to interpolate values based on estimated AARR between observations. Defaults to
FALSE.- test_col
Name of logical column specifying which response values to remove for testing the model's predictive accuracy. If
NULL, ignored. Seemodel_error()for details on the methods and metrics returned.- sort_col
Column name of column to arrange data by in
dplyr::arrange(), prior to filtering for latest contiguous time series and producing the forecast. Not used ifNULL, defaults to"year".- sort_descending
Logical value on whether the sorted values from
sort_colshould be sorted in descending order. Defaults toFALSE.- sort_col_min
If provided, a numeric value that sets a minimum value needed to be met in the
sort_colfor an observation to be used in calculating AARR. Ifsort_col = "year"andsort_col_min = 2008, then only observations from 2008 onward will be used in calculating AARR.- group_col
Column name(s) of group(s) to use in
dplyr::group_by()when supplying type, calculating mean absolute scaled error on data involving time series, and ifgroup_models, then fitting and predicting models too. IfNULL, not used. Defaults to"iso3".- group_models
Logical, if
TRUE, fits and predicts models individually onto eachgroup_col. IfFALSE, a general model is fit across the entire data frame.- obs_filter
String value of the form "
logical operatorinteger" that specifies the number of observations required to fit the model and replace observations with predicted values. This is done in conjunction withgroup_col. So, ifgroup_col = "iso3"andobs_filter = ">= 5", then for this model, predictions will only be used foriso3vales that have 5 or more observations. Possible logical operators to use are>,>=,<,<=,==, and!=.If `group_models = FALSE`, then `obs_filter` is only used to determine when predicted values replace observed values but **is not** used to restrict values from being used in model fitting. If `group_models = TRUE`, then a model is only fit for a group if they meet the `obs_filter` requirements. This provides speed benefits, particularly when running INLA time series using `predict_inla()`.- pred_col
Column name to store predicted value.
