Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotYieldCurve() #53

Closed
gustavdelius opened this issue Apr 8, 2019 · 4 comments
Closed

plotYieldCurve() #53

gustavdelius opened this issue Apr 8, 2019 · 4 comments
Assignees
Labels
enhancement New feature requests or suggestions for enhancement of existing features plots Issue relates to plotting functionality

Comments

@gustavdelius
Copy link
Member

Mizer should have a function for plotting the yield curve. @Kenhasteandersen mentioned that he found the yield curve to be useful while calibrating a model. Ken, do you have code to share for plotting the yield curve in mizer?

@gustavdelius gustavdelius added the enhancement New feature requests or suggestions for enhancement of existing features label Apr 8, 2019
@Kenhasteandersen
Copy link
Contributor

Kenhasteandersen commented Apr 8, 2019 via email

@Kenhasteandersen
Copy link
Contributor

Would this do? It could go into the summary functions.

Ken


#' Calculate the a yield curve of a species
#'
#' Calculates the yield for a species for various values of effort for that species,
#' while the effort of the other species are kept constant.
#'
#' @param param An object of class \code{MizerParams}.
#' @param effort A vector of effort for a species.
#' @param iSpecies The number of the species to change.
#' @param F The fishing mortalities to sweep over
#'
#' @return An array containing the SSB (time x species)
#' @export
#' @family summary functions
#' @concept summary_function
#'
calcYieldCurve = function(param, effort, iSpecies, F=seq(0,2,length.out = 10)) {
yield = function(FF) {
effort[iSpecies] = FF
y = getYield( project(param, effort) )
return( y[dim(y)[1],] )
}

return( apply(as.matrix(F), 1, yield) )

}

@gustavdelius
Copy link
Member Author

Thank you Ken. That code would calculate the yield in year 100 after the change in fishing effort starting from the current initial condition (because the default for t_max in project() is 100). Is that really what we want?

How would you use the yield curve while calibrating the model?

@gustavdelius gustavdelius added the plots Issue relates to plotting functionality label Sep 9, 2019
@gustavdelius
Copy link
Member Author

Hi @Kenhasteandersen , thanks for contributing your code. I have for now moved it to the mizerExperimental package because it needs some work before it fits in nicely with the rest of mizer, see sizespectrum/mizerExperimental#6. All non-core code that can be developed first in mizerExperimental should first be developed there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature requests or suggestions for enhancement of existing features plots Issue relates to plotting functionality
Projects
None yet
Development

No branches or pull requests

2 participants