computeDiffs | R Documentation |
Function to compute differences between model cases
computeDiffs(
x,
base = 1,
cast = "process+fleet+category+type+pc+x+m+s+z+y",
fun = wtsUtilities::Sum,
sense = 1,
type = c("percent", "absolute")
)
x |
|
base |
|
cast |
|
fun |
|
sense |
|
type |
|
The differences are calculated as sense*(case-base)
. If differences in negative log-likelihoods are desired,
it may be useful to set sense
to -1
so that improvements in fits from base to case are reflected as positive values.
Uses reshape2::dcast()
to aggregate values within factor levels defined by the cast'ing formula prior to differencing.
The default cast string is "process+fleet+category+type+pc+x+m+s+z+y",
yielding the cast formula "process+fleet+category+type+pc+x+m+s+z+y~cast" (i.e., no aggregation, but possibly transformation
if fun
transforms values prior to aggregating them).
The columns of the returned dataframe will include the factors included in the input cast'ing string cast
, as well as
columns of the form "absdiff-case" or "pctdiff-case", where "case" are the names of the non-base
cases. Note that the latter column names can be returned to "case" by colnames(xd) = gsub("^.*-","",colnames(xd))
, where
x
is the result of computeDiffs
.
a dataframe (see details) with attributes "base", "type", and "sense" (reflecting the input values).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.