A comparison between the objects or objects returned by fwd()
and the
targets and limits set in the fwdControl
object used to run, is returned
by this method.
# S4 method for class 'FLStock,fwdControl'
compare(result, target, simplify = FALSE)
# S4 method for class 'fwdControl,FLStock'
compare(result, target)
# S4 method for class 'FLBiol,fwdControl'
compare(result, target, fishery, simplify = FALSE)
A table of comparisons, one for each target, of class data.frame.
A comparison is carried out for each row in a fwdControl
object,
that is, for every target or limit.
A data.frame
is returned with columns 'year', 'quant', 'season' and
'unit' if relevant, and 'achieved'. The last is of class logical
and will
have value TRUE
if the target or limits have been achieved for every
iteration, and FALSE
otherwise.
Values are compared using all.equal
.
data(ple4)
control <- fwdControl(
list(quant="fbar", value=0.5, year=1990),
list(quant="catch", value=1, year=1991, relYear=1990),
list(quant="catch", min=10000, year=1993, max=100000))
run <- fwd(ple4, sr=predictModel(model=rec~a*ssb*exp(-b*ssb),
params=FLPar(a=9.16, b=3.55e-6)), control=control)
# Returns the full comparison table
compare(run, control)
#> year quant achieved
#> 1 1990 fbar FALSE
#> 2 1991 catch FALSE
#> 3 1993 catch TRUE
# Returns a logical vector
compare(run, control, simplify=TRUE)
#> [1] FALSE FALSE TRUE