# create an example
params <- NS_params
# In this model each species is caught by a single gear, so there is one
# row in the gear parameters for each species, in the same order.
# Species without an observation get NA.
gear_params(params)$yield_observed <-
c(NA, NA, NA, 3e11, 4e9, 4e10, 5e10, NA, 2e11, 6e10, 3e11, NA)
# Plot with default options
plotYieldObservedVsModel(params)
# Plot including also species without observations
plotYieldObservedVsModel(params, show_unobserved = TRUE)
# Show the ratio instead
plotYieldObservedVsModel(params, ratio = TRUE)
# If several gears catch the same species, their yields are added up.
# Give Cod a second gear that takes a quarter of the observed yield.
gp <- gear_params(params)
gp["Cod, Otter", "yield_observed"] <- 3e11 * 0.75
extra <- gp["Cod, Otter", ]
extra$gear <- "Gillnet"
extra$yield_observed <- 3e11 * 0.25
gear_params(params) <- rbind(gp, extra)
# Compare only the catch of the Otter gear against its observation
plotYieldObservedVsModel(params, gear = "Otter")
Run the code above in your browser using DataLab