View source: R/cross-validation.R
whole_loo_analysis | R Documentation |
A wrapper around model-fitting, model-averaging, leave-one-out calculations, and error summaries for effort, catch rate, and species composition; also returns predictions and error summaries of harvest implied by the values of the other variables.
whole_loo_analysis(
global_formulae,
fit_data,
var_desc = NULL,
error_types = c("RHO", "ME", "MAE", "MPE", "MAPE"),
...
)
global_formulae |
Named |
fit_data |
|
var_desc |
Optional character string describing the variables used in fitting.
If supplied, will become the first column in the |
error_types |
A character vector specifying which types of error summaries (obtained by |
... |
Optional arguments passed to |
This function conducts several steps in a self-contained wrapper:
Fits the global models to each response variable using fit_global_model_one()
.
Fits all subsets of these global models using fit_all_subsets()
.
Obtains model-averaged leave-one-out predictions for each record using loo_pred_model_avg()
.
Summarizes the errors made in step 3 by response variable type and period (see KuskoHarvUtils::get_errors()
and KuskoHarvUtils::get_period()
).
list
with elements:
error_summary
: list
with elements storing data.frame
objects, where each data frame stores info about the settings of the run (the values of reduce_colinearity
, cwt_retain
, and var_desc
) and the period- and response variable-specific error summaries. Different list elements store the different error summary statistics supplied to error_types
.
elapsed
: data.frame
similar to the error_summary
element, except with a column for minutes elapsed.
loo_preds
: data.frame
with the model-averaged leave-one-out predictions by record and response variable.
models
: a list
with 5 elements, one each for effort
, total_cpt
, and chinook_comp
, chum_comp
, and sockeye_comp
. Each element is the list
of fitted lm
model objects returned by fit_all_subsets()
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.