calculate_re function

Calculate relative error

Calculate relative error

Calculate the relative error (RE; [EM - OM]/OM) of parameters and derived quantities stored in a scalar or time series data frame generated by get_results_all.

calculate_re(dat, add = TRUE)

Arguments

  • dat: An input data frame. Should be either a scalar or time series data frame as returned from get_results_all or a related get results function. Specifically, the data frame needs to have columns with _em and _om as names.

  • add: Logical: should the relative error columns be added to dat

    or should the original EM and OM columns be dropped? If FALSE then the returned data frame will have only the identifying columns and the new relative error columns. You could then merge selected columns back into dat if you wished. The default is to return all columns.

Returns

The default is to return a data frame structured the same as the input data frame, i.e., dat, but with additional columns, where '_re' is appended to the base string of the column name. All NAN and Inf values are returned as NA values, typically because you cannot divide by zero.

Examples

# Example with built in package data: data("ts_dat", package = "ss3sim") data("scalar_dat", package = "ss3sim") head(calculate_re(ts_dat)) head(calculate_re(ts_dat, add = FALSE)) head(calculate_re(scalar_dat, add = FALSE)) rm("ts_dat", "scalar_dat")

See Also

get_results_all, link{get_results_scenario}

Author(s)

Sean Anderson and Cole Monnahan

  • Maintainer: Kelli F. Johnson
  • License: MIT + file LICENSE
  • Last published: 2019-11-08