sizespectrum / mizer

Multi-species size-based ecological modelling in R
https://sizespectrum.org/mizer
38 stars 43 forks source link

Preserve reproduction parameters during tuning. #208

Closed gustavdelius closed 3 years ago

gustavdelius commented 3 years ago

Originally I had envisaged the tuning process as a two-step process:

  1. Tune species_parameters so that the steady state agrees with averaged observations
  2. Tune the non-linearities in the model to give agreement with time-series data.

Therefore the functions that are designed to support step 1, like steady() and tuneParams(), used to switch off density dependence in reproduction for simplicity, given that it would need to be changed in step 2 anyway.

@Kenhasteandersen and @juliablanchard have now argued that it would be nice to set R_max already during step 1 of the process and to have it preserved by the tuning tools. While I don't understand the benefit of setting R_max already during step 1, I can see the benefit of having reproduction parameters preserved by the step 1 tools just in case someone has a need to re-visit step 1 after having already done some work on step 2.

So I propose a preserve argument to steady() and tuneParams() which can be set to "R_max" if the original R_max should be reinstated at the end of the functions. I prefer the preserve = "R_max" syntax to preserve_R_max = TRUE because it could possibly be extended in the future to allow requests for preservation of other parameters during the tuning.

gustavdelius commented 3 years ago

Of course preserving R_max may not always be possible. For example in the tuneParams() app the user might increase the abundance of a species to a value that requires a higher reproduction rate than that set by R_max. In that case I believe the user should be issued with a warning and the R_max should be increased to just a tiny bit above the minimum required value.

gustavdelius commented 3 years ago

I have now implemented this in mizerExperimental, ready for testing.