calculate_re {ss3sim} | R Documentation |
Calculate relative error
Description
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
.
Usage
calculate_re(dat, add = TRUE)
Arguments
dat |
An input data frame. Should be either a scalar or time series
data frame as returned from |
add |
Logical: should the relative error columns be added to |
Value
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.
Author(s)
Sean Anderson and Cole Monnahan
See Also
get_results_all
, link{get_results_scenario}
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")