Skip to contents

[Experimental]

The function opens a shiny gadget, an interactive web page. This page has a side panel with controls for various model parameters and a main panel with tabs for various diagnostic plots.

Usage

tuneParams(
  params,
  controls = c("predation", "fishing", "reproduction", "other", "interaction",
    "resource"),
  tabs = c("Spectra", "Abundance", "Growth", "Repro", "Catch", "Diet", "Death",
    "Resource", "Rates", "Sim"),
  match = c("none"),
  preserve = c("erepro", "reproduction_level", "R_max"),
  return_app = FALSE,
  ...
)

Arguments

params

MizerParams object to tune. If missing, the gadget tries to recover information from log files left over from aborted previous runs.

controls

A character vector of names of input parameter control sections that should be displayed in the sidebar. See "Customisation" below.

tabs

A character vector of names of the tabs that should be displayed in the main section. See "Customisation" below.

match

A character vector. Determines which quantities should be matched to observations each time the "steady" button is pressed. Possible entries are "growth" (using matchGrowth()), "biomass" (using matchBiomasses()) and "yield" (using matchYields()).

preserve

Specifies whether the reproduction_level should be preserved or the maximum reproduction rate R_max or the reproductive efficiency erepro (Default). See setBevertonHolt() for an explanation of the reproduction_level.

return_app

Boolean. For testing purposes only. When set to TRUE will return a shinyApp object instead of running the gadget.

...

Other params needed by individual tabs.

Value

The tuned MizerParams object

Details

This gadget is meant for tuning a model to steady state. It is not meant for tuning the dynamics of the model. That should be done in a second step using functions like setRmax() or changeResource().

There is an "Instructions" button near the top left of the gadget that gives you a quick overview of the user interface.

After you click the "Return" button in the side panel, the function will return the parameter object in the state at that time, with Rmax set to Inf and erepro set to the value it had after the last run to steady state.

At any time the gadget allows the user to download the current params object as an .rds file via the "Download" button.

Undo functionality

The gadget keeps a log of all steady states you create while working with the gadget. You can go back to the last steady state by hitting the "Undo" button. You can go back an arbitrary number of states and also go forward again. There is also a button to go right back to the initial steady state.

When you leave the gadget by hitting the "Return" button, this log is cleared. If you stop the gadget from RStudio by hitting the "Stop" button, then the log is left behind. You can then restart the gadget by calling tuneParams() without a params argument and it will re-instate the states from the log.

The log is stored in the tempdir of your current R session, as given by tempdir(). For each steady state you calculate the params objects is in a file named according to the date and time when it was created.

Customisation

You can customise which functionality is included in the app via the controls and tabs arguments. You can remove some of the controls and tabs by providing shorter lists to those arguments. You can also add your own controls and tabs.

For an entry "foo" in the controls list there needs to be a function "fooControlUI" that defines the input elements and a function "fooControl" that processes those inputs to change the params object. You can model your own control sections on the existing ones that you find in the file R/tuneParams_controls.R.

For any entry "Foo" or "foo" in the tabs list there needs to be a function "fooTabUI" that defines the tab layout and a function "fooTab" that calculates the outputs to be displayed on the tab. You can model your own tabs on the example tab that you find in the file R/exampleTab.R.

Limitations

The fishing control currently assumes that each species is selected by only one gear. It allows the user to change the parameters for that gear. It also enforces the same effort for all gears. It sets all efforts to that for the first gear and then allows the user to change that single effort value.